From 2c565d533f1b41c98dcc13ed1be0fab85dedd1cc Mon Sep 17 00:00:00 2001 From: sam-astro <77079540+sam-astro@users.noreply.github.com> Date: Fri, 27 May 2022 20:30:04 -0400 Subject: [PATCH 1/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b52781..0607b1b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## 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. From d114cfe3fb845ab34bc49678a05c622dd30fc866 Mon Sep 17 00:00:00 2001 From: sam-astro <77079540+sam-astro@users.noreply.github.com> Date: Mon, 30 May 2022 10:40:17 -0400 Subject: [PATCH 2/9] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 0607b1b..647b17c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ +> 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 also has support for graphics using SDL2. @@ -7,6 +9,9 @@ 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://stevenrafft.github.io/ZSharpDocs/#/README) + ## Installation Downloading or installing is very simple, here is how depending on your version and operating system: ### Windows From fff73e5f141df6afa83f06a0e0766aaa6af01848 Mon Sep 17 00:00:00 2001 From: ConchetumareDev <89088882+susyboy23@users.noreply.github.com> Date: Wed, 1 Jun 2022 20:18:22 -0400 Subject: [PATCH 3/9] idk, maybe someone will use it :) --- ZSharp/ZS.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/ZSharp/ZS.h b/ZSharp/ZS.h index 0e1b68b..01cbbf9 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,17 @@ 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 percent2hundred(value, percent) + float temp = value * 100 / percent + return temp )" ; From 0a8b8f47d98de4316d3b99150986bbbc8ffa222a Mon Sep 17 00:00:00 2001 From: sam-astro <77079540+sam-astro@users.noreply.github.com> Date: Thu, 2 Jun 2022 22:05:58 -0400 Subject: [PATCH 4/9] Fix formatting and curly brackets --- ZSharp/ZS.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ZSharp/ZS.h b/ZSharp/ZS.h index 01cbbf9..18d9e02 100644 --- a/ZSharp/ZS.h +++ b/ZSharp/ZS.h @@ -205,17 +205,19 @@ func Perm(n, r) return Fac(n) / Fac(n - r) } -//////////////////////////// +////////////////////////////////////////// // ↓ MADE BY CONCHETUMARE_PRODUCTIONS ↓ // -//////////////////////////// -func getPercent(value, percent) +////////////////////////////////////////// +func GetPercent(value, percent) { float temp = value * percent / 100 return temp } //gets 100% of number -func percent2hundred(value, percent) +func PercentToHundred(value, percent) +{ float temp = value * 100 / percent return temp +} )" ; From 926a8e60f771465b9cc071d0f5c5913346d7b474 Mon Sep 17 00:00:00 2001 From: sam-astro <77079540+sam-astro@users.noreply.github.com> Date: Wed, 15 Jun 2022 18:04:17 -0400 Subject: [PATCH 5/9] Fix link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 521c09a..84d8a4c 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ There is ***no documentation***, ***strings*** barely work, ***performance*** is 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://stevenrafft.github.io/ZSharpDocs/#/README) +[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: From adcbe1f23213cb16cfc1b194836b5d30bb36dbc1 Mon Sep 17 00:00:00 2001 From: Rexo35 <98764898+Rexo35@users.noreply.github.com> Date: Tue, 23 Aug 2022 18:29:36 +0200 Subject: [PATCH 6/9] Add the "ZS.System.Command" function Add the "ZS.System.Command" function in order to run console commands. Something like pythons os.system() function. --- ZSharp/builtin.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ZSharp/builtin.h b/ZSharp/builtin.h index 4fda055..83f8306 100644 --- a/ZSharp/builtin.h +++ b/ZSharp/builtin.h @@ -13,6 +13,7 @@ #include #include #include +#include // for console command printing #include "strops.h" #include "graphics.h" @@ -467,6 +468,8 @@ 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") + temp = system(StringRaw(AnyAsString(args.at(0)))); else LogWarning("ZS function \'" + name + "\' does not exist."); From 0af8f5fff73a882184a5fc26b74983511c267961 Mon Sep 17 00:00:00 2001 From: Rexo35 <98764898+Rexo35@users.noreply.github.com> Date: Tue, 23 Aug 2022 22:02:17 +0200 Subject: [PATCH 7/9] Update builtin.h --- ZSharp/builtin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ZSharp/builtin.h b/ZSharp/builtin.h index 83f8306..a845beb 100644 --- a/ZSharp/builtin.h +++ b/ZSharp/builtin.h @@ -469,7 +469,7 @@ boost::any ZSFunction(const string& name, const vector& args) return v; } else if (name == "ZS.System.Command") - temp = system(StringRaw(AnyAsString(args.at(0)))); + int temp = system(StringRaw(AnyAsString(args.at(0)))); else LogWarning("ZS function \'" + name + "\' does not exist."); From eda78e8c399a59ca0cb20d1ccce6cb10b60ab739 Mon Sep 17 00:00:00 2001 From: Rexo35 <98764898+Rexo35@users.noreply.github.com> Date: Tue, 23 Aug 2022 22:11:15 +0200 Subject: [PATCH 8/9] Update builtin.h --- ZSharp/builtin.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ZSharp/builtin.h b/ZSharp/builtin.h index a845beb..c66f1cd 100644 --- a/ZSharp/builtin.h +++ b/ZSharp/builtin.h @@ -468,8 +468,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") - int temp = system(StringRaw(AnyAsString(args.at(0)))); + else if (name == "ZS.System.Command"){ + string command = StringRaw(AnyAsString(args.at(0))); + int command_len = command.length(); + char command_char_arr[command_len + 1]; + strcpy(command_char_arr, command.c_str()); // string into char arr + int k = system(command_char_arr); + } else LogWarning("ZS function \'" + name + "\' does not exist."); From d7c79c66018d50cb10012be536cf7f1b108e2a9f Mon Sep 17 00:00:00 2001 From: sam-astro <77079540+sam-astro@users.noreply.github.com> Date: Sun, 28 Aug 2022 12:43:01 -0400 Subject: [PATCH 9/9] Simplify and make work without warnings --- ZSharp/builtin.h | 16 ++++++++++++---- examples/console_application.zs | 5 +++++ 2 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 examples/console_application.zs diff --git a/ZSharp/builtin.h b/ZSharp/builtin.h index c66f1cd..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 @@ -470,10 +478,10 @@ boost::any ZSFunction(const string& name, const vector& args) } else if (name == "ZS.System.Command"){ string command = StringRaw(AnyAsString(args.at(0))); - int command_len = command.length(); - char command_char_arr[command_len + 1]; - strcpy(command_char_arr, command.c_str()); // string into char arr - int k = system(command_char_arr); + //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