Compare commits

...

178 Commits

Author SHA1 Message Date
sam-astro
a484bdc941
Clarify install requirements for linux 2023-03-05 13:15:51 -05:00
sam-astro
2292eb8abe Update version 2022-08-28 12:52:33 -04:00
sam-astro
f591e13089
Merge pull request #44 from sam-astro/dev
Add simple benchmark script
2022-08-28 12:44:38 -04:00
sam-astro
c8f51e0c94
Merge pull request #43 from Rexo35/patch-1
Add the "ZS.System.Command" function
2022-08-28 12:43:50 -04:00
sam-astro
d7c79c6601 Simplify and make work without warnings 2022-08-28 12:43:01 -04:00
sam-astro
66f1127c53 Add simple benchmark script 2022-08-28 12:27:25 -04:00
Rexo35
eda78e8c39
Update builtin.h 2022-08-23 22:11:15 +02:00
Rexo35
0af8f5fff7
Update builtin.h 2022-08-23 22:02:17 +02:00
Rexo35
adcbe1f232
Add the "ZS.System.Command" function
Add the "ZS.System.Command" function in order to run console commands. Something like pythons os.system() function.
2022-08-23 18:29:36 +02:00
sam-astro
926a8e60f7
Fix link 2022-06-15 18:04:17 -04:00
sam-astro
0d10a90e1b
Merge pull request #34 from sam-astro/dev
Dev
2022-06-08 16:11:41 -04:00
sam-astro
13715dae7a
Merge pull request #33 from bsikar/dev
updated dependencies on readmd (made it more readable)
2022-06-08 16:10:14 -04:00
Brighton Sikarskie
bfce93649c
updated dependencies on readmd 2022-06-08 11:45:20 -05:00
sam-astro
33f28b898d
Merge pull request #30 from susyboy23/patch-1
Percent functions
2022-06-02 22:07:01 -04:00
sam-astro
0a8b8f47d9
Fix formatting and curly brackets 2022-06-02 22:05:58 -04:00
ConchetumareDev
fff73e5f14
idk, maybe someone will use it :) 2022-06-01 20:18:22 -04:00
sam-astro
0d2e0faa56
Merge pull request #29 from sam-astro/dev
Probably final dev from me
2022-05-30 17:19:45 -04:00
sam-astro
d114cfe3fb
Update README.md 2022-05-30 10:40:17 -04:00
sam-astro
799b2d7d0b Add Z-Sharp to PATH in Windows 2022-05-29 16:31:40 -04:00
sam-astro
f7926c44ad I accidentally left debug things on 2022-05-29 15:19:27 -04:00
sam-astro
444fc24e1d Fix dumdum issue with singles ARGs - again... 2022-05-29 15:15:46 -04:00
sam-astro
2c565d533f
Update README.md 2022-05-27 20:30:04 -04:00
sam-astro
304093386a
Merge pull request #25 from sam-astro/dev
Features and bug fix v2.1.1-alpha
2022-05-27 20:26:10 -04:00
sam-astro
68c5ef214f
Update README.md 2022-05-27 20:21:27 -04:00
sam-astro
a8ed99a7b4 Don't print escape sequences in logs, print raw 2022-05-27 20:14:07 -04:00
sam-astro
b25fee150a Update builtin.h 2022-05-27 20:00:15 -04:00
sam-astro
dc580c2257 Update builtin.h 2022-05-27 19:57:55 -04:00
sam-astro
c40d902cef Attempt to fix unix time get 2022-05-27 19:51:25 -04:00
sam-astro
582656be7b Update exit message 2022-05-27 19:43:39 -04:00
sam-astro
1188412769 Change version, fix wrong ball rotation, use circle sprite 2022-05-27 19:35:07 -04:00
sam-astro
d24044a242 Fix issues, add features
* Allow for odd spacing, (ex. tabs, no tabs, spaces, etc.)
* Rename from determinant to comparer
* Fix syntax
* Fix issues with single arg function calls, and `Print` and `Printl` functions now work
* Escape sequences now work as they should
2022-05-27 19:16:41 -04:00
sam-astro
49429461e8
Add more error checking 2022-05-27 08:40:19 -04:00
sam-astro
438f366ba4
add EXIT_WHEN_DONE = false 2022-05-27 08:24:56 -04:00
sam-astro
33805294d3
add EXIT_WHEN_DONE = false 2022-05-27 08:24:30 -04:00
sam-astro
5e89ac5884
Fix typos, add EXIT_WHEN_DONE variable, change formatting 2022-05-27 08:17:57 -04:00
sam-astro
89392bc34d
Update Main.cpp
Disable for comment checking, make `ZS.` check safer, allow more variables to be initialized outside of functions (global), let people set the global builtin variable of `EXIT_WHEN_DONE` to true or false, depending if they are a developer and want to leave the console window open after the program finishes.
2022-05-27 08:14:03 -04:00
sam-astro
bfc3c4d727 ^ 2022-05-26 21:02:08 -04:00
sam-astro
44b2e40e94 (broken) Allow for any amount of whitespace 2022-05-26 21:01:44 -04:00
sam-astro
f0321d9927
Update extra-include.zs 2022-05-26 10:49:10 -04:00
sam-astro
865c2761bb
Update Main.cpp 2022-05-26 08:36:45 -04:00
sam-astro
a4f7bdab2b
Remove useless lines during preprocessing 2022-05-26 08:16:38 -04:00
sam-astro
a1dcb55468 Antialiased text as an extra Text option, update platformer 2022-05-25 17:34:06 -04:00
sam-astro
70a2c8ce7e
Merge pull request #22 from Kaputchino/master
Add mathematical functions
2022-05-25 15:21:37 -04:00
sam-astro
b321a36b7d
Fix formatting, spelling 2022-05-25 15:20:17 -04:00
Kaputchino
7ce2d39b93
sort correctly the added functions 2022-05-25 19:02:29 +02:00
Kaputchino
7d7033cd61
add functions 2022-05-25 18:56:07 +02:00
sam-astro
ba92119cfe
Add DLL requirements for windows 2022-05-25 11:10:56 -04:00
sam-astro
1ad7019940
Allow for single args as bool ex. if 3 instead of if 3 == 3 2022-05-25 10:45:15 -04:00
sam-astro
e0966a7920
Update if and while
Make `if` and `while` more efficient, and allow using the `break` and `continue` keywords
2022-05-25 10:33:59 -04:00
sam-astro
63ba06713c
Update betweenChars function
To make more efficient and allow for strings with special characters as function arguments
2022-05-25 09:06:47 -04:00
sam-astro
86af2af61a
Optimize script 2022-05-25 07:46:22 -04:00
sam-astro
3d8fca05ba
Add description 2022-05-25 07:25:14 -04:00
sam-astro
2cce226575 Working on platformer 2022-05-24 21:40:58 -04:00
sam-astro
725ec88fd5 Merge branch 'master' into dev 2022-05-24 21:12:47 -04:00
sam-astro
4fd4964f57 Fix issues that make pong not run in 2.1.0-alpha 2022-05-24 19:08:51 -04:00
sam-astro
30d8bb5424 Change version to alpha 2022-05-24 19:01:05 -04:00
sam-astro
64149d31ca Update ZSharpInstallerMakerInnoSetup.iss 2022-05-24 18:42:03 -04:00
sam-astro
21bc707432 Change version to 2.1.0 2022-05-24 18:40:11 -04:00
sam-astro
f6462291a7 Convert int to string 2022-05-24 18:27:23 -04:00
sam-astro
92bc9ebea4 Change from c_str to std::string 2022-05-24 18:25:20 -04:00
sam-astro
8fd332495c Merge branch 'dev' of https://github.com/sam-astro/Z-Sharp into dev 2022-05-24 18:24:42 -04:00
sam-astro
350072a6ac Change from c_str to std::string 2022-05-24 18:24:32 -04:00
sam-astro
b6eba24fbe
Merge dev Feature additions
* Allow for curly brackets on the same line as if statements and while loops (you need a space between the argument and bracket ex. `if 1 == 1 {`)
* Scaling sprites
* Different window scaling options, provided as an extra argument in ZS.Graphics.Init `ZS.Graphics.Init("Title of window", screenWidth, screenHeight, scalingAmount)`
* You can now use `include` to use the functions and variables from another Z# file inside of your script. use like so: `include "./path/to/script.zs"`
2022-05-24 18:21:35 -04:00
sam-astro
83f0affa64
Merge branch 'master' into dev 2022-05-24 18:20:20 -04:00
sam-astro
b8320da1aa Allow sprite scaling 2022-05-24 18:10:28 -04:00
sam-astro
3c684f2153 Much better function ARG parsing, allowing other functions as ARGs 2022-05-24 16:10:39 -04:00
sam-astro
4ae56e427a
Update README.md 2022-05-24 15:42:34 -04:00
sam-astro
19073fcc7c Merge branch 'dev' of https://github.com/sam-astro/Z-Sharp into dev 2022-05-24 15:39:34 -04:00
sam-astro
75914d57b2 Line number reversion fixed & started on functions issue
Fixed issue where line number was reverted, causing if statements to not skip if false. Started working on problem causing functions to not execute correctly.
2022-05-24 15:39:32 -04:00
sam-astro
532d983195
Add some error checking 2022-05-24 08:15:01 -04:00
sam-astro
ab6f04e3cc
Fix pixel scaling from fixed value to WINDOW 2022-05-24 07:24:18 -04:00
sam-astro
d9af3705ad Merge branch 'master' of https://github.com/sam-astro/Z-Sharp 2022-05-23 15:24:38 -04:00
sam-astro
0c700407f6 Update ZSharpInstallerMakerInnoSetup.iss 2022-05-23 15:24:35 -04:00
sam-astro
61a6d98e49
Fix bug with changing Sprite scale at runtime 2022-05-23 09:34:20 -04:00
sam-astro
44b07f402b
Change function evaluation to allow for other unsolved functions as args 2022-05-23 09:29:07 -04:00
sam-astro
5e02c71b1d
Add function to better process function args and such 2022-05-23 09:20:24 -04:00
sam-astro
ebb54a0a27
Add function to better process function args and such 2022-05-23 09:20:14 -04:00
sam-astro
572da33ee0
Fix issues with if and while, also added an else statement 2022-05-23 08:08:43 -04:00
sam-astro
01433fcba3
Merge pull request #18 from sheeepdev/master
📝 Add dependency install instructions for Arch-based systems
2022-05-23 07:49:29 -04:00
sheep
04e4125ae4
📝 Add install instructions for Arch-based systems
Include the command and package name equivalent to the debian packages on arch linux
2022-05-23 12:13:11 +02:00
sam-astro
036253e92c
Update README.md 2022-05-22 18:23:33 -04:00
sam-astro
faeef8851e
Change initial load RenderText to also be Blended 2022-05-22 17:25:21 -04:00
sam-astro
5d709f8d2a
Merge pull request #13 from TheAwesome98-Real/master
Use TTF_RenderText_Blended for smoother text
2022-05-22 17:18:31 -04:00
sam-astro
664c6de666 Implement new functions for easier parsing, pixel scaling, and started making threading 2022-05-22 16:39:53 -04:00
sam-astro
74df9cdaf7 Allow for same-line curly brackets on: if, while, func 2022-05-22 13:28:57 -04:00
sam-astro
cefbbd140b Allow including other .ZS files in order to import other functions and variables 2022-05-22 13:06:02 -04:00
TheAwesome98
9c1f999425
change rendertext to use blended 2022-05-22 17:36:38 +01:00
sam-astro
575195930b Change output folder to ZS_Win_Base_Raw 2022-05-22 10:34:26 -04:00
sam-astro
bbc1e1f16b Change output folder to ZS_Win_Base_Raw 2022-05-22 10:33:46 -04:00
sam-astro
032d1fefe6 Switch back to \n 2022-05-22 10:27:40 -04:00
sam-astro
194d2dad59 Switch back to \n 2022-05-22 10:27:02 -04:00
sam-astro
d0d66d6c16 Merge branch 'master' into dev 2022-05-22 10:23:34 -04:00
sam-astro
d5a777db13
Update README.md 2022-05-22 09:47:47 -04:00
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
bf70fb296e Fix dev line ending check 2022-05-22 09:21:49 -04:00
sam-astro
22439cc357
Create script.zs 2022-05-22 00:23:27 -04:00
sam-astro
ffc10d13e4
Update README.md 2022-05-21 23:47:51 -04:00
sam-astro
31c287c88a Merge branch 'master' of https://github.com/sam-astro/Z-Sharp 2022-05-21 14:04:26 -04:00
sam-astro
b3c2538514 Merge branch 'dev' 2022-05-21 14:03:20 -04:00
sam-astro
14c4a6a6c8
Update README.md 2022-05-21 13:53:24 -04:00
sam-astro
777066e069 Fix errors caused by checking escaped quotes out of range 2022-05-21 13:38:41 -04:00
sam-astro
53e8f53fdf Merge branch 'master' of https://github.com/sam-astro/Z-Sharp 2022-05-21 12:57:34 -04:00
sam-astro
e42c86cefe Made new windows installer 2022-05-21 12:57:24 -04:00
sam-astro
ffee5e3036
Update README.md 2022-05-21 12:53:06 -04:00
sam-astro
6a4076de58 Fix formatting and spelling 2022-05-21 12:04:00 -04:00
sam-astro
ef328935b9
Change func Update() to func Update(deltaTime) 2022-05-20 23:02:50 -04:00
sam-astro
bd2c7b9c28
Update issue templates 2022-05-19 15:40:30 -04:00
sam-astro
983d2fde7f
Update Main.cpp 2022-05-19 13:55:24 -04:00
sam-astro
90dad7998f
Update README.md 2022-05-19 09:11:17 -04:00
sam-astro
c75ba20ff6
Update Main.cpp 2022-05-19 08:40:49 -04:00
sam-astro
923c4ef14a
Create codeql-analysis.yml 2022-05-19 08:11:33 -04:00
sam-astro
7d1620e433
Allow for escaped quotes, start allowing for semicolon line endings 2022-05-18 10:46:36 -04:00
sam-astro
fe371716c9 No longer fail to update if version codes are off 2022-05-09 18:00:12 -04:00
sam
2f4006e3af Linux build 2022-05-09 16:20:00 -04:00
sam-astro
7a4464725f Color printing text for windows 2022-05-09 16:16:28 -04:00
sam-astro
0350150563
Implement new colored printing 2022-05-09 08:54:36 -04:00
sam-astro
d8f7fff65f
Update CMakeLists.txt 2022-05-09 08:34:45 -04:00
sam-astro
e790bced0a
Adding new color handler for windows
Sometimes escape characters for colors don't work, so you just get something weird printing in the console like `\x1B[30m`
2022-05-09 08:33:29 -04:00
sam-astro
58f7a0fa4c
Update README.md 2022-03-09 08:08:50 -05:00
sam-astro
f4a64c563f
Merge pull request #2 from sam-astro/add-license-1
Create LICENSE
2022-02-03 20:47:17 -05:00
sam-astro
faa5f142cb
Create LICENSE 2022-02-03 20:47:00 -05:00
sam-astro
709ac93d3b Sharpened icon 2022-01-30 21:53:00 -05:00
sam-astro
b5f559337f
Update README.md 2022-01-30 19:23:29 -05:00
sam-astro
0756ca184f Merge branch 'master' of https://github.com/sam-astro/Z-Sharp 2022-01-30 19:23:02 -05:00
sam-astro
73acff5b09 Add more versions 2022-01-30 19:22:52 -05:00
sam-astro
336209a7b4
Update README.md 2022-01-30 19:19:10 -05:00
sam-astro
e0c40829ec Create ZS-Logo-Small.png 2022-01-30 19:18:30 -05:00
sam-astro
e86fa77497 Added smaller version 2022-01-30 19:14:48 -05:00
sam-astro
05490ea1dc Changed to red color scheme because I forgot C# was already purple :( 2022-01-30 19:12:26 -05:00
sam-astro
eb9f7be21e
Update README.md 2022-01-30 13:29:31 -05:00
sam-astro
1bd56409be
Fix typo 2022-01-30 12:43:09 -05:00
sam-astro
5a040ae9d9
Update README.md 2022-01-30 11:41:10 -05:00
sam-astro
01cf9dd667
Add logo images 2022-01-30 11:18:24 -05:00
sam-astro
a3b584d366 Move icon to ExtraResources 2022-01-29 20:46:20 -05:00
sam
6bf5a11c90 Update linux to latest code version 2022-01-29 19:53:59 -05:00
sam-astro
e20c7aae8e Update CMakeCache.txt 2022-01-29 19:34:11 -05:00
sam-astro
fa7c6691da Update icons and fix ZS builtin usage detection 2022-01-29 19:11:42 -05:00
sam-astro
2961caf207 Update README.md 2022-01-29 18:13:12 -05:00
sam-astro
4335fc8abb
Create README.md 2022-01-29 18:11:34 -05:00
sam-astro
8c296f182d Rename all to ZSharp 2022-01-29 18:10:56 -05:00
sam-astro
d1a27129d2
Update README.md 2022-01-29 17:07:56 -05:00
sam-astro
7e784d3188 Change [] operator to .at(), use cin() instead of system("pause"), use cout instead of cerr, add required .dlls
* Change [] operator to .at() for vectors for proper error handling
* Use cin() instead of system("pause") for better cross-platform compatability
* Added libfreetype-6.dll, libjpeg-9.dll, libpng16-16.dll, libtiff-5.dll, libwebp-7.dll, zlib1.dll
2022-01-17 12:13:34 -05:00
sam-astro
a07f7aa61f Change key for AI toggle 2022-01-16 18:29:34 -05:00
sam-astro
a24e855001 Update pong
Added instructions
Created togglable AI
2022-01-16 18:23:47 -05:00
sam
f537cf49dd Linux version now works 2022-01-16 16:11:26 -05:00
sam
ebc3954265 Almost done making linux version, window is showing but there is still an error 2022-01-16 15:06:49 -05:00
sam
fa870f46d5 Porting code to linux 2022-01-16 14:07:27 -05:00
sam-astro
c5c2230736 remove system("pause") 2022-01-15 23:05:59 -05:00
sam-astro
6018e9f4f0 Devmode and things to get linux version working 2022-01-15 23:01:54 -05:00
sam-astro
b3c9e2f2e0 Add examples directory 2022-01-15 22:55:32 -05:00
sam-astro
196b6d9e95 Remove library link 2022-01-15 22:53:31 -05:00
sam-astro
b02c97fcd9 Fixing lSDL2 issue 2022-01-15 22:49:43 -05:00
sam-astro
f52a2a194d Fixed issue where I only change a single instance lol 2022-01-15 22:36:31 -05:00
sam-astro
00bd652695 Update Main.cpp 2022-01-15 22:30:02 -05:00
sam-astro
c7a6e17d6c Fix invalid conversion from std::string to const char * 2022-01-15 22:27:40 -05:00
sam-astro
d2e9a95d08 Change directory 2022-01-15 22:24:33 -05:00
sam-astro
967f14a7ae Include SDL_ttf 2022-01-15 22:22:39 -05:00
sam-astro
b96061026f Remove useless 2022-01-15 22:14:55 -05:00
sam-astro
ff86916f34 Include SDL2_image 2022-01-15 22:12:27 -05:00
sam-astro
a42bc685db Update CMakeLists.txt 2022-01-15 22:05:02 -05:00
sam-astro
6800ed6284 Added include for math 2022-01-15 22:00:14 -05:00
sam-astro
ba96d28063 Update CMakeLists.txt 2022-01-15 21:43:31 -05:00
sam-astro
4cbfe6919d Update CMakeLists.txt 2022-01-15 21:33:19 -05:00
sam-astro
fd94c0a448 Update CMakeLists.txt 2022-01-15 20:44:49 -05:00
sam-astro
3a7e8d661b try again 2022-01-15 20:41:57 -05:00
sam-astro
e33f16ffc0 Update CMakeLists.txt 2022-01-15 20:37:27 -05:00
sam-astro
7947997f8e Revert "Remove redundant"
This reverts commit 6c56a339d3e6c6dd892cc4694d41c2e6c4f5182b.
2022-01-15 20:35:35 -05:00
sam-astro
ebeaf65513 Revert "Included boost libraries"
This reverts commit 79994b09112c8ad598611045f72ad029531cf6e7.
2022-01-15 20:34:33 -05:00
sam-astro
6c56a339d3 Remove redundant 2022-01-15 20:25:23 -05:00
sam-astro
79994b0911 Included boost libraries 2022-01-15 20:22:33 -05:00
sam-astro
cba3d1b798 Made work with CMake 2022-01-15 18:59:01 -05:00
sam-astro
61c2c065ed Merge branch 'master' of https://github.com/sam-astro/StuLang 2022-01-15 16:54:21 -05:00
sam-astro
fb19f8e397 remove pong from interpreter source, add CMakeLists.txt 2022-01-15 16:15:18 -05:00
sam-astro
82d25b1ab8
Update README.md 2022-01-15 15:55:19 -05:00
sam-astro
4f960ce685 Revert "Rename to StuLang"
This reverts commit c11f089178b58189558dad072df29a8fd3beac13.
2022-01-15 15:53:55 -05:00
sam-astro
c11f089178 Rename to StuLang 2022-01-15 15:45:33 -05:00
sam-astro
4e8bad130c Bundle pong with release 2022-01-15 15:01:45 -05:00
sam-astro
483e2952d0 Changed organization, Also built in Release mode so the FPS is often over 300 2022-01-15 14:54:15 -05:00
sam-astro
687b9c6972 Fixed bug with Sprites, Created installer
Sprites would not center at initialization, instead only after changing a second time

Installer for adding Slang interpreter to 'Program Files' directory in Windows
2022-01-15 14:07:16 -05:00
93 changed files with 7652 additions and 1254 deletions

20
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,20 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
**Describe your issue**
A clear and concise description.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
**Screenshots**
If applicable, add screenshots to help explain your problem.

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

72
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,72 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '26 5 * * 5'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 800 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

BIN
ExtraResources/ZS-Icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
ExtraResources/ZS-Icon.psd Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
ExtraResources/ZS-Logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
ExtraResources/ZS-Logo.psd Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 800 KiB

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 sam-astro
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,6 +1,56 @@
# Slang
Slang, which stands for ***S****tupid **Lang**uage* is a custom programming language I made because I don't like c++ very much (Slang's interpreter is written in c++ though). Slang scripts have the file extension .slg. The base syntax and formatting I would say is quite similar to C#, but differs as task complexity increases. It has support for graphics using SDL2, and by default is not enabled. Here is some example code.
```c#
<img src="https://raw.githubusercontent.com/sam-astro/Z-Sharp/master/ExtraResources/ZS-Gem-Icon-Small.png"/><img src="https://raw.githubusercontent.com/sam-astro/Z-Sharp/master/ExtraResources/ZS-Logo-Light-Small.png"/>
> 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.
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
1. Navigate to [the most recent release](https://github.com/sam-astro/Z-Sharp/releases) and download `ZSharp-Win-Installer.zip`.
2. Unzip `ZSharp-Win-Installer.zip` and open the unzipped folder.
3. Inside is a single file titled `ZSharp-Setup.exe`. Run it, and follow the setup instructions.
4. If it fails to run, make sure the `MS Visual Runtime and MSVC C++ Redistribute` are installed. You can download them [here from Microsoft](https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist)
5. Now that it is installed, there are a few ways to use it:
* (recommended) Any ZSharp file that ends with .ZS will automatically be associated with the interpreter. Just double-click it, and the interpreter will run.
* Drag and drop any .ZS script directly onto the executable.
* Use command line, providing path to interpreter and then to script like so:
`> ./ZSharp.exe ./Pong-Example-Project/script.zs`
6. Feel free to use and edit the `Pong-Example-Project`. It is a single script called `script.zs`, and you can open it with any of the methods above. It is also located on the releases page.
> If you don't want to install ZSharp on your device, or you want easier acces to the executable and .DLLs, another version is provided called `ZS_Win_Base_Raw.zip`. This just contains all of the files the installer puts on your computer.
### Linux
1. Install requirements: `SDL2, SDL2 Image, SDL2 TTF` Commands for `apt` and `pacman` below:
#### Debian
```
$ sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev
```
#### Arch
```
$ sudo pacman -S sdl2 sdl2_image sdl2_ttf
```
2. Navigate to [the most recent release](https://github.com/sam-astro/Z-Sharp/releases) and download `ZSharp-Linux.zip`.
3. Unzip `ZSharp-Linux.zip` and open the unzipped folder.
4. You will see some files. The Z# interpreter is `ZSharp`. Any time you want to execute a script, this is the program that will be used. You can use it like so:
* Use terminal, providing path to executable and then to script like so:
`$ ./ZSharp ./Pong-Example-Project/script.zs`
5. Feel free to use and edit the included `Pong-Example-Project`. It is a single script called `script.zs`, and you can open it with any of the methods above.
## Here is some example code:
```c++
// Comments are indicated by two forward slashes
// They can only be on their own line
// int j = 4 // <- This is invalid comment placement
@ -23,7 +73,7 @@ func Main()
if s == "r"
{
print s + " is r"
Printl(s + " is r")
}
int functionNumber = ExampleFunction("A", s)
@ -37,8 +87,8 @@ func Main()
/// be assigned at all on execute and can be left blank
func ExampleFunction(inputA, inputB)
{
print "In A is: " + inputA
print "In B is: " + inputB
Printl("In A is: " + inputA)
Printl("In B is: " + inputB)
// Return a value to the valling location
return 4
@ -52,12 +102,12 @@ func GlobalFunction()
}
```
Here is how to use graphics:
```c#
```c++
func Main()
{
int screenWidth = 500
int screenHeight = 500
CPP.Graphics.Init("Title of window", screenWidth, screenHeight)
ZS.Graphics.Init("Title of window", screenWidth, screenHeight)
// After graphics are initialized, the main function will not finish.
// Instead, Start() will be called a single time, then Update() every frame after that.
}
@ -71,13 +121,32 @@ func Start()
float rotation = 0
// Sprite object, stores (and loads from file) the texture, location, scale, and rotation
global Sprite exampleSprite = CPP.Graphics.Sprite("./square.png", position, scale, rotation)
global Sprite exampleSprite = ZS.Graphics.Sprite("./square.png", position, scale, rotation)
}
// Executes each frame
func Update()
func Update(deltaTime)
{
// Draws the image created in Start(). This is usually at the end of update.
CPP.Graphics.Draw(exampleSprite)
ZS.Graphics.Draw(exampleSprite)
}
```
Currently, ZSharp is ***VERY*** strict with formatting, and can throw an error if you forget to put a space somewhere.
Also, speaking of errors, if your code has any it will show in the console. Errors are colored red, and warnings are colored yellow. A line number will also usually be provided. This is ***Not*** the line relative to the *documents* beginning, but rather the *functions* beginning.
Example:
```
ERROR: line 5 in function Main
```
This is the 5th line *inside of Main*.
```c++
func Main()
{
// line 1
// line 2
// line 3
// line 4
int g = "s"
// ^ above line is the error, since it is line 5
}
```
I am planning to change how error reporting works to report the document line number as well, but this is how it is for now.

View File

@ -1,11 +0,0 @@
cmake_minimum_required(VERSION 3.10)
# set the project name
project(Slang)
# add the executable
#add_executable(Main.cpp)
target_include_directories(Slang PUBLIC
"${PROJECT_BINARY_DIR}"
)

View File

@ -1,690 +0,0 @@
#include <iostream>
#include <fstream>
#include <string>
#include <regex>
#include <limits>
#include <algorithm>
#include <cstdlib>
#include <sstream>
#include <boost/any.hpp>
#include <unordered_map>
#include <stdio.h>
#include <codecvt>
#if defined(__unix__)
#include <unistd.h>
#elif defined(_MSC_VER)
#include <windows.h>
#endif
#include "eval.h"
#include "strops.h"
#include "builtin.h"
#include "main.h"
#include "anyops.h"
#include "SLB.h"
#define DEVELOPER_MESSAGES false
#define EXAMPLE_PROJECT false
using namespace std;
using namespace boost;
unordered_map<string, boost::any> globalVariableValues;
unordered_map<string, vector<vector<string>>> functionValues;
boost::any GetVariableValue(const string& varName, const unordered_map<string, boost::any>& variableValues)
{
string classSubComponent;
string baseName = trim(varName);
if (count(varName, '.') > 0)
{
classSubComponent = trim(varName.substr(indexInStr(varName, '.') + 1, -1));
baseName = trim(split(varName, '.')[0]);
}
boost::any outputValue = nullType;
auto iA = variableValues.find(baseName);
auto iB = globalVariableValues.find(baseName);
if (iA != variableValues.end())
outputValue = iA->second;
else if (iB != globalVariableValues.end())
outputValue = iB->second;
else
outputValue = varName;
if (count(varName, '.') > 0 && !outputValue.empty())
return GetClassSubComponent(outputValue, classSubComponent);
else
return outputValue;
}
bool IsVar(const string& varName, const unordered_map<string, boost::any>& variableValues)
{
if (variableValues.find(split(varName, '.')[0]) != variableValues.end() && split(varName, '.')[0] != "SLB")
return true;
else
return false;
}
vector<boost::any> VarValues(const vector<string>& varNames, unordered_map<string, boost::any>& variableValues)
{
vector<boost::any> realValues;
for (int varIndex = 0; varIndex < varNames.size(); varIndex++)
{
string varName = trim(varNames[varIndex]);
//realValues.push_back(EvalExpression(varName, variableValues));
auto iA = variableValues.find(varName);
if (iA != variableValues.end())
{
realValues.push_back(iA->second);
}
else
{
auto iB = globalVariableValues.find(varName);
if (iB != globalVariableValues.end())
realValues.push_back(iB->second);
else
realValues.push_back(EvalExpression(varName, variableValues));
}
}
return realValues;
}
bool IsFunction(const string& funcName)
{
if (functionValues.find(funcName) != functionValues.end())
return true;
else
return false;
}
bool IsSLBFunction(const string& funcName)
{
if (funcName[0] == 'S' && funcName[1] == 'L' && funcName[2] == 'B' && funcName[2] == '.')
return true;
else
return false;
}
boost::any EvalExpression(const string& ex, unordered_map<string, boost::any>& variableValues)
{
string expression = trim(ex);
bool inQuotes = false;
#if DEVELOPER_MESSAGES == true
InterpreterLog("OLDEXPRESSION: |" + expression + "|");
#endif
bool isFunc = IsFunction(split(expression, '(')[0]);
bool isSLB = split(expression, '.')[0] == "SLB";
// If no operations are applied, then return self
if ((countOutsideParenthesis(expression, '+') == 0 && countOutsideParenthesis(expression, '-') == 0 && countOutsideParenthesis(expression, '*') == 0 && countOutsideParenthesis(expression, '/') == 0 && countOutsideParenthesis(expression, '^') == 0) || split(expression, '.')[0] == "SLB")
{
bool isFunc = IsFunction(split(expression, '(')[0]);
if (isFunc && !inQuotes)
{
//cout << split(expression, '(')[0] << endl;
string argContents = "";
int y = indexInStr(expression, '(') + 1;
while (y < expression.size() && expression[y] != ')')
{
argContents += expression[y];
y++;
}
return ExecuteFunction(split(expression, '(')[0], VarValues(split(argContents, ','), variableValues));
}
else if (split(expression, '.')[0] == "SLB" && !inQuotes)
{
string argContents = "";
int y = indexInStr(expression, '(') + 1;
while (y < expression.size() && expression[y] != ')')
{
argContents += expression[y];
y++;
}
return SLBFunction(split(expression, '(')[0], VarValues(split(argContents, ','), variableValues));
}
else
return GetVariableValue(expression, variableValues);
}
string newExpression = "";
inQuotes = false;
for (int i = 0; i < expression.size(); i++)
{
if (expression[i] == '\"')
inQuotes = !inQuotes;
if (isalpha(expression[i]))
{
string name = "";
while (i < expression.size() && (isalpha(expression[i]) || expression[i] == '.'))
{
name += expression[i];
i++;
}
//string varVal = GetVariableValue(name, variables, variableValues);
bool isFunc = IsFunction(name);
if (isFunc && !inQuotes)
{
string argContents = "";
i++;
while (i < expression.size() && expression[i] != ')')
{
argContents += expression[i];
i++;
}
string returnVal = AnyAsString(ExecuteFunction(name, VarValues(split(argContents, ','), variableValues)));
newExpression += returnVal;
}
else if (split(name, '.')[0] == "SLB" && !inQuotes)
{
string argContents = "";
int y = indexInStr(expression, '(') + 1;
while (y < expression.size() && expression[y] != ')')
{
argContents += expression[y];
y++;
}
//cout << split(expression, '(')[0] << " " << argContents << endl;
string returnVal = AnyAsString(SLBFunction(split(name, '(')[0], VarValues(split(argContents, ','), variableValues)));
newExpression += returnVal;
}
else
{
if (inQuotes)
newExpression += name;
else
newExpression += AnyAsString(GetVariableValue(name, variableValues));
}
i--;
}
else
{
newExpression += expression[i];
}
}
#if DEVELOPER_MESSAGES == true
InterpreterLog("NEW EXPRESSION: |" + newExpression + "|");
#endif
bool addStrings = false;
for (int i = 0; i < (int)newExpression.size(); i++)
if (isalpha(newExpression[i]) || newExpression[i] == '\"')
{
addStrings = true;
break;
}
if (addStrings)
{
inQuotes = false;
string withoutParenthesis = "";
for (int i = 0; i < (int)newExpression.size(); i++)
{
if (newExpression[i] == '\"')
{
inQuotes = !inQuotes;
continue;
}
if (inQuotes)
withoutParenthesis += newExpression[i];
if (!inQuotes && newExpression[i] != '(' && newExpression[i] != ')' && newExpression[i] != '+' && newExpression[i] != ' ')
withoutParenthesis += newExpression[i];
}
//cout << "NewSTRING = " << Quoted(withoutParenthesis) << endl;
return withoutParenthesis;
}
else
return evaluate(newExpression);
}
bool BooleanLogic(const string& valA, const string& determinant, const string& valB, unordered_map<string, boost::any>& variableValues)
{
boost::any valARealValue = EvalExpression(valA, variableValues);
boost::any valBRealValue = EvalExpression(valB, variableValues);
#if DEVELOPER_MESSAGES == true
InterpreterLog(AnyAsString(valARealValue) + " " + determinant + " " + AnyAsString(valBRealValue) + " : " + AnyAsString(valA) + " " + determinant + " " + AnyAsString(valB) + " : " + to_string(AnyAsString(valARealValue) == AnyAsString(valBRealValue)));
#endif
if (determinant == "==")
return any_compare(valARealValue, valBRealValue);
else if (determinant == "!=")
return !any_compare(valARealValue, valBRealValue);
else if (determinant == ">=")
return AnyAsFloat(valARealValue) >= AnyAsFloat(valBRealValue);
else if (determinant == "<=")
return AnyAsFloat(valARealValue) <= AnyAsFloat(valBRealValue);
else if (determinant == ">")
return AnyAsFloat(valARealValue) > AnyAsFloat(valBRealValue);
else if (determinant == "<")
return AnyAsFloat(valARealValue) < AnyAsFloat(valBRealValue);
else
LogWarning("unrecognized determinant \'" + determinant + "\'");
return false;
}
int varOperation(const vector<string>& str, unordered_map<string, boost::any>& variableValues)
{
if (IsVar(str[0], variableValues))
{
// Checks if type is simple, like int or string
if (any_type(variableValues[str[0]]) <= 3)
{
if (str[1] == "=")
variableValues[str[0]] = EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues);
else if (str[1] == "+=")
variableValues[str[0]] = EvalExpression(str[0] + "+(" + unWrapVec(vector<string>(str.begin() + 2, str.end())) + ")", variableValues);
else if (str[1] == "-=")
variableValues[str[0]] = AnyAsFloat(variableValues[str[0]]) - AnyAsFloat(EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues));
else if (str[1] == "*=")
variableValues[str[0]] = AnyAsFloat(variableValues[str[0]]) * AnyAsFloat(EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues));
else if (str[1] == "/=")
variableValues[str[0]] = AnyAsFloat(variableValues[str[0]]) / AnyAsFloat(EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues));
else
LogWarning("unrecognized operator \'" + str[1] + "\'");
}
// Else it is a Vec2. No other complex class can be operated on it's base form (ex. you can't do: Sprite += Sprite)
else if (any_type(variableValues[str[0]]) == 5)
{
boost::any otherExpression = EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues);
if (str[1] == "=")
variableValues[str[0]] = otherExpression;
else if (str[1] == "+=")
variableValues[str[0]] = AnyAsVec2(variableValues[str[0]]) + AnyAsVec2(otherExpression);
else if (str[1] == "-=")
variableValues[str[0]] = AnyAsVec2(variableValues[str[0]]) - AnyAsVec2(otherExpression);
else if (str[1] == "*=")
variableValues[str[0]] = AnyAsVec2(variableValues[str[0]]) * AnyAsFloat(otherExpression);
else if (str[1] == "/=")
variableValues[str[0]] = AnyAsVec2(variableValues[str[0]]) / AnyAsFloat(otherExpression);
else
LogWarning("unrecognized operator \'" + str[1] + "\'");
}
return 0;
}
else if (IsVar(str[0], globalVariableValues))
{
// Checks if type is simple, like int or string
if (any_type(globalVariableValues[str[0]]) <= 3)
{
if (str[1] == "=")
globalVariableValues[str[0]] = EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues);
else if (str[1] == "+=")
globalVariableValues[str[0]] = EvalExpression(str[0] + "+(" + unWrapVec(vector<string>(str.begin() + 2, str.end())) + ")", variableValues);
else if (str[1] == "-=")
globalVariableValues[str[0]] = AnyAsFloat(globalVariableValues[str[0]]) - AnyAsFloat(EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues));
else if (str[1] == "*=")
globalVariableValues[str[0]] = AnyAsFloat(globalVariableValues[str[0]]) * AnyAsFloat(EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues));
else if (str[1] == "/=")
globalVariableValues[str[0]] = AnyAsFloat(globalVariableValues[str[0]]) / AnyAsFloat(EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues));
else
LogWarning("unrecognized operator \'" + str[1] + "\'");
}
// Else it is a Vec2. No other complex class can be operated on it's base form (ex. you can't do: Sprite += Sprite)
else if (any_type(globalVariableValues[str[0]]) == 5)
{
boost::any otherExpression = EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues);
if (str[1] == "=")
globalVariableValues[str[0]] = otherExpression;
else if (str[1] == "+=")
globalVariableValues[str[0]] = AnyAsVec2(globalVariableValues[str[0]]) + AnyAsVec2(otherExpression);
else if (str[1] == "-=")
globalVariableValues[str[0]] = AnyAsVec2(globalVariableValues[str[0]]) - AnyAsVec2(otherExpression);
else if (str[1] == "*=")
globalVariableValues[str[0]] = AnyAsVec2(globalVariableValues[str[0]]) * AnyAsFloat(otherExpression);
else if (str[1] == "/=")
globalVariableValues[str[0]] = AnyAsVec2(globalVariableValues[str[0]]) / AnyAsFloat(otherExpression);
else
LogWarning("unrecognized operator \'" + str[1] + "\'");
}
return 0;
}
LogWarning("uninitialized variable or typo in \'" + str[0] + "\'");
return 1;
}
boost::any ProcessLine(const vector<vector<string>>& words, int lineNum, unordered_map<string, boost::any>& variableValues)
{
if (words[lineNum][0][0] == '/' && words[lineNum][0][1] == '/')
return nullType;
// If print statement (deprecated, now use SLB.System.Print() function)
else if (words[lineNum][0] == "print")
{
cout << StringRaw(AnyAsString(EvalExpression(unWrapVec(vector<string>(words[lineNum].begin() + 1, words[lineNum].end())), variableValues))) << endl;
return nullType;
}
// Check if function return
else if (words[lineNum][0] == "return")
return EvalExpression(unWrapVec(vector<string>(words[lineNum].begin() + 1, words[lineNum].end())), variableValues);
// Check if it is SLB Builtin function
else if (words[lineNum][0][0] == 'S' && words[lineNum][0][1] == 'L' && words[lineNum][0][2] == 'B' && words[lineNum][0][3] == '.')
return EvalExpression(unWrapVec(words[lineNum]), variableValues);
// Check if it is function
else if (IsFunction(trim(split(words[lineNum][0], '(')[0])))
{
if (count(words[lineNum][0], '(') > 0 && count(words[lineNum][0], ')') > 0)
ExecuteFunction(trim(split(words[lineNum][0], '(')[0]), vector<boost::any>());
else
ExecuteFunction(trim(split(words[lineNum][0], '(')[0]), VarValues(split(RMParenthesis("(" + split(unWrapVec(rangeInVec(words[lineNum], 0, (int)words[lineNum].size() - 1)), '(')[1]), ','), variableValues));
return nullType;
}
// Check if global variable declaration
else if (trim(words[lineNum][0]) == "global")
{
globalVariableValues[words[lineNum][2]] = EvalExpression(unWrapVec(slice(words[lineNum], 4, -1)), variableValues);
return nullType;
}
// Iterate through all types to see if line inits or
// re-inits a variable then store it with it's value
else if (countInVector(types, trim(words[lineNum][0])) > 0)
{
variableValues[words[lineNum][1]] = EvalExpression(unWrapVec(slice(words[lineNum], 3, -1)), variableValues);
return nullType;
}
// Check existing variables: If matches, then it means
// the variables value is getting changed with an operator
else if (count(words[lineNum][0], '.') == 0 && (IsVar(words[lineNum][0], variableValues) || IsVar(words[lineNum][0], globalVariableValues)))
{
// Evaluates what the operator (ex. '=', '+=') does to the value on the left by the value on the right
varOperation(vector<string>(words[lineNum].begin(), words[lineNum].end()), variableValues);
return nullType;
}
// Check existing variables: To see if class sub component matches
else if (count(words[lineNum][0], '.') > 0 && IsVar(split(words[lineNum][0], '.')[0], variableValues) || IsVar(split(words[lineNum][0], '.')[0], globalVariableValues))
{
if (IsVar(split(words[lineNum][0], '.')[0], variableValues))
variableValues[split(words[lineNum][0], '.')[0]] = EditClassSubComponent(variableValues[split(words[lineNum][0], '.')[0]], words[lineNum][1], EvalExpression(unWrapVec(vector<string>(words[lineNum].begin() + 2, words[lineNum].end())), variableValues), split(words[lineNum][0], '.')[1]);
else if (IsVar(split(words[lineNum][0], '.')[0], globalVariableValues))
globalVariableValues[split(words[lineNum][0], '.')[0]] = EditClassSubComponent(globalVariableValues[split(words[lineNum][0], '.')[0]], words[lineNum][1], EvalExpression(unWrapVec(vector<string>(words[lineNum].begin() + 2, words[lineNum].end())), variableValues), split(words[lineNum][0], '.')[1]);
return nullType;
}
// Gathers while loop contents
else if (words[lineNum][0] == "while")
{
vector<vector<string>> whileContents;
vector<string> whileParameters;
for (int w = 1; w < (int)words[lineNum].size(); w++)
whileParameters.push_back(words[lineNum][w]);
int numOfBrackets = 1;
for (int p = lineNum + 2; p < (int)words.size(); p++)
{
numOfBrackets += countInVector(words[p], "{") - countInVector(words[p], "}");
if (numOfBrackets == 0)
break;
whileContents.push_back(words[p]);
}
whileContents = removeTabsWdArry(whileContents, 1);
while (BooleanLogic(whileParameters[0], whileParameters[1], whileParameters[2], variableValues))
{
//Iterate through all lines in while loop
for (int lineNum = 0; lineNum < (int)whileContents.size(); lineNum++)
{
boost::any returnVal = ProcessLine(whileContents, lineNum, variableValues);
if (!returnVal.empty())
return returnVal;
}
}
return nullType;
}
// Gathers if statement contents
else if (words[lineNum][0] == "if")
{
vector<vector<string>> ifContents;
vector<string> ifParameters;
for (int w = 1; w < (int)words[lineNum].size(); w++)
ifParameters.push_back(words[lineNum][w]);
int numOfBrackets = 1;
lineNum += 2;
while (lineNum < (int)words.size())
{
numOfBrackets += countInVector(words[lineNum], "{") - countInVector(words[lineNum], "}");
if (numOfBrackets == 0)
break;
ifContents.push_back(words[lineNum]);
lineNum++;
}
ifContents = removeTabsWdArry(ifContents, 1);
if (BooleanLogic(ifParameters[0], ifParameters[1], ifParameters[2], variableValues))
{
//Iterate through all lines in if statement
for (int l = 0; l < (int)ifContents.size(); l++)
{
boost::any returnVal = ProcessLine(ifContents, l, variableValues);
if (!returnVal.empty())
return returnVal;
}
}
//else if (words.size() > lineNum + 1)
// if (words[lineNum + 1][0] == "else")
// {
// lineNum += 1;
// vector<string> elseContents;
// int numOfBrackets = 1;
// while (lineNum < (int)words.size())
// {
// numOfBrackets += countInVector(words[lineNum], "{") - countInVector(words[lineNum], "}");
// if (numOfBrackets == 0)
// break;
// elseContents.push_back("");
// for (int w = 0; w < (int)words[lineNum].size(); w++)
// {
// elseContents[(int)elseContents.size() - 1] += words[lineNum][w] + " ";
// }
// lineNum++;
// }
// elseContents = removeTabs(elseContents, 2);
// vector<vector<string>> innerWords;
// for (int i = 0; i < (int)elseContents.size(); i++)
// innerWords.push_back(split(elseContents[i], ' '));
// //Iterate through all lines in else statement
// for (int lineNum = 0; lineNum < (int)elseContents.size(); lineNum++)
// {
// ProcessLine(innerWords, lineNum, variableValues);
// }
// return nullType;
// }
return nullType;
}
//// Gathers else statement contents
//if (words[lineNum][0] == "else")
//{
//
//}
return nullType;
}
boost::any ExecuteFunction(const string& functionName, const vector<boost::any>& inputVarVals)
{
// Get contents of function
vector<vector<string>> words = functionValues[functionName];
unordered_map<string, boost::any> variableValues = {};
vector<string> args = words[0];
for (int i = 0; i < (int)inputVarVals.size(); i++) {
variableValues[args[i]] = inputVarVals[i];
#if DEVELOPER_MESSAGES == true
cout << functionName + " \x1B[33m" << args[i] << " == " << AnyAsString(inputVarVals[i]) << "\033[0m\t\t" << endl;
#endif
}
//Iterate through all lines in function
for (int lineNum = 1; lineNum < (int)words.size(); lineNum++)
{
try
{
boost::any returnVal = ProcessLine(words, lineNum, variableValues);
if (!returnVal.empty())
return returnVal;
}
catch (const std::exception&)
{
LogCriticalError("\'" + unWrapVec(words[lineNum]) + "\'\n In function: " + functionName + "\n Line: " + to_string(lineNum));
}
}
return nullType;
}
int parseSlang(string script)
{
script = replace(script, " ", "\t");
vector<string> lines = split(script, '\n');
vector<vector<string>> words;
for (int i = 0; i < (int)lines.size(); i++)
words.push_back(split(lines[i], ' '));
// First go through entire script and iterate through all types to see if line is a variable
// or function declaration, then store it with it's value
for (int lineNum = 0; lineNum < (int)words.size(); lineNum++)
{
//Checks if it is function
if (words[lineNum][0] == "func")
{
vector<vector<string>> functionContents;
string functName = split(words[lineNum][1], '(')[0];
string args = "";
if (indexInStr(unWrapVec(words[lineNum]), ')') - indexInStr(unWrapVec(words[lineNum]), '(') > 1)
for (int w = 1; w < (int)words[lineNum].size(); w++) // Get all words from the instantiation line: these are the args
{
args += replace(replace(words[lineNum][w], "(", " "), ")", "");
}
args = trim(replace(args, functName + " ", ""));
functionContents.push_back(split(args, ','));
int numOfBrackets = 1;
for (int p = lineNum + 2; p < (int)words.size(); p++)
{
numOfBrackets += countInVector(words[p], "{") - countInVector(words[p], "}");
if (numOfBrackets == 0)
break;
functionContents.push_back(removeTabs(words[p], 1));
}
functionValues[functName] = functionContents;
//cout << functName << " is \n" << Vec2Str(functionContents) << endl << endl;
}
else
{
if (words[lineNum][0] == "string")
globalVariableValues[words[lineNum][1]] = StringRaw(words[lineNum][3]);
else if (words[lineNum][0] == "int")
globalVariableValues[words[lineNum][1]] = stoi(words[lineNum][3]);
else if (words[lineNum][0] == "float")
globalVariableValues[words[lineNum][1]] = stof(words[lineNum][3]);
else if (words[lineNum][0] == "bool")
globalVariableValues[words[lineNum][1]] = stob(words[lineNum][3]);
//else
// LogWarning("unrecognized type \'" + words[lineNum][0] + "\' on line: " + to_string(lineNum));
}
}
// Executes main, which is the starting function
ExecuteFunction("Main", vector<boost::any> {});
return 0;
}
int main(int argc, char* argv[])
{
// Gathers builtin functions and variables
GetBuiltins(SLBContents);
functionValues = builtinFunctionValues;
globalVariableValues = builtinVarVals;
stringstream scriptString;
#if EXAMPLE_PROJECT == false
// If scriptname is supplied and not in developer mode
if (argc > 1)
{
std::string scriptPath = argv[1];
#if DEVELOPER_MESSAGES == true
cout << scriptPath << endl;
#endif
std::string projectDirectory = scriptPath.substr(0, scriptPath.find_last_of("/\\"));
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
std::wstring wide = converter.from_bytes(projectDirectory);
#if defined(__unix__)
chdir(projectDirectory);
#elif defined(_MSC_VER)
LPCWSTR s = wide.c_str();
SetCurrentDirectory(s);
#endif
// Get script contents
ifstream script(scriptPath);
scriptString << script.rdbuf();
}
else
{
LogCriticalError("No script provided! Please drag and drop .SLG file over interpreter executable file, or provide it's path as a command-line argument.");
system("pause");
exit(1);
}
#else
// If in developer mode
std::string scriptPath = "./script.slg";
#if DEVELOPER_MESSAGES == true
cout << scriptPath << endl;
#endif
std::string projectDirectory = scriptPath.substr(0, scriptPath.find_last_of("/\\"));
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
std::wstring wide = converter.from_bytes(projectDirectory);
#if defined(__unix__)
chdir(projectDirectory);
#elif defined(_MSC_VER)
LPCWSTR s = wide.c_str();
SetCurrentDirectory(s);
#endif
// Get script contents
ifstream script(scriptPath);
scriptString << script.rdbuf();
#endif
system("pause");
parseSlang(scriptString.str());
return 0;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 802 B

View File

@ -1,141 +0,0 @@
#include<string>
using namespace std;
std::string SLBContents = R"(
// Default variables, can be overwritten
// if re-initialized or changed
float PI = 3.14159265358979323846264338
float EulersNumber = 2.71828183
// Trigonometric function Sin
func Sin(input)
{
float out = SLB.Math.Sin(input)
return out
}
// Trigonometric function Cos
func Cos(input)
{
float out = SLB.Math.Cos(input)
return out
}
// Trigonometric function Tan
func Tan(input)
{
float out = SLB.Math.Tan(input)
return out
}
// Sigmoid activation function
func Sigmoid(input)
{
float out = 1 / (1 + EulersNumber ^ -input)
return out
}
// Hyperbolic tangent activation function
func Tanh(input)
{
float out = ((EulersNumber ^ input) - (EulersNumber ^ -input)) / ((EulersNumber ^ input) + (EulersNumber ^ -input))
return out
}
// Rounds input to nearest integer value
func Round(input)
{
float out = SLB.Math.Round(input)
return out
}
// Linearly interpolates between a and b by t
func Lerp(a, b, t)
{
float out = SLB.Math.Lerp(a, b, t)
return out
}
// Get absolute value of x
func Abs(x)
{
float out = SLB.Math.Abs(x)
return out
}
// Convert radians to degrees
func RadToDeg(x)
{
float out = (x * PI) / 180
return out
}
// Convert degrees to radians
func DegToRad(x)
{
float out = (x * 180) / PI
return out
}
// Clamps input between min and max
func Clamp(input, min, max)
{
if input < min
{
return min
}
if input > max
{
return max
}
return input
}
// Sets color of pixel to RGB value
func SetPixel(x, y, r, g, b)
{
string out = SLB.Graphics.SetPixel(x, y, r, g, b)
return out
}
// Prints input value to console
func Print(in)
{
SLB.System.Print(in)
}
// Prints input value to console with appended newline '\n'
func Printl(in)
{
SLB.System.PrintLine(in)
}
// Creates new sprite class
func NSprite(path, x, y, r)
{
Sprite s = SLB.Graphics.Sprite(path, x, y, r)
return s
}
// Draws sprite to window
func Draw(spr)
{
SLB.Graphics.Draw(spr)
}
// Creates new Vector2 class
func NVec2(x, y)
{
Vec2 v = SLB.System.Vec2(x, y)
return v
}
// Gets if key is down
func GetKey(keyName)
{
bool b = SLB.Input.GetKey(keyName)
return b
}
)"
;

View File

@ -1,312 +0,0 @@
#ifndef BUILTIN_H
#define BUILTIN_H
#include <iostream>
#include <fstream>
#include <string>
#include <regex>
#include <limits>
#include <algorithm>
#include <unordered_map>
#include "strops.h"
#include "graphics.h"
#include "anyops.h"
#include <boost/any.hpp>
#include <SDL.h>
#include <ctime>
#define DEVELOPER_MESSAGES false
using namespace std;
using namespace boost;
vector<string> types = { "int", "float", "string", "bool", "void", "null", "Sprite", "Vec2", "Text" };
unordered_map<string, vector<vector<string>>> builtinFunctionValues;
unordered_map<string, boost::any> builtinVarVals;
class NullType {
public:
string type = "NULL";
};
boost::any nullType;
float clamp(float v, float min, float max)
{
if (v < min) return min;
if (v > max) return max;
return v;
}
float lerp(float a, float b, float f)
{
return a + f * (b - a);
}
int LogWarning(const string& warningText)
{
cerr << "\x1B[33mWARNING: " << warningText << "\033[0m\t\t" << endl;
return 1;
}
int InterpreterLog(const string& logText)
{
time_t timer = time(0);
tm bt{};
#if defined(__unix__)
localtime_r(&timer, &bt);
#elif defined(_MSC_VER)
localtime_s(&bt, &timer);
#else
static mutex mtx;
std::lock_guard<std::mutex> lock(mtx);
bt = *localtime(&timer);
#endif
int Hour = bt.tm_hour;
int Min = bt.tm_min;
int Sec = bt.tm_sec;
cout << "\x1B[34m[" + to_string(Hour) + ":" + to_string(Min) + ":" + to_string(Sec) + "] \x1B[33mSlang: \x1B[32m" << logText << "\033[0m\t\t" << endl;
return 1;
}
int LogCriticalError(const string& errorText)
{
time_t timer = time(0);
tm bt{};
#if defined(__unix__)
localtime_r(&timer, &bt);
#elif defined(_MSC_VER)
localtime_s(&bt, &timer);
#else
static mutex mtx;
std::lock_guard<std::mutex> lock(mtx);
bt = *localtime(&timer);
#endif
int Hour = bt.tm_hour;
int Min = bt.tm_min;
int Sec = bt.tm_sec;
cerr << "\x1B[34m[" + to_string(Hour) + ":" + to_string(Min) + ":" + to_string(Sec) + "] \x1B[33mSlang: \x1B[31mERROR: " << errorText << "\033[0m\t\t" << endl;
exit(EXIT_FAILURE);
return 2;
}
boost::any GetClassSubComponent(boost::any value, string subComponentName)
{
// If a Sprite Class
if (any_type(value) == 4)
{
return any_cast<Sprite>(value).SubComponent(subComponentName);
}
// If a Vec2 Class
if (any_type(value) == 5)
{
return any_cast<Vec2>(value).SubComponent(subComponentName);
}
// If a Text Class
if (any_type(value) == 6)
{
return any_cast<Text>(value).SubComponent(subComponentName);
}
return nullType;
}
boost::any EditClassSubComponent(boost::any value, string oper, boost::any otherVal, string subComponentName)
{
// If a Sprite Class
if (any_type(value) == 4)
{
Sprite v = any_cast<Sprite>(value);
v.EditSubComponent(subComponentName, oper, otherVal);
return v;
}
// If a Vec2 Class
if (any_type(value) == 5)
{
Vec2 v = any_cast<Vec2>(value);
v.EditSubComponent(subComponentName, oper, otherVal);
return v;
}
// If a Text Class
if (any_type(value) == 6)
{
Text t = any_cast<Text>(value);
t.EditSubComponent(subComponentName, oper, otherVal);
return t;
}
return nullType;
}
bool AxisAlignedCollision(const Sprite& a, const Sprite& b) // AABB - AABB collision
{
// collision x-axis?
bool collisionX = a.position.x + a.scale.x / 2 >= b.position.x - b.scale.x / 2 &&
b.position.x + b.scale.x / 2 >= a.position.x - a.scale.x;
// collision y-axis?
bool collisionY = a.position.y + a.scale.y / 2 >= b.position.y - b.scale.y / 2 &&
b.position.y + b.scale.y / 2 >= a.position.y - a.scale.y / 2;
//// collision x-axis?
//bool collisionX = a.position.x - a.scale.x / 2 >= b.position.x + b.scale.x / 2 ||
// a.position.x + a.scale.x / 2 <= b.position.x - b.scale.x / 2;
//// collision y-axis?
//bool collisionY = a.position.y - a.scale.y / 2 >= b.position.y + b.scale.y / 2 ||
// a.position.y + a.scale.y / 2 <= b.position.y - b.scale.y / 2;
// collision only if on both axes
return collisionX && collisionY;
}
// Initial script processing, which loads variables and functions from builtin
int GetBuiltins(std::string s)
{
std::string script = replace(s, " ", "\t");
vector<string> lines = split(script, '\n');
vector<vector<string>> words;
for (int i = 0; i < (int)lines.size(); i++)
{
words.push_back(split(lines[i], ' '));
}
// Go through entire script and iterate through all types to see if line is a
// function declaration, then store it with it's value
for (int lineNum = 0; lineNum < (int)words.size(); lineNum++)
{
//Checks if it is function
if (words[lineNum][0] == "func")
{
vector<vector<string>> functionContents;
string functName = split(words[lineNum][1], '(')[0];
#if DEVELOPER_MESSAGES == true
InterpreterLog("Load builtin function " + functName);
#endif
string args = "";
for (int w = 1; w < (int)words[lineNum].size(); w++) // Get all words from the instantiation line: these are the args
{
args += replace(replace(words[lineNum][w], "(", " "), ")", "");
}
args = replace(args, functName + " ", "");
functionContents.push_back(split(args, ','));
int numOfBrackets = 1;
for (int p = lineNum + 2; p < (int)words.size(); p++)
{
numOfBrackets += countInVector(words[p], "{") - countInVector(words[p], "}");
if (numOfBrackets == 0)
break;
functionContents.push_back(removeTabs(words[p], 1));
}
builtinFunctionValues[functName] = functionContents;
//cout << functName << " is \n" << Vec2Str(functionContents) << endl << endl;
}
else
{
if (words[lineNum][0] == "string")
{
builtinVarVals[words[lineNum][1]] = StringRaw(words[lineNum][3]);
#if DEVELOPER_MESSAGES == true
InterpreterLog("Load builtin variable " + words[lineNum][1]);
#endif
}
else if (words[lineNum][0] == "int")
{
builtinVarVals[words[lineNum][1]] = stoi(words[lineNum][3]);
#if DEVELOPER_MESSAGES == true
InterpreterLog("Load builtin variable " + words[lineNum][1]);
#endif
}
else if (words[lineNum][0] == "float")
{
builtinVarVals[words[lineNum][1]] = stof(words[lineNum][3]);
#if DEVELOPER_MESSAGES == true
InterpreterLog("Load builtin variable " + words[lineNum][1]);
#endif
}
else if (words[lineNum][0] == "bool")
{
builtinVarVals[words[lineNum][1]] = stob(words[lineNum][3]);
#if DEVELOPER_MESSAGES == true
InterpreterLog("Load builtin variable " + words[lineNum][1]);
#endif
}
//else
// LogWarning("unrecognized type \'" + words[lineNum][0] + "\' on line: " + to_string(lineNum));
}
}
return 0;
}
// Executes
boost::any SLBFunction(const string& name, const vector<boost::any>& args)
{
if (name == "SLB.Math.Sin")
return sin(AnyAsFloat(args[0]));
else if (name == "SLB.Math.Cos")
return cos(AnyAsFloat(args[0]));
else if (name == "SLB.Math.Tan")
return tan(AnyAsFloat(args[0]));
else if (name == "SLB.Math.Round")
return AnyAsInt(args[0]);
else if (name == "SLB.Math.Lerp")
return lerp(AnyAsFloat(args[0]), AnyAsFloat(args[1]), AnyAsFloat(args[2]));
else if (name == "SLB.Math.Abs")
return abs(AnyAsFloat(args[0]));
else if (name == "SLB.Graphics.Init")
{
#if DEVELOPER_MESSAGES == true
InterpreterLog("Init graphics");
#endif
initGraphics(StringRaw(AnyAsString(args[0])), AnyAsInt(args[1]), AnyAsInt(args[2]));
}
else if (name == "SLB.Graphics.Sprite")
{
Sprite s(StringRaw(AnyAsString(args[0])), any_cast<Vec2>(args[1]), any_cast<Vec2>(args[2]), AnyAsFloat(args[3]));
return s;
}
else if (name == "SLB.Graphics.Draw")
any_cast<Sprite>(args[0]).Draw();
else if (name == "SLB.Graphics.Load")
any_cast<Sprite>(args[0]).Load();
else if (name == "SLB.Graphics.Text")
{
Text t(StringRaw(AnyAsString(args[0])), StringRaw(AnyAsString(args[1])), any_cast<Vec2>(args[2]), AnyAsFloat(args[3]), AnyAsFloat(args[4]), AnyAsFloat(args[5]), AnyAsFloat(args[6]), AnyAsFloat(args[7]));
return t;
}
else if (name == "SLB.Graphics.DrawText")
any_cast<Text>(args[0]).Draw();
else if (name == "SLB.Graphics.LoadText")
any_cast<Text>(args[0]).Load();
else if (name == "SLB.Physics.AxisAlignedCollision")
{
return AxisAlignedCollision(any_cast<Sprite>(args[0]), any_cast<Sprite>(args[1]));
}
else if (name == "SLB.Input.GetKey")
return KEYS[StringRaw(any_cast<string>(args[0]))] == 1;
else if (name == "SLB.System.Print")
cout << StringRaw(AnyAsString(args[0]));
else if (name == "SLB.System.PrintLine")
cout << StringRaw(AnyAsString(args[0])) << endl;
else if (name == "SLB.System.Vec2")
{
Vec2 v(AnyAsFloat(args[0]), AnyAsFloat(args[1]));
return v;
}
else
LogWarning("SLB function \'" + name + "\' does not exist.");
return nullType;
}
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 800 KiB

View File

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31612.314
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Slang", "Slang\Slang.vcxproj", "{D5F150F8-1F83-41EB-A195-1B5C3CA9322A}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZSharp", "ZSharp\ZSharp.vcxproj", "{D5F150F8-1F83-41EB-A195-1B5C3CA9322A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -0,0 +1,100 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# FindSDL2_image
# -------------
#
# Locate SDL2_image library
#
# This module defines:
#
# ::
#
# SDL2_IMAGE_LIBRARIES, the name of the library to link against
# SDL2_IMAGE_INCLUDE_DIRS, where to find the headers
# SDL2_IMAGE_FOUND, if false, do not try to link against
# SDL2_IMAGE_VERSION_STRING - human-readable string containing the
# version of SDL2_image
#
#
#
# For backward compatibility the following variables are also set:
#
# ::
#
# SDL2IMAGE_LIBRARY (same value as SDL2_IMAGE_LIBRARIES)
# SDL2IMAGE_INCLUDE_DIR (same value as SDL2_IMAGE_INCLUDE_DIRS)
# SDL2IMAGE_FOUND (same value as SDL2_IMAGE_FOUND)
#
#
#
# $SDLDIR is an environment variable that would correspond to the
# ./configure --prefix=$SDLDIR used in building SDL.
#
# Created by Eric Wing. This was influenced by the FindSDL.cmake
# module, but with modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).
if(NOT SDL2_IMAGE_INCLUDE_DIR AND SDL2IMAGE_INCLUDE_DIR)
set(SDL2_IMAGE_INCLUDE_DIR ${SDL2IMAGE_INCLUDE_DIR} CACHE PATH "directory cache entry initialized from old variable name")
endif()
find_path(SDL2_IMAGE_INCLUDE_DIR SDL_image.h
HINTS
ENV SDL2IMAGEDIR
ENV SDL2DIR
${SDL2_DIR}
PATH_SUFFIXES SDL2
# path suffixes to search inside ENV{SDL2DIR}
include/SDL2 include
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(VC_LIB_PATH_SUFFIX lib/x64)
else()
set(VC_LIB_PATH_SUFFIX lib/x86)
endif()
if(NOT SDL2_IMAGE_LIBRARY AND SDL2IMAGE_LIBRARY)
set(SDL2_IMAGE_LIBRARY ${SDL2IMAGE_LIBRARY} CACHE FILEPATH "file cache entry initialized from old variable name")
endif()
find_library(SDL2_IMAGE_LIBRARY
NAMES SDL2_image
HINTS
ENV SDL2IMAGEDIR
ENV SDL2DIR
${SDL2_DIR}
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)
if(SDL2_IMAGE_INCLUDE_DIR AND EXISTS "${SDL2_IMAGE_INCLUDE_DIR}/SDL2_image.h")
file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL2_image.h" SDL2_IMAGE_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL2_IMAGE_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL2_image.h" SDL2_IMAGE_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL2_IMAGE_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL2_image.h" SDL2_IMAGE_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL2_IMAGE_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL2_IMAGE_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MAJOR "${SDL2_IMAGE_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_IMAGE_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MINOR "${SDL2_IMAGE_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_IMAGE_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_PATCH "${SDL2_IMAGE_VERSION_PATCH_LINE}")
set(SDL2_IMAGE_VERSION_STRING ${SDL2_IMAGE_VERSION_MAJOR}.${SDL2_IMAGE_VERSION_MINOR}.${SDL2_IMAGE_VERSION_PATCH})
unset(SDL2_IMAGE_VERSION_MAJOR_LINE)
unset(SDL2_IMAGE_VERSION_MINOR_LINE)
unset(SDL2_IMAGE_VERSION_PATCH_LINE)
unset(SDL2_IMAGE_VERSION_MAJOR)
unset(SDL2_IMAGE_VERSION_MINOR)
unset(SDL2_IMAGE_VERSION_PATCH)
endif()
set(SDL2_IMAGE_LIBRARIES ${SDL2_IMAGE_LIBRARY})
set(SDL2_IMAGE_INCLUDE_DIRS ${SDL2_IMAGE_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_image
REQUIRED_VARS SDL2_IMAGE_LIBRARIES SDL2_IMAGE_INCLUDE_DIRS
VERSION_VAR SDL2_IMAGE_VERSION_STRING)
# for backward compatibility
set(SDL2IMAGE_LIBRARY ${SDL2_IMAGE_LIBRARIES})
set(SDL2IMAGE_INCLUDE_DIR ${SDL2_IMAGE_INCLUDE_DIRS})
set(SDL2IMAGE_FOUND ${SDL2_IMAGE_FOUND})
mark_as_advanced(SDL2_IMAGE_LIBRARY SDL2_IMAGE_INCLUDE_DIR)

View File

@ -0,0 +1,100 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# FindSDL2_ttf
# -------------
#
# Locate SDL2_ttf library
#
# This module defines:
#
# ::
#
# SDL2_TTF_LIBRARIES, the name of the library to link against
# SDL2_TTF_INCLUDE_DIRS, where to find the headers
# SDL2_TTF_FOUND, if false, do not try to link against
# SDL2_TTF_VERSION_STRING - human-readable string containing the
# version of SDL2_ttf
#
#
#
# For backward compatibility the following variables are also set:
#
# ::
#
# SDL2TTF_LIBRARY (same value as SDL2_TTF_LIBRARIES)
# SDL2TTF_INCLUDE_DIR (same value as SDL2_TTF_INCLUDE_DIRS)
# SDL2TTF_FOUND (same value as SDL2_TTF_FOUND)
#
#
#
# $SDLDIR is an environment variable that would correspond to the
# ./configure --prefix=$SDLDIR used in building SDL.
#
# Created by Eric Wing. This was influenced by the FindSDL.cmake
# module, but with modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).
if(NOT SDL2_TTF_INCLUDE_DIR AND SDL2TTF_TTF_DIR)
set(SDL2_TTF_INCLUDE_DIR ${SDL2TTF_INCLUDE_DIR} CACHE PATH "directory cache entry initialized from old variable name")
endif()
find_path(SDL2_TTF_INCLUDE_DIR SDL_ttf.h
HINTS
ENV SDL2TTFDIR
ENV SDL2DIR
${SDL2_DIR}
PATH_SUFFIXES SDL2
# path suffixes to search inside ENV{SDL2DIR}
include/SDL2 include
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(VC_LIB_PATH_SUFFIX lib/x64)
else()
set(VC_LIB_PATH_SUFFIX lib/x86)
endif()
if(NOT SDL2_TTF_LIBRARY AND SDL2TTF_LIBRARY)
set(SDL2_TTF_LIBRARY ${SDL2TTF_LIBRARY} CACHE FILEPATH "file cache entry initialized from old variable name")
endif()
find_library(SDL2_TTF_LIBRARY
NAMES SDL2_ttf
HINTS
ENV SDL2TTFDIR
ENV SDL2DIR
${SDL2_DIR}
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)
if(SDL2_TTF_INCLUDE_DIR AND EXISTS "${SDL2_TTF_INCLUDE_DIR}/SDL2_ttf.h")
file(STRINGS "${SDL2_TTF_INCLUDE_DIR}/SDL2_ttf.h" SDL2_TTF_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL2_TTF_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_TTF_INCLUDE_DIR}/SDL2_ttf.h" SDL2_TTF_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL2_TTF_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_TTF_INCLUDE_DIR}/SDL2_ttf.h" SDL2_TTF_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL2_TTF_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL2_TTF_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_TTF_VERSION_MAJOR "${SDL2_TTF_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_TTF_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_TTF_VERSION_MINOR "${SDL2_TTF_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_TTF_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_TTF_VERSION_PATCH "${SDL2_TTF_VERSION_PATCH_LINE}")
set(SDL2_TTF_VERSION_STRING ${SDL2_TTF_VERSION_MAJOR}.${SDL2_TTF_VERSION_MINOR}.${SDL2_TTF_VERSION_PATCH})
unset(SDL2_TTF_VERSION_MAJOR_LINE)
unset(SDL2_TTF_VERSION_MINOR_LINE)
unset(SDL2_TTF_VERSION_PATCH_LINE)
unset(SDL2_TTF_VERSION_MAJOR)
unset(SDL2_TTF_VERSION_MINOR)
unset(SDL2_TTF_VERSION_PATCH)
endif()
set(SDL2_TTF_LIBRARIES ${SDL2_TTF_LIBRARY})
set(SDL2_TTF_INCLUDE_DIRS ${SDL2_TTF_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_ttf
REQUIRED_VARS SDL2_TTF_LIBRARIES SDL2_TTF_INCLUDE_DIRS
VERSION_VAR SDL2_TTF_VERSION_STRING)
# for backward compatibility
set(SDL2TTF_LIBRARY ${SDL2_TTF_LIBRARIES})
set(SDL2TTF_INCLUDE_DIR ${SDL2_TTF_INCLUDE_DIRS})
set(SDL2TTF_FOUND ${SDL2_TTF_FOUND})
mark_as_advanced(SDL2_TTF_LIBRARY SDL2_TTF_INCLUDE_DIR)

34
ZSharp/CMakeLists.txt Normal file
View File

@ -0,0 +1,34 @@
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project(ZSharp)
SET(programName Slang)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeFiles/")
add_executable (ZSharp Main.cpp main.h anyops.h builtin.h strops.cpp strops.h eval.cpp eval.h graphics.h ZS.h color.hpp)
find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_ttf REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIRS} ${SDL2_TTF_INCLUDE_DIRS})
# include_directories("D:/Code/SDL2_ttf-2.0.15/include")
# include_directories("D:/Code/SDL2-2.0.18/include")
# include_directories("D:/Code/SDL2_image-2.0.5/include")
# include_directories("D:/Code/boost")
# link_directories("D:/Code/SDL2_ttf-2.0.15/lib/x64")
# link_directories("D:/Code/SDL2-2.0.18/lib/x64")
# link_directories("D:/Code/SDL2_image-2.0.5/lib/x64")
# link_directories("D:/Code/boost")
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
FIND_PACKAGE(Boost REQUIRED COMPONENTS system)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(ZSharp m ${Boost_LIBRARIES} ${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES} ${SDL2_TTF_LIBRARIES})

59
ZSharp/CMakeSettings.json Normal file
View File

@ -0,0 +1,59 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ]
},
{
"name": "Linux-GCC-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"cmakeExecutable": "cmake",
"remoteCopySourcesExclusionList": [ ".vs", ".git", "out" ],
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "linux_x64" ],
"remoteMachineName": "${defaultRemoteMachineName}",
"remoteCMakeListsRoot": "$HOME/.vs/${projectDirName}/${workspaceHash}/src",
"remoteBuildRoot": "$HOME/.vs/${projectDirName}/${workspaceHash}/out/build/${name}",
"remoteInstallRoot": "$HOME/.vs/${projectDirName}/${workspaceHash}/out/install/${name}",
"remoteCopySources": true,
"rsyncCommandArgs": "-t --delete",
"remoteCopyBuildOutput": false,
"remoteCopySourcesMethod": "rsync"
},
{
"name": "WSL-GCC-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeExecutable": "cmake",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "linux_x64" ],
"wslPath": "${defaultWSLPath}",
"variables": []
}
]
}

987
ZSharp/Main.cpp Normal file
View File

@ -0,0 +1,987 @@

#include <iostream>
#include <fstream>
#include <string>
//bool DEVELOPER_MESSAGES = true;
#define DEVELOPER_MESSAGES false
#define EXAMPLE_PROJECT false
#define NAMEVERSION "ZSharp v2.1.3-alpha"
#if defined(__unix__)
#define UNIX true
#define WINDOWS false
#elif defined(_MSC_VER)
#define UNIX false
#define WINDOWS true
#endif
#include <regex>
#include <limits>
#include <algorithm>
#include <cstdlib>
#include <sstream>
#include <boost/any.hpp>
#include <unordered_map>
#include <stdio.h>
#include <codecvt>
#include <thread>
#if UNIX
#include <unistd.h>
#include <filesystem>
#elif WINDOWS
#include <windows.h>
#endif
#include "eval.h"
#include "strops.h"
#include "builtin.h"
#include "main.h"
#include "anyops.h"
#include "ZS.h"
using namespace std;
using namespace boost;
unordered_map<string, boost::any> globalVariableValues;
unordered_map<string, vector<vector<string>>> functionValues;
boost::any GetVariableValue(const string& varName, const unordered_map<string, boost::any>& variableValues)
{
string classSubComponent;
string baseName = trim(varName);
if (count(varName, '.') > 0)
{
classSubComponent = trim(varName.substr(indexInStr(varName, '.') + 1, -1));
baseName = trim(split(varName, '.')[0]);
}
boost::any outputValue = nullType;
auto iA = variableValues.find(baseName);
auto iB = globalVariableValues.find(baseName);
if (iA != variableValues.end())
outputValue = iA->second;
else if (iB != globalVariableValues.end())
outputValue = iB->second;
else
outputValue = varName;
if (count(varName, '.') > 0 && !outputValue.empty())
return GetClassSubComponent(outputValue, classSubComponent);
else
return outputValue;
}
// Check if there is a variable with the specified name
bool IsVar(const string& varName, const unordered_map<string, boost::any>& variableValues)
{
if (split(varName, '.')[0] == "ZS")
return false;
if (variableValues.find(split(varName, '.')[0]) != variableValues.end())
return true;
return false;
}
// Return a vector of values that correspond to a vector of input variable names
vector<boost::any> VarValues(const vector<string>& varNames, unordered_map<string, boost::any>& variableValues)
{
vector<boost::any> realValues;
for (int varIndex = 0; varIndex < varNames.size(); varIndex++)
{
string varName = trim(varNames.at(varIndex));
//realValues.push_back(EvalExpression(varName, variableValues));
auto iA = variableValues.find(varName);
if (iA != variableValues.end())
{
realValues.push_back(iA->second);
}
else
{
auto iB = globalVariableValues.find(varName);
if (iB != globalVariableValues.end())
realValues.push_back(iB->second);
else
realValues.push_back(EvalExpression(varName, variableValues));
}
}
return realValues;
}
void printVarValues(const vector<string>& vec, unordered_map<string, boost::any>& variableValues)
{
cout << "<";
for (int i = 0; i < vec.size(); i++)
{
cout << AnyAsString(GetVariableValue(vec.at(i), globalVariableValues));
cout << AnyAsString(GetVariableValue(vec.at(i), variableValues));
cout << " | ";
}
cout << ">";
cout << endl;
}
bool IsFunction(const string& funcName)
{
if (functionValues.find(funcName) != functionValues.end())
return true;
else
return false;
}
bool IsZSFunction(const string& funcName)
{
return startsWith(funcName, "ZS.");
}
boost::any EvalExpression(const string& ex, unordered_map<string, boost::any>& variableValues)
{
string expression = trim(ex);
bool inQuotes = false;
#if DEVELOPER_MESSAGES == true
//InterpreterLog(" old expression: |" + expression + "|");
#endif
bool isFunc = IsFunction(split(expression, '(')[0]);
bool isZS = split(expression, '.')[0] == "ZS";
// If no operations are applied, then return self
if ((countOutsideParenthesis(expression, '+') == 0 && countOutsideParenthesis(expression, '-') == 0 && countOutsideParenthesis(expression, '*') == 0 && countOutsideParenthesis(expression, '/') == 0 && countOutsideParenthesis(expression, '^') == 0) || split(expression, '.')[0] == "ZS")
{
//bool isFunc = IsFunction(split(expression, '(')[0]);
if (isFunc && !inQuotes)
{
// start -> FuncCall(0, x, OtherFunc(a))
// changeto -> 0, x, OtherFunc(a)
string insideFunArgs = betweenChars(expression, '(', ')');
vector<string> argList = splitNoOverlap(insideFunArgs, ',', '(', ')');
#if DEVELOPER_MESSAGES == true
cout << split(expression, '(')[0] << " [" << unWrapVec(argList) << "]" << endl;
printVarValues(argList, variableValues);
#endif
vector<boost::any> funcArgs = VarValues(argList, variableValues);
return ExecuteFunction(split(expression, '(')[0], funcArgs);
}
else if (isZS && !inQuotes)
{
// start -> FuncCall(0, x, OtherFunc(a))
// changeto -> 0, x, OtherFunc(a)
string insideFunArgs = betweenChars(expression, '(', ')');
vector<string> argList = splitNoOverlap(insideFunArgs, ',', '(', ')');
#if DEVELOPER_MESSAGES == true
cout << split(expression, '(')[0] << " [" << unWrapVec(argList) << "]" << endl;
printVarValues(argList, variableValues);
#endif
vector<boost::any> funcArgs = VarValues(argList, variableValues);
return ZSFunction(split(expression, '(')[0], funcArgs);
}
else
return GetVariableValue(expression, variableValues);
}
string newExpression = "";
inQuotes = false;
for (int i = 0; i < expression.size(); i++)
{
if (expression[i] == '\"' && !isEscaped(newExpression, i))
inQuotes = !inQuotes;
if (isalpha(expression[i]) || expression[i] == '_')
{
string name = "";
while (i < expression.size() && (isalpha(expression[i]) || expression[i] == '.' || expression[i] == '_'))
{
name += expression[i];
i++;
}
//string varVal = GetVariableValue(name, variables, variableValues);
bool isFunc = IsFunction(name);
if (isFunc && !inQuotes)
{
// start -> FuncCall(0, x, OtherFunc(a))
// changeto -> 0, x, OtherFunc(a)
string insideFunArgs = betweenChars(expression, '(', ')');
vector<string> argList = splitNoOverlap(insideFunArgs, ',', '(', ')');
#if DEVELOPER_MESSAGES == true
cout << "[" << unWrapVec(argList) << "]" << endl;
printVarValues(argList, variableValues);
#endif
vector<boost::any> funcArgs = VarValues(argList, variableValues);
string returnVal = AnyAsString(ExecuteFunction(split(expression, '(')[0], funcArgs));
newExpression += returnVal;
}
else if (split(name, '.')[0] == "ZS" && !inQuotes)
{
// start -> FuncCall(0, x, OtherFunc(a))
// changeto -> 0, x, OtherFunc(a)
string insideFunArgs = betweenChars(expression, '(', ')');
vector<string> argList = splitNoOverlap(insideFunArgs, ',', '(', ')');
#if DEVELOPER_MESSAGES == true
cout << "[" << unWrapVec(argList) << "]" << endl;
printVarValues(argList, variableValues);
#endif
vector<boost::any> funcArgs = VarValues(argList, variableValues);
string returnVal = AnyAsString(ZSFunction(split(expression, '(')[0], funcArgs));
newExpression += returnVal;
}
else
{
if (inQuotes)
newExpression += name;
else
newExpression += AnyAsString(GetVariableValue(name, variableValues));
}
i--;
}
else
{
newExpression += expression[i];
}
}
#if DEVELOPER_MESSAGES == true
//InterpreterLog(" new expression: |" + newExpression + "|");
#endif
bool addStrings = false;
for (int i = 0; i < (int)newExpression.size(); i++)
if (isalpha(newExpression[i]) || (newExpression[i] == '\"' && !isEscaped(newExpression, i)))
{
addStrings = true;
break;
}
if (addStrings)
{
inQuotes = false;
string withoutParenthesis = "";
for (int i = 0; i < (int)newExpression.size(); i++)
{
if (newExpression[i] == '\"' && !isEscaped(newExpression, i))
{
inQuotes = !inQuotes;
continue;
}
if (inQuotes)
withoutParenthesis += newExpression[i];
if (!inQuotes && newExpression[i] != '(' && newExpression[i] != ')' && newExpression[i] != '+' && newExpression[i] != ' ')
withoutParenthesis += newExpression[i];
}
//cout << "NewSTRING = " << Quoted(withoutParenthesis) << endl;
return withoutParenthesis;
}
else
return evaluate(newExpression);
}
bool BooleanLogic(const string& valA, const string& comparer, const string& valB, unordered_map<string, boost::any>& variableValues)
{
boost::any valARealValue;
boost::any valBRealValue;
if (valA != "")
valARealValue = EvalExpression(valA, variableValues);
if (valB != "")
valBRealValue = EvalExpression(valB, variableValues);
#if DEVELOPER_MESSAGES == true
InterpreterLog(AnyAsString(valARealValue) + " " + comparer + " " + AnyAsString(valBRealValue) + " : " + AnyAsString(valA) + " " + comparer + " " + AnyAsString(valB) + " : " + to_string(AnyAsString(valARealValue) == AnyAsString(valBRealValue)));
#endif
if (comparer == "==")
return any_compare(valARealValue, valBRealValue);
else if (comparer == "!=")
return !any_compare(valARealValue, valBRealValue);
else if (comparer == ">=")
return AnyAsFloat(valARealValue) >= AnyAsFloat(valBRealValue);
else if (comparer == "<=")
return AnyAsFloat(valARealValue) <= AnyAsFloat(valBRealValue);
else if (comparer == ">")
return AnyAsFloat(valARealValue) > AnyAsFloat(valBRealValue);
else if (comparer == "<")
return AnyAsFloat(valARealValue) < AnyAsFloat(valBRealValue);
else if (comparer == "")
return AnyAsBool(valARealValue) == true;
else
LogWarning("unrecognized comparer \'" + comparer + "\'");
return false;
}
int varOperation(const vector<string>& str, unordered_map<string, boost::any>& variableValues)
{
if (IsVar(str.at(0), variableValues))
{
// Checks if type is simple, like int or string
if (any_type(variableValues[str.at(0)]) <= 3)
{
if (str.at(1) == "=")
variableValues[str.at(0)] = EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues);
else if (str.at(1) == "+=")
variableValues[str.at(0)] = EvalExpression(str.at(0) + "+(" + unWrapVec(vector<string>(str.begin() + 2, str.end())) + ")", variableValues);
else if (str.at(1) == "-=")
variableValues[str.at(0)] = AnyAsFloat(variableValues[str.at(0)]) - AnyAsFloat(EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues));
else if (str.at(1) == "*=")
variableValues[str.at(0)] = AnyAsFloat(variableValues[str.at(0)]) * AnyAsFloat(EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues));
else if (str.at(1) == "/=")
variableValues[str.at(0)] = AnyAsFloat(variableValues[str.at(0)]) / AnyAsFloat(EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues));
else
LogWarning("unrecognized operator \'" + str.at(1) + "\'");
}
// Else it is a Vec2. No other complex class can be operated on it's base form (ex. you can't do: Sprite += Sprite)
else if (any_type(variableValues[str.at(0)]) == 5)
{
boost::any otherExpression = EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues);
if (str.at(1) == "=")
variableValues[str.at(0)] = otherExpression;
else if (str.at(1) == "+=")
variableValues[str.at(0)] = AnyAsVec2(variableValues[str.at(0)]) + AnyAsVec2(otherExpression);
else if (str.at(1) == "-=")
variableValues[str.at(0)] = AnyAsVec2(variableValues[str.at(0)]) - AnyAsVec2(otherExpression);
else if (str.at(1) == "*=")
variableValues[str.at(0)] = AnyAsVec2(variableValues[str.at(0)]) * AnyAsFloat(otherExpression);
else if (str.at(1) == "/=")
variableValues[str.at(0)] = AnyAsVec2(variableValues[str.at(0)]) / AnyAsFloat(otherExpression);
else
LogWarning("unrecognized operator \'" + str.at(1) + "\'");
}
return 0;
}
else if (IsVar(str.at(0), globalVariableValues))
{
// Checks if type is simple, like int or string
if (any_type(globalVariableValues[str.at(0)]) <= 3)
{
if (str.at(1) == "=")
globalVariableValues[str.at(0)] = EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues);
else if (str.at(1) == "+=")
globalVariableValues[str.at(0)] = EvalExpression(str.at(0) + "+(" + unWrapVec(vector<string>(str.begin() + 2, str.end())) + ")", variableValues);
else if (str.at(1) == "-=")
globalVariableValues[str.at(0)] = AnyAsFloat(globalVariableValues[str.at(0)]) - AnyAsFloat(EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues));
else if (str.at(1) == "*=")
globalVariableValues[str.at(0)] = AnyAsFloat(globalVariableValues[str.at(0)]) * AnyAsFloat(EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues));
else if (str.at(1) == "/=")
globalVariableValues[str.at(0)] = AnyAsFloat(globalVariableValues[str.at(0)]) / AnyAsFloat(EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues));
else
LogWarning("unrecognized operator \'" + str.at(1) + "\'");
}
// Else it is a Vec2. No other complex class can be operated on it's base form (ex. you can't do: Sprite += Sprite)
else if (any_type(globalVariableValues[str.at(0)]) == 5)
{
boost::any otherExpression = EvalExpression(unWrapVec(vector<string>(str.begin() + 2, str.end())), variableValues);
if (str.at(1) == "=")
globalVariableValues[str.at(0)] = otherExpression;
else if (str.at(1) == "+=")
globalVariableValues[str.at(0)] = AnyAsVec2(globalVariableValues[str.at(0)]) + AnyAsVec2(otherExpression);
else if (str.at(1) == "-=")
globalVariableValues[str.at(0)] = AnyAsVec2(globalVariableValues[str.at(0)]) - AnyAsVec2(otherExpression);
else if (str.at(1) == "*=")
globalVariableValues[str.at(0)] = AnyAsVec2(globalVariableValues[str.at(0)]) * AnyAsFloat(otherExpression);
else if (str.at(1) == "/=")
globalVariableValues[str.at(0)] = AnyAsVec2(globalVariableValues[str.at(0)]) / AnyAsFloat(otherExpression);
else
LogWarning("unrecognized operator \'" + str.at(1) + "\'");
}
return 0;
}
LogWarning("uninitialized variable or typo in \'" + str.at(0) + "\'");
return 1;
}
boost::any ProcessLine(const vector<vector<string>>& words, int& lineNum, unordered_map<string, boost::any>& variableValues)
{
//// Check if the first two chars are '//', which would make it a comment
//if (startsWith(words.at(lineNum).at(0), "//"))
// return nullType;
// If print statement (deprecated, now use ZS.System.Print() function)
if (words.at(lineNum).at(0) == "print")
{
cout << StringRaw(AnyAsString(EvalExpression(unWrapVec(vector<string>(words.at(lineNum).begin() + 1, words.at(lineNum).end())), variableValues))) << endl;
return nullType;
}
// Check if it is a function return
else if (words.at(lineNum).at(0) == "return")
return EvalExpression(unWrapVec(vector<string>(words.at(lineNum).begin() + 1, words.at(lineNum).end())), variableValues);
// Check if it is ZS Builtin function call
else if (startsWith(words.at(lineNum).at(0), "ZS."))
return EvalExpression(unWrapVec(words.at(lineNum)), variableValues);
// Check if it is function call
else if (IsFunction(split(words.at(lineNum).at(0), '(')[0]))
{
// start -> FuncCall(0, x, OtherFunc(a))
// changeto -> 0, x, OtherFunc(a)
string insideFunArgs = betweenChars(unWrapVec(words.at(lineNum)), '(', ')');
vector<string> argList = splitNoOverlap(insideFunArgs, ',', '(', ')');
#if DEVELOPER_MESSAGES == true
cout << unWrapVec(argList) << endl;
printVarValues(argList, variableValues);
#endif
vector<boost::any> funcArgs = VarValues(argList, variableValues);
ExecuteFunction(split(words.at(lineNum).at(0), '(')[0], funcArgs);
return nullType;
}
// Check if it is a SplitThread call
else if (startsWith(words.at(lineNum).at(0), "SplitThread"))
{
vector<string> lineContents = words.at(lineNum);
cout << "New Thread: " << words.at(lineNum).at(0) << endl;
//lineContents.at(0) = betweenChars(lineContents.at(0), '(', ')');
//cout << "debug: " << lineContents.at(0) << endl;
//if (betweenChars(lineContents.at(0), '(', ')') == "")
// std::thread thread_obj(ExecuteFunction, trim(split(lineContents.at(0), '(')[0]), vector<boost::any>());
//else
// std::thread thread_obj(ExecuteFunction, trim(split(lineContents.at(0), '(')[0]), VarValues(split(RMParenthesis("(" + split(unWrapVec(rangeInVec(lineContents, 0, (int)lineContents.size() - 2)), '(')[1]), ','), variableValues));
return nullType;
}
// Check if global variable declaration
else if (words.at(lineNum).at(0) == "global")
{
try
{
globalVariableValues[words.at(lineNum).at(2)] = EvalExpression(unWrapVec(slice(words.at(lineNum), 4, -1)), variableValues);
}
catch (const std::exception&)
{
LogCriticalError("Error at line: " + to_string(lineNum) + ", " + unWrapVec(words.at(lineNum)) + ", couldn't initialize variable.");
}
return nullType;
}
// Iterate through all types to see if line inits or
// re-inits a variable then store it with it's value
else if (countInVector(types, words.at(lineNum).at(0)) > 0)
{
try
{
variableValues[words.at(lineNum).at(1)] = EvalExpression(unWrapVec(slice(words.at(lineNum), 3, -1)), variableValues);
}
catch (const std::exception&)
{
LogCriticalError("Error at line: " + to_string(lineNum) + ", " + unWrapVec(words.at(lineNum)) + ", couldn't initialize variable.");
}
return nullType;
}
// Check existing variables: If matches, then it means
// the variables value is getting changed with an operator
else if (count(words.at(lineNum).at(0), '.') == 0 && (IsVar(words.at(lineNum).at(0), variableValues) || IsVar(words.at(lineNum).at(0), globalVariableValues)))
{
// Evaluates what the operator (ex. '=', '+=') does to the value on the left by the value on the right
varOperation(vector<string>(words.at(lineNum).begin(), words.at(lineNum).end()), variableValues);
return nullType;
}
// Check existing variables: To see if accessing class sub component
else if (count(words.at(lineNum).at(0), '.') > 0 && IsVar(split(words.at(lineNum).at(0), '.')[0], variableValues) || IsVar(split(words.at(lineNum).at(0), '.')[0], globalVariableValues))
{
if (IsVar(split(words.at(lineNum).at(0), '.')[0], variableValues))
variableValues[split(words.at(lineNum).at(0), '.')[0]] = EditClassSubComponent(variableValues[split(words.at(lineNum).at(0), '.')[0]], words.at(lineNum).at(1), EvalExpression(unWrapVec(vector<string>(words.at(lineNum).begin() + 2, words.at(lineNum).end())), variableValues), split(words.at(lineNum).at(0), '.')[1]);
else if (IsVar(split(words.at(lineNum).at(0), '.')[0], globalVariableValues))
globalVariableValues[split(words.at(lineNum).at(0), '.')[0]] = EditClassSubComponent(globalVariableValues[split(words.at(lineNum).at(0), '.')[0]], words.at(lineNum).at(1), EvalExpression(unWrapVec(vector<string>(words.at(lineNum).begin() + 2, words.at(lineNum).end())), variableValues), split(words.at(lineNum).at(0), '.')[1]);
return nullType;
}
// If declaring a while loop, loop until false
else if (words.at(lineNum).at(0) == "while")
{
vector<vector<string>> whileContents;
vector<string> whileParameters;
// Gather the parameters that must be == true for the loop to run
int numOfBrackets = 0;
for (int w = 1; w < (int)words.at(lineNum).size(); w++) {
if (count(words.at(lineNum).at(w), '{') == 0)
whileParameters.push_back(words.at(lineNum)[w]);
else
{
whileParameters.push_back(replace(words.at(lineNum)[w], "{", ""));
numOfBrackets = 1;
break;
}
}
// If the statement is already false, don't bother gathering the contents
if (BooleanLogic(whileParameters.at(0), whileParameters.at(1), whileParameters.at(2), variableValues) == false) {
lineNum++;
while (lineNum < (int)words.size())
{
numOfBrackets += countInVector(words.at(lineNum), "{") - countInVector(words.at(lineNum), "}");
if (numOfBrackets == 0)
break;
lineNum++;
}
return nullType;
}
// Gather the contents
lineNum++;
while (lineNum < (int)words.size())
{
numOfBrackets += countInVector(words.at(lineNum), "{") - countInVector(words.at(lineNum), "}");
if (numOfBrackets == 0)
break;
whileContents.push_back(words.at(lineNum));
lineNum++;
}
//whileContents = removeTabsWdArry(whileContents, 1);
// Loop while true
while (BooleanLogic(whileParameters.at(0), whileParameters.at(1), whileParameters.at(2), variableValues))
{
//Iterate through all lines in while loop
for (int lineNum = 0; lineNum < (int)whileContents.size(); lineNum++)
{
if (whileContents.at(lineNum).at(0) == "continue")
break; // Stops iterating through lines and return to beginning
if (whileContents.at(lineNum).at(0) == "break")
return nullType; // Stops iterating through lines and leave while loop
boost::any returnVal = ProcessLine(whileContents, lineNum, variableValues);
if (!returnVal.empty()) {
try
{
BREAK t = any_cast<BREAK>(returnVal);
return nullType;
}
catch (boost::bad_any_cast)
{
return returnVal;
}
}
}
}
return nullType;
}
// If declaring an if statement, only execute if true
else if (words.at(lineNum).at(0) == "if")
{
vector<vector<string>> ifContents;
vector<string> ifParameters;
// Gather the parameters that must be == true for the loop to run
int numOfBrackets = 0;
for (int w = 1; w < (int)words.at(lineNum).size(); w++) {
if (count(words.at(lineNum).at(w), '{') == 0)
ifParameters.push_back(words.at(lineNum)[w]);
else
{
ifParameters.push_back(replace(words.at(lineNum)[w], "{", ""));
numOfBrackets = 1;
break;
}
}
// If the statement is already false, don't bother gathering the contents
if (BooleanLogic(ifParameters.at(0), ifParameters.at(1), ifParameters.at(2), variableValues) == false) {
lineNum++;
while (lineNum < (int)words.size())
{
numOfBrackets += countInVector(words.at(lineNum), "{") - countInVector(words.at(lineNum), "}");
if (numOfBrackets == 0)
break;
lineNum++;
}
return nullType;
}
// Gather the contents
lineNum++;
while (lineNum < (int)words.size())
{
numOfBrackets += countInVector(words.at(lineNum), "{") - countInVector(words.at(lineNum), "}");
if (numOfBrackets == 0)
break;
ifContents.push_back(words.at(lineNum));
lineNum++;
}
//ifContents = removeTabsWdArry(ifContents, 1);
// Execute if true
if (BooleanLogic(ifParameters.at(0), ifParameters.at(1), ifParameters.at(2), variableValues))
{
//Iterate through all lines in if statement
for (int l = 0; l < (int)ifContents.size(); l++)
{
if (ifContents.at(l).at(0) == "break")
return breakReOp; // Stops iterating through lines and leave while loop
boost::any returnVal = ProcessLine(ifContents, l, variableValues);
if (!returnVal.empty())
return returnVal;
}
}
else if (words.size() > lineNum)
{
if (words[lineNum].at(0) == "else")
{
vector<vector<string>> elseContents;
vector<string> elseParameters;
int numOfBrackets = 0;
for (int w = 1; w < (int)words.at(lineNum).size(); w++) {
if (count(words.at(lineNum).at(w), '{') != 0)
{
numOfBrackets = 1;
break;
}
}
lineNum++;
while (lineNum < (int)words.size())
{
numOfBrackets += countInVector(words.at(lineNum), "{") - countInVector(words.at(lineNum), "}");
if (numOfBrackets == 0)
break;
elseContents.push_back(words.at(lineNum));
lineNum++;
}
//elseContents = removeTabsWdArry(elseContents, 1);
//Iterate through all lines in else statement
for (int l = 0; l < (int)elseContents.size(); l++)
{
boost::any returnVal = ProcessLine(elseContents, l, variableValues);
if (!returnVal.empty())
return returnVal;
}
}
}
return nullType;
}
return nullType;
}
boost::any ExecuteFunction(const string& functionName, const vector<boost::any>& inputVarVals)
{
// Get contents of function from global function map
std::vector<std::vector<std::string>> words = functionValues[functionName];
unordered_map<string, boost::any> variableValues = {};
std::vector<std::string> funcArgs = words.at(0);
// Set function variables equal to whatever inputs were provided
for (int i = 0; i < (int)inputVarVals.size(); i++)
{
if (i < funcArgs.size())
{
variableValues[funcArgs[i]] = inputVarVals[i];
#if DEVELOPER_MESSAGES == true
cout << "in " << functionName + " " << funcArgs[i] << " == " << AnyAsString(inputVarVals[i]) << endl;
#endif
}
}
//Iterate through all lines in function
for (int lineNum = 1; lineNum < (int)words.size(); lineNum++)
{
try
{
boost::any returnVal = ProcessLine(words, lineNum, variableValues);
if (!returnVal.empty())
return returnVal;
}
catch (const std::exception&)
{
LogCriticalError("Error at line: " + to_string(lineNum) + ", " + unWrapVec(words.at(lineNum)));
}
}
return nullType;
}
int parseZSharp(string script)
{
//script = replace(script, " ", "\t"); // Replace spaces with tabs (not really required, and will break purposefull whitespace in strings etc.)
// Split the script by newline, signifying a line ending
vector<string> beforeProcessLines = split(script, '\n');
vector<string> lines;
for (int i = 0; i < (int)beforeProcessLines.size(); i++) { // Then split said lines into indiviual words
if (!startsWith(trim(beforeProcessLines.at(i)), "//") && trim(beforeProcessLines.at(i)) != "")
{ // dont include line if it is a comment or if it is blank
lines.push_back(trim(beforeProcessLines.at(i)));
}
}
#if DEVELOPER_MESSAGES
InterpreterLog("Contents:\n");
#endif
vector<vector<string>> words;
for (int i = 0; i < (int)lines.size(); i++) // Then split said lines into indiviual words
{
words.push_back(split(lines.at(i), ' '));
#if DEVELOPER_MESSAGES
cout << unWrapVec(words.at(i)) << endl;
#endif
}
#if DEVELOPER_MESSAGES
InterpreterLog("Gather variables & functions...");
#endif
// Go through entire script and iterate through all types to see if line is a variable
// or function declaration, then store it with it's value
for (int lineNum = 0; lineNum < (int)words.size(); lineNum++)
{
//Checks if it is function
if (words.at(lineNum).at(0) == "func")
{
vector<vector<string>> functionContents;
string functName = split(words.at(lineNum).at(1), '(')[0];
#if DEVELOPER_MESSAGES == true
InterpreterLog("Load script function " + functName + "...");
#endif
//string args = "";
//if (indexInStr(unWrapVec(words.at(lineNum)), ')') - indexInStr(unWrapVec(words.at(lineNum)), '(') > 1)
// for (int w = 0; w < (int)words.at(lineNum).size(); w++) // Get all words from the instantiation line: these are the args
// {
// if (count(words.at(lineNum).at(w), '{') == 0)
// args += replace(replace(words.at(lineNum).at(w), "(", " "), ")", "");
// }
string args = betweenChars(unWrapVec(words.at(lineNum)), '(', ')');
//cout << functName << "<" << args << ">" << endl;
//args = trim(replace(args, functName, ""));
functionContents.push_back(split(replace(args, " ", ""), ','));
int numOfBrackets = countInVector(words.at(lineNum), "{") - countInVector(words.at(lineNum), "}");
// Gather the contents
lineNum++;
while (lineNum < (int)words.size())
{
numOfBrackets += countInVector(words.at(lineNum), "{") - countInVector(words.at(lineNum), "}");
if (numOfBrackets == 0)
break;
functionContents.push_back(words.at(lineNum));
//cout << functName << "<" << args << ">" << endl;
lineNum++;
}
//functionContents = removeTabsWdArry(functionContents, 1);
/*int numOfBrackets = 0;
for (int w = 1; w < (int)words.at(lineNum).size(); w++) {
if (count(words.at(lineNum).at(w), '{') != 0) {
numOfBrackets = 1;
break;
}
}
for (int p = lineNum + 1; p < (int)words.size(); p++)
{
numOfBrackets += countInVector(words.at(p), "{") - countInVector(words.at(p), "}");
if (numOfBrackets == 0)
break;
functionContents.push_back(removeTabs(words.at(p), 1));
}*/
functionValues[functName] = functionContents;
}
else
{
if (words.at(lineNum).at(0) == "include")
{
string scriptPath = StringRaw(words.at(lineNum).at(1));
string scriptTextContents;
#if DEVELOPER_MESSAGES == true
InterpreterLog("Including from " + words.at(lineNum).at(1) + "...");
#endif
#if UNIX
// Get script contents as single string
auto ss = ostringstream{};
ifstream input_file(scriptPath);
ss << input_file.rdbuf();
scriptTextContents = ss.str();
#if DEVELOPER_MESSAGES
InterpreterLog("Gather script contents...");
#endif
#elif WINDOWS
// Get script contents as single string
ifstream script(scriptPath);
stringstream scriptString;
scriptString << script.rdbuf();
scriptTextContents = scriptString.str();
#if DEVELOPER_MESSAGES
InterpreterLog("Gather script contents...");
#endif
#endif
parseZSharp(scriptTextContents);
}
else if (words.at(lineNum).at(0) == "string") {
globalVariableValues[words.at(lineNum).at(1)] = StringRaw(words.at(lineNum).at(3));
#if DEVELOPER_MESSAGES == true
InterpreterLog("Load script variable " + words.at(lineNum).at(1) + "...");
#endif
}
// Iterate through all types to see if line inits or
// re-inits a variable then store it with it's value
else if (countInVector(types, trim(words.at(lineNum).at(0))) > 0)
{
//cout << words.at(lineNum).at(1) << "=" << unWrapVec(slice(words.at(lineNum), 3, -1)) << "=" << AnyAsString(EvalExpression(unWrapVec(slice(words.at(lineNum), 3, -1)), variableValues)) << endl;
globalVariableValues[words.at(lineNum).at(1)] = EvalExpression(unWrapVec(slice(words.at(lineNum), 3, -1)), globalVariableValues);
}
// else if (words.at(lineNum).at(0) == "int") {
// globalVariableValues[words.at(lineNum).at(1)] = stoi(words.at(lineNum).at(3));
//#if DEVELOPER_MESSAGES == true
// InterpreterLog("Load script variable " + words.at(lineNum).at(1) + "...");
//#endif
// }
// else if (words.at(lineNum).at(0) == "float") {
// globalVariableValues[words.at(lineNum).at(1)] = stof(words.at(lineNum).at(3));
//#if DEVELOPER_MESSAGES == true
// InterpreterLog("Load script variable " + words.at(lineNum).at(1) + "...");
//#endif
// }
// else if (words.at(lineNum).at(0) == "bool") {
// globalVariableValues[words.at(lineNum).at(1)] = stob(words.at(lineNum).at(3));
//#if DEVELOPER_MESSAGES == true
// InterpreterLog("Load script variable " + words.at(lineNum).at(1) + "...");
//#endif
// }
else
LogWarning("unrecognized type \'" + words.at(lineNum).at(0) + "\' on line: " + to_string(lineNum));
}
}
return 0;
}
int main(int argc, char* argv[])
{
// Print the name of the interpreter and it's version in inverted black on white text
PrintColored(NAMEVERSION, blackFGColor, whiteBGColor, false);
cout << endl << endl;
// Gathers builtin functions and variables
parseZSharp(ZSContents);
//functionValues = builtinFunctionValues;
//globalVariableValues = builtinVarVals;
std::string scriptTextContents;
// If scriptname is supplied and not in developer mode
if (argc > 1 || EXAMPLE_PROJECT)
{
std::string scriptPath;
if (EXAMPLE_PROJECT)
scriptPath = "D:\\Code\\Z-Sharp\\examples\\Platformer\\script.zs";
else
scriptPath = argv[1];
#if DEVELOPER_MESSAGES
cout << scriptPath << endl;
#endif
if (!fileExists(scriptPath))
LogCriticalError("Failed to load script from path: \"" + scriptPath + "\"");
std::string projectDirectory = scriptPath.substr(0, scriptPath.find_last_of("/\\"));
#if UNIX
// Get script contents as single string
auto ss = ostringstream{};
ifstream input_file(scriptPath);
ss << input_file.rdbuf();
scriptTextContents = ss.str();
#if DEVELOPER_MESSAGES
InterpreterLog("Gather script contents...");
#endif
// Change the current working directory to that of the script
int chErr = chdir(projectDirectory.c_str());
if (chErr < 0)
LogCriticalError("Failed to change directory to: \"" + projectDirectory + "\", error num: " + to_string(chErr));
#if DEVELOPER_MESSAGES
InterpreterLog("Changed directory to " + projectDirectory + "...");
#endif
#elif WINDOWS
// Get script contents as single string
ifstream script(scriptPath);
stringstream scriptString;
scriptString << script.rdbuf();
scriptTextContents = scriptString.str();
#if DEVELOPER_MESSAGES
InterpreterLog("Gather script contents...");
#endif
// Change the current working directory to that of the script
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
std::wstring wide = converter.from_bytes(projectDirectory);
LPCWSTR s = wide.c_str();
SetCurrentDirectory(s);
#if DEVELOPER_MESSAGES
InterpreterLog("Changed directory to " + projectDirectory + "...");
#endif
#endif
}
else
{ // If no script is provided as an argument throw error
LogWarning("No script provided! Please drag and drop .ZS file over interpreter executable file, or provide it's path as a command-line argument.");
InterpreterLog("Press Enter to Exit...");
cin.ignore();
exit(1);
}
#if DEVELOPER_MESSAGES
InterpreterLog("Parsing...");
#endif
// Parse the script
parseZSharp(scriptTextContents);
#if DEVELOPER_MESSAGES
InterpreterLog("Start Main()");
#endif
try
{
// Executes main, which is the entry point function
ExecuteFunction("Main", vector<boost::any> {});
}
catch (const std::exception&)
{
//Failed with error
}
// Entire script has been run, exit.
#if DEVELOPER_MESSAGES // If built with developer messages, then verify exit
InterpreterLog("Press Enter to Exit...");
cin.ignore();
exit(1);
#else
if (argc > 2)
{
string a = argv[2];
std::transform(a.begin(), a.end(), a.begin(),
[](unsigned char c) { return std::tolower(c); });
if (a == "-ve") // If the '-ve' (verify exit) option is used, ask for verification on exit
{
InterpreterLog("Press Enter to Exit...");
cin.ignore();
exit(1);
}
}
else if (AnyAsBool(GetVariableValue("EXIT_WHEN_DONE", globalVariableValues)) == false)
{
InterpreterLog("Press Enter to Exit...");
cin.ignore();
exit(1);
}
#endif // Else exit automatically
return 0;
}

223
ZSharp/ZS.h Normal file
View File

@ -0,0 +1,223 @@
#include <string>
using namespace std;
std::string ZSContents = R"(
////////////////////////////////////////////////////////////////////////////////
// BUILTIN
////////////////////////////////////////////////////////////////////////////////
// Default variables, can be overwritten
// if re-initialized or changed
float PI = 3.14159265358979323846264338
float EulersNumber = 2.71828183
// This variable tells the interpreter if it should close the console window when the program has finished running.
bool EXIT_WHEN_DONE = true
// Trigonometric function Sin
func Sin(input)
{
float out = ZS.Math.Sin(input)
return out
}
// Trigonometric function Cos
func Cos(input)
{
float out = ZS.Math.Cos(input)
return out
}
// Trigonometric function Tan
func Tan(input)
{
float out = ZS.Math.Tan(input)
return out
}
// Sigmoid activation function
func Sigmoid(input)
{
float out = 1 / (1 + EulersNumber ^ -input)
return out
}
// Hyperbolic tangent activation function
func Tanh(input)
{
float out = ((EulersNumber ^ input) - (EulersNumber ^ -input)) / ((EulersNumber ^ input) + (EulersNumber ^ -input))
return out
}
// Rounds input to nearest integer value
func Round(input)
{
float out = ZS.Math.Round(input)
return out
}
// Linearly interpolates between a and b by t
func Lerp(a, b, t)
{
float out = ZS.Math.Lerp(a, b, t)
return out
}
// Get absolute value of x
func Abs(x)
{
float out = ZS.Math.Abs(x)
return out
}
// Convert radians to degrees
func RadToDeg(x)
{
float out = (x * PI) / 180
return out
}
// Convert degrees to radians
func DegToRad(x)
{
float out = (x * 180) / PI
return out
}
// Clamps input between min and max
func Clamp(input, min, max)
{
if input < min
{
return min
}
if input > max
{
return max
}
return input
}
// Sets color of pixel to RGB value
func SetPixel(x, y, r, g, b)
{
string out = ZS.Graphics.SetPixel(x, y, r, g, b)
return out
}
// Prints input value to console
func Print(strToPrint)
{
ZS.System.Print(strToPrint)
}
// Prints input value to console with appended newline '\n'
func Printl(strToPrint)
{
ZS.System.PrintLine(strToPrint)
}
// Creates new sprite class
func NSprite(path, x, y, r)
{
Sprite s = ZS.Graphics.Sprite(path, x, y, r)
return s
}
// Draws sprite to window
func Draw(spr)
{
ZS.Graphics.Draw(spr)
}
// Creates new Vector2 class
func NVec2(x, y)
{
Vec2 v = ZS.System.Vec2(x, y)
return v
}
// Gets if key is down
func GetKey(keyName)
{
bool b = ZS.Input.GetKey(keyName)
return b
}
////////////////////////////
// ↓ MADE BY KAPUTCHINO ↓ //
////////////////////////////
// Return the number of combinations
func Comb(n, r)
{
return Perm(n, r) / Fac(r)
}
// Return the factorial of a number
func Fac(x)
{
int r = 1
while x > 1
{
r = r * x
x = x - 1
}
return r
}
// Return exp(x) by using the taylor method, not extremly accurate
func TaylorExp(x)
{
float sum = 0
float term = 1
int i = 1
float sumterm = 1
while sum != sumterm
{
sum = sumterm
term = term * x / i
i = i + 1
sumterm = sumterm + term
}
return sum
}
// Return the number of permutations
func Perm(n, r)
{
if n < 0
{
ZS.System.PrintLine("n must be superior or equal to 0")
return -1
}
if r < 0
{
ZS.System.PrintLine("r must be superior or equal to 0")
return -1
}
if r > n
{
ZS.System.PrintLine("r must be inferior or equal to n")
return -1
}
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
}
)"
;

View File

@ -22,8 +22,9 @@
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{d5f150f8-1f83-41eb-a195-1b5c3ca9322a}</ProjectGuid>
<RootNamespace>Slang</RootNamespace>
<RootNamespace>ZSharp</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>ZSharp</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -82,9 +83,13 @@
<LinkIncremental>true</LinkIncremental>
<IncludePath>D:\Code\SDL2-2.0.18\include;D:\Code\SDL2_image-2.0.5\include;D:\Code\SDL2_ttf-2.0.15\include;$(IncludePath)</IncludePath>
<LibraryPath>D:\Code\SDL2_ttf-2.0.15\lib\x64;D:\Code\SDL2-2.0.18\lib\x64;D:\Code\SDL2_image-2.0.5\lib\x64;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)\Releases\ZS_Win_Base_Raw</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>D:\Code\SDL2-2.0.18\include;D:\Code\SDL2_image-2.0.5\include;D:\Code\SDL2_ttf-2.0.15\include;$(IncludePath)</IncludePath>
<LibraryPath>D:\Code\SDL2_ttf-2.0.15\lib\x64;D:\Code\SDL2-2.0.18\lib\x64;D:\Code\SDL2_image-2.0.5\lib\x64;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)\Releases\ZS_Win_Base_Raw</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@ -140,12 +145,15 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>D:\Code\SDL2_ttf-2.0.15;D:\Code\boost;D:\Code\SDL2-2.0.18;D:\Code\SDL2_image-2.0.5;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>D:\Code\SDL2_ttf-2.0.15\lib\x64;D:\Code\SDL2-2.0.18\lib\x64;D:\Code\boost\libs;D:\Code\SDL2_image-2.0.5\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;SDL2_ttf.lib;SDL2_image.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
@ -159,21 +167,14 @@
<ClInclude Include="graphics.h" />
<ClInclude Include="main.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="SLB.h" />
<ClInclude Include="ZS.h" />
<ClInclude Include="strops.h" />
</ItemGroup>
<ItemGroup>
<None Include="script.slg" />
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<Image Include="icon.ico" />
<Image Include="tut\hello_world.bmp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Slang.rc" />
<ResourceCompile Include="ZSharp.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -41,7 +41,7 @@
<ClInclude Include="main.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="SLB.h">
<ClInclude Include="ZS.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
@ -49,21 +49,12 @@
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="script.slg" />
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<Image Include="tut\hello_world.bmp">
<Filter>Source Files</Filter>
</Image>
<Image Include="icon.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Slang.rc">
<ResourceCompile Include="ZSharp.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>

View File

@ -0,0 +1,104 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Z-Sharp"
#define MyAppVersion "2.1.3-alpha"
#define MyAppPublisher "AstroSam"
#define MyAppURL "https://github.com/sam-astro/Z-Sharp"
#define MyAppExeName "ZSharp.exe"
#define MyAppAssocName MyAppName + " Script"
#define MyAppAssocExt ".zs"
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{F730397E-FCA8-4486-9469-C9C0D609D961}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\ZSharp
DisableDirPage=yes
ChangesAssociations=yes
DisableProgramGroupPage=yes
ChangesEnvironment=true
LicenseFile=D:\Code\Z-Sharp\LICENSE
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=commandline
OutputDir=D:\Code\Z-Sharp\Releases\ZSharp-Win-Installer
OutputBaseFilename=ZSharp-Setup
SetupIconFile=D:\Code\Z-Sharp\ExtraResources\installer-icon.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[Tasks]
Name: modifypath; Description: Add application directory to your environmental path (This allows you to easily use from command line); Flags: unchecked
[Code]
const
ModPathName = 'modifypath';
ModPathType = 'system';
function ModPathDir(): TArrayOfString;
begin
setArrayLength(Result, 1)
Result[0] := ExpandConstant('{app}');
end;
#include "modpath.iss"
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "armenian"; MessagesFile: "compiler:Languages\Armenian.isl"
Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
Name: "bulgarian"; MessagesFile: "compiler:Languages\Bulgarian.isl"
Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
Name: "corsican"; MessagesFile: "compiler:Languages\Corsican.isl"
Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
Name: "hebrew"; MessagesFile: "compiler:Languages\Hebrew.isl"
Name: "icelandic"; MessagesFile: "compiler:Languages\Icelandic.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl"
Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "slovak"; MessagesFile: "compiler:Languages\Slovak.isl"
Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
Name: "turkish"; MessagesFile: "compiler:Languages\Turkish.isl"
Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"
[Files]
Source: "D:\Code\Z-Sharp\Releases\ZS_Win_Base_Raw\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Code\Z-Sharp\Releases\ZS_Win_Base_Raw\libfreetype-6.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Code\Z-Sharp\Releases\ZS_Win_Base_Raw\libjpeg-9.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Code\Z-Sharp\Releases\ZS_Win_Base_Raw\libpng16-16.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Code\Z-Sharp\Releases\ZS_Win_Base_Raw\libtiff-5.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Code\Z-Sharp\Releases\ZS_Win_Base_Raw\libwebp-7.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Code\Z-Sharp\Releases\ZS_Win_Base_Raw\SDL2.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Code\Z-Sharp\Releases\ZS_Win_Base_Raw\SDL2_image.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Code\Z-Sharp\Releases\ZS_Win_Base_Raw\SDL2_ttf.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Code\Z-Sharp\Releases\ZS_Win_Base_Raw\zlib1.dll"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Registry]
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""
Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: ""
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"

View File

@ -286,6 +286,8 @@ bool any_compare(const boost::any& a, const boost::any& b)
// If it is a Vec2, then compare separately after converted
else if (aType == 5)
return any_cast<Vec2>(a) == any_cast<Vec2>(b);
return false;
}
#endif

View File

@ -8,6 +8,7 @@
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>D:\Code\boost;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>None</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>D:\Code\boost\stage\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>

492
ZSharp/builtin.h Normal file
View File

@ -0,0 +1,492 @@
#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 <iostream>
#include <fstream>
#include <string>
#include <regex>
#include <limits>
#include <algorithm>
#include <unordered_map>
#include <boost/any.hpp>
#include <SDL.h>
#include <ctime>
#include <math.h>
#include <sys/stat.h>
#include <cstdlib> // for console command printing
#include "strops.h"
#include "graphics.h"
#include "anyops.h"
#if WINDOWS
#include "color.hpp"
#endif
//#define DEVELOPER_MESSAGES false
using namespace std;
using namespace boost;
vector<string> types = { "int", "float", "string", "bool", "void", "null", "Sprite", "Vec2", "Text" };
//unordered_map<string, vector<vector<string>>> builtinFunctionValues;
//unordered_map<string, boost::any> builtinVarVals;
// Foreground colors
const std::string blackFGColor = "\x1B[30m";
const std::string redFGColor = "\x1B[31m";
const std::string greenFGColor = "\x1B[32m";
const std::string yellowFGColor = "\x1B[33m";
const std::string blueFGColor = "\x1B[34m";
const std::string magentaFGColor = "\x1B[35m";
const std::string cyanFGColor = "\x1B[36m";
const std::string whiteFGColor = "\x1B[37m";
const std::string brightBlackFGColor = "\x1B[90m";
const std::string brightRedFGColor = "\x1B[91m";
const std::string brightGreenFGColor = "\x1B[92m";
const std::string brightYellowFGColor = "\x1B[93m";
const std::string brightBlueFGColor = "\x1B[94m";
const std::string brightMagentaFGColor = "\x1B[95m";
const std::string brightCyanFGColor = "\x1B[96m";
const std::string brightWhiteFGColor = "\x1B[97m";
//Background colors
const std::string blackBGColor = "\x1B[40m";
const std::string redBGColor = "\x1B[41m";
const std::string greenBGColor = "\x1B[42m";
const std::string yellowBGColor = "\x1B[43m";
const std::string blueBGColor = "\x1B[44m";
const std::string magentaBGColor = "\x1B[45m";
const std::string cyanBGColor = "\x1B[46m";
const std::string whiteBGColor = "\x1B[47m";
const std::string brightBlackBGColor = "\x1B[100m";
const std::string brightRedBGColor = "\x1B[101m";
const std::string brightGreenBGColor = "\x1B[102m";
const std::string brightYellowBGColor = "\x1B[103m";
const std::string brightBlueBGColor = "\x1B[104m";
const std::string brightMagentaBGColor = "\x1B[105m";
const std::string brightCyanBGColor = "\x1B[106m";
const std::string brightWhiteBGColor = "\x1B[107m";
// Reset color
const std::string resetColor = "\033[0m";
class NullType {
public:
string type = "NULL";
};
class BREAK {
public:
string type = "BREAK";
};
boost::any nullType;
boost::any breakReOp;
float clamp(float v, float min, float max)
{
if (v < min) return min;
if (v > max) return max;
return v;
}
float lerp(float a, float b, float f)
{
return a + f * (b - a);
}
inline bool fileExists(const std::string& name) {
struct stat buffer;
return (stat(name.c_str(), &buffer) == 0);
}
void PrintColored(std::string text, std::string fgColor, std::string bgColor, bool isError)
{
#if WINDOWS
if (fgColor == blackFGColor)
cerr << hue::black;
else if (fgColor == redFGColor)
cerr << hue::red;
else if (fgColor == greenFGColor)
cerr << hue::green;
else if (fgColor == yellowFGColor)
cerr << hue::yellow;
else if (fgColor == blueFGColor)
cerr << hue::blue;
else if (fgColor == magentaFGColor)
cerr << hue::purple;
else if (fgColor == cyanFGColor)
cerr << hue::aqua;
else if (fgColor == whiteFGColor)
cerr << hue::white;
if (bgColor == blackBGColor)
cerr << hue::on_black;
else if (bgColor == redBGColor)
cerr << hue::on_red;
else if (bgColor == greenBGColor)
cerr << hue::on_green;
else if (bgColor == yellowBGColor)
cerr << hue::on_yellow;
else if (bgColor == blueBGColor)
cerr << hue::on_blue;
else if (bgColor == magentaBGColor)
cerr << hue::on_purple;
else if (bgColor == cyanBGColor)
cerr << hue::on_aqua;
else if (bgColor == whiteBGColor)
cerr << hue::on_white;
std::cerr << text << hue::reset;
#else
if (!isError)
cout << fgColor + bgColor + text + resetColor;
else
cerr << fgColor + bgColor + text + resetColor;
#endif
}
int LogWarning(const string& warningText)
{
PrintColored("WARNING: ", yellowFGColor, "", true);
PrintColored(escaped(warningText), yellowFGColor, "", true);
cerr << std::endl;
//cout << "\x1B[33mWARNING: " << warningText << "\033[0m\t\t" << endl;
return 1;
}
int InterpreterLog(const string& logText)
{
int Hour = 0;
int Min = 0;
int Sec = 0;
time_t timer = time(0);
tm bt{};
#if UNIX
time_t currentTime;
struct tm* localTime;
time(&currentTime); // Get the current time
localTime = localtime(&currentTime); // Convert the current time to the local time
Hour = localTime->tm_hour;
Min = localTime->tm_min;
Sec = localTime->tm_sec;
#elif WINDOWS
localtime_s(&bt, &timer);
Hour = bt.tm_hour;
Min = bt.tm_min;
Sec = bt.tm_sec;
#else
static mutex mtx;
std::lock_guard<std::mutex> lock(mtx);
bt = *localtime(&timer);
#endif
PrintColored("[" + to_string(Hour) + ":" + to_string(Min) + ":" + to_string(Sec) + "] ", blueFGColor, "", true);
PrintColored("ZSharp: ", yellowFGColor, "", true);
PrintColored(escaped(logText), greenFGColor, "", true);
cout << std::endl;
//cout << "\x1B[34m[" + to_string(Hour) + ":" + to_string(Min) + ":" + to_string(Sec) + "] \x1B[33mZSharp: \x1B[32m" << logText << "\033[0m\t\t" << endl;
return 1;
}
int LogCriticalError(const string& errorText)
{
int Hour = 0;
int Min = 0;
int Sec = 0;
time_t timer = time(0);
tm bt{};
#if UNIX
time_t currentTime;
struct tm* localTime;
time(&currentTime); // Get the current time
localTime = localtime(&currentTime); // Convert the current time to the local time
Hour = localTime->tm_hour;
Min = localTime->tm_min;
Sec = localTime->tm_sec;
#elif WINDOWS
localtime_s(&bt, &timer);
Hour = bt.tm_hour;
Min = bt.tm_min;
Sec = bt.tm_sec;
#else
static mutex mtx;
std::lock_guard<std::mutex> lock(mtx);
bt = *localtime(&timer);
#endif
PrintColored("[" + to_string(Hour) + ":" + to_string(Min) + ":" + to_string(Sec) + "] ", blueFGColor, "", true);
PrintColored("ZSharp: ", yellowFGColor, "", true);
PrintColored(escaped(errorText), redFGColor, "", true);
cerr << std::endl;
InterpreterLog("Press Enter to Exit...");
cin.ignore();
exit(1);
//cerr << "\x1B[34m[" + to_string(Hour) + ":" + to_string(Min) + ":" + to_string(Sec) + "] \x1B[33mZSharp: \x1B[31mERROR: " << errorText << "\033[0m\t\t" << endl;
//exit(EXIT_FAILURE);
return 2;
}
boost::any GetClassSubComponent(boost::any value, string subComponentName)
{
// If a Sprite Class
if (any_type(value) == 4)
{
return any_cast<Sprite>(value).SubComponent(subComponentName);
}
// If a Vec2 Class
if (any_type(value) == 5)
{
return any_cast<Vec2>(value).SubComponent(subComponentName);
}
// If a Text Class
if (any_type(value) == 6)
{
return any_cast<Text>(value).SubComponent(subComponentName);
}
return nullType;
}
boost::any EditClassSubComponent(boost::any value, string oper, boost::any otherVal, string subComponentName)
{
// If a Sprite Class
if (any_type(value) == 4)
{
Sprite v = any_cast<Sprite>(value);
v.EditSubComponent(subComponentName, oper, otherVal);
return v;
}
// If a Vec2 Class
if (any_type(value) == 5)
{
Vec2 v = any_cast<Vec2>(value);
v.EditSubComponent(subComponentName, oper, otherVal);
return v;
}
// If a Text Class
if (any_type(value) == 6)
{
Text t = any_cast<Text>(value);
t.EditSubComponent(subComponentName, oper, otherVal);
return t;
}
return nullType;
}
bool AxisAlignedCollision(const Sprite& a, const Sprite& b) // AABB - AABB collision
{
// collision x-axis?
bool collisionX = a.position.x + a.scale.x / 2 >= b.position.x - b.scale.x / 2 &&
b.position.x + b.scale.x / 2 >= a.position.x - a.scale.x;
// collision y-axis?
bool collisionY = a.position.y + a.scale.y / 2 >= b.position.y - b.scale.y / 2 &&
b.position.y + b.scale.y / 2 >= a.position.y - a.scale.y / 2;
//// collision x-axis?
//bool collisionX = a.position.x - a.scale.x / 2 >= b.position.x + b.scale.x / 2 ||
// a.position.x + a.scale.x / 2 <= b.position.x - b.scale.x / 2;
//// collision y-axis?
//bool collisionY = a.position.y - a.scale.y / 2 >= b.position.y + b.scale.y / 2 ||
// a.position.y + a.scale.y / 2 <= b.position.y - b.scale.y / 2;
// collision only if on both axes
return collisionX && collisionY;
}
//// Initial script processing, which loads variables and functions from builtin
//int GetBuiltins(std::string s)
//{
// std::string script = replace(s, " ", "\t");
//
// vector<string> lines = split(script, '\n');
// vector<vector<string>> words;
// for (int i = 0; i < (int)lines.size(); i++)
// {
// words.push_back(split(lines.at(i), ' '));
// }
//
// // Go through entire script and iterate through all types to see if line is a
// // function declaration, then store it with it's value
// for (int lineNum = 0; lineNum < (int)words.size(); lineNum++)
// {
// //Checks if it is function
// if (words.at(lineNum).at(0) == "func")
// {
// vector<vector<string>> functionContents;
//
// string functName = split(words.at(lineNum).at(1), '(')[0];
//
//#if DEVELOPER_MESSAGES == true
// InterpreterLog("Load builtin function " + functName + "...");
//#endif
//
// string args = "";
// for (int w = 1; w < (int)words.at(lineNum).size(); w++) // Get all words from the instantiation line: these are the args
// {
// args += replace(replace(words.at(lineNum).at(w), "(", " "), ")", "");
// }
//
// args = replace(args, functName + " ", "");
// functionContents.push_back(split(args, ','));
//
// int numOfBrackets = 1;
// for (int p = lineNum + 2; p < (int)words.size(); p++)
// {
// numOfBrackets += countInVector(words.at(p), "{") - countInVector(words.at(p), "}");
// if (numOfBrackets == 0)
// break;
// functionContents.push_back(removeTabs(words.at(p), 1));
// }
// builtinFunctionValues[functName] = functionContents;
// //cout << functName << " is \n" << Vec2Str(functionContents) << endl << endl;
// }
// else
// {
// if (words.at(lineNum).at(0) == "string")
// {
// builtinVarVals[words.at(lineNum).at(1)] = StringRaw(words.at(lineNum).at(3));
//#if DEVELOPER_MESSAGES == true
// InterpreterLog("Load builtin variable " + words.at(lineNum).at(1) + "...");
//#endif
// }
// else if (words.at(lineNum).at(0) == "int")
// {
// builtinVarVals[words.at(lineNum).at(1)] = stoi(words.at(lineNum).at(3));
//#if DEVELOPER_MESSAGES == true
// InterpreterLog("Load builtin variable " + words.at(lineNum).at(1) + "...");
//#endif
// }
// else if (words.at(lineNum).at(0) == "float")
// {
// builtinVarVals[words.at(lineNum).at(1)] = stof(words.at(lineNum).at(3));
//#if DEVELOPER_MESSAGES == true
// InterpreterLog("Load builtin variable " + words.at(lineNum).at(1) + "...");
//#endif
// }
// else if (words.at(lineNum).at(0) == "bool")
// {
// builtinVarVals[words.at(lineNum).at(1)] = stob(words.at(lineNum).at(3));
//#if DEVELOPER_MESSAGES == true
// InterpreterLog("Load builtin variable " + words.at(lineNum).at(1) + "...");
//#endif
// }
// //else
// // LogWarning("unrecognized type \'" + words[lineNum][0] + "\' on line: " + to_string(lineNum));
// }
// }
//
// return 0;
//}
// Executes
boost::any ZSFunction(const string& name, const vector<boost::any>& args)
{
if (name == "ZS.Math.Sin")
return sin(AnyAsFloat(args.at(0)));
else if (name == "ZS.Math.Cos")
return cos(AnyAsFloat(args.at(0)));
else if (name == "ZS.Math.Tan")
return tan(AnyAsFloat(args.at(0)));
else if (name == "ZS.Math.Round")
return AnyAsInt(args.at(0));
else if (name == "ZS.Math.Lerp")
return lerp(AnyAsFloat(args.at(0)), AnyAsFloat(args.at(1)), AnyAsFloat(args.at(2)));
else if (name == "ZS.Math.Abs")
return abs(AnyAsFloat(args.at(0)));
else if (name == "ZS.Graphics.Init")
{
#if DEVELOPER_MESSAGES == true
InterpreterLog("Init graphics");
#endif
if (args.size() <= 3)
initGraphics(StringRaw(AnyAsString(args.at(0))), AnyAsInt(args.at(1)), AnyAsInt(args.at(2)), 1);
else
initGraphics(StringRaw(AnyAsString(args.at(0))), AnyAsInt(args.at(1)), AnyAsInt(args.at(2)), AnyAsInt(args.at(3)));
}
else if (name == "ZS.Graphics.Sprite")
{
string path = StringRaw(AnyAsString(args.at(0)));
if (count(path, '/') == 0)
path = "./" + path;
if (!fileExists(path))
LogCriticalError("Failed to create 'Sprite' object: \"" + path + "\"");
Sprite s(StringRaw(AnyAsString(args.at(0))), any_cast<Vec2>(args.at(1)), any_cast<Vec2>(args.at(2)), AnyAsFloat(args.at(3)));
return s;
}
else if (name == "ZS.Graphics.DrawPixel")
{
SDL_SetRenderDrawColor(gRenderer, AnyAsInt(args.at(2)), AnyAsInt(args.at(3)), AnyAsInt(args.at(4)), 255);
SDL_RenderDrawPoint(gRenderer, AnyAsInt(args.at(0)), AnyAsInt(args.at(1)));
SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 0);
}
//DrawPixel(AnyAsInt(args.at(0)), AnyAsInt(args.at(1)), AnyAsInt(args.at(2)), AnyAsInt(args.at(3)), AnyAsInt(args.at(4)));
else if (name == "ZS.Graphics.Draw")
any_cast<Sprite>(args.at(0)).Draw();
else if (name == "ZS.Graphics.Load")
any_cast<Sprite>(args.at(0)).Load();
else if (name == "ZS.Graphics.Text")
{
string path = StringRaw(AnyAsString(args.at(1)));
if (count(path, '/') == 0)
path = "./" + path;
if (!fileExists(path))
LogCriticalError("Failed to create 'Text' object: \"" + path + "\"");
if (args.size() <= 8)
{
Text t(StringRaw(AnyAsString(args.at(0))), path, any_cast<Vec2>(args.at(2)), AnyAsFloat(args.at(3)), AnyAsFloat(args.at(4)), (Uint8)AnyAsFloat(args.at(5)), (Uint8)AnyAsFloat(args.at(6)), (Uint8)AnyAsFloat(args.at(7)), true);
return t;
}
else
{
Text t(StringRaw(AnyAsString(args.at(0))), path, any_cast<Vec2>(args.at(2)), AnyAsFloat(args.at(3)), AnyAsFloat(args.at(4)), (Uint8)AnyAsFloat(args.at(5)), (Uint8)AnyAsFloat(args.at(6)), (Uint8)AnyAsFloat(args.at(7)), AnyAsBool(args.at(8)));
return t;
}
}
else if (name == "ZS.Graphics.DrawText")
any_cast<Text>(args.at(0)).Draw();
else if (name == "ZS.Graphics.LoadText")
any_cast<Text>(args.at(0)).Load();
else if (name == "ZS.Physics.AxisAlignedCollision")
{
return AxisAlignedCollision(any_cast<Sprite>(args.at(0)), any_cast<Sprite>(args.at(1)));
}
else if (name == "ZS.Input.GetKey")
return KEYS[StringRaw(any_cast<string>(args.at(0)))] == 1;
else if (name == "ZS.System.Print")
cout << StringRaw(AnyAsString(args.at(0)));
else if (name == "ZS.System.PrintLine")
cout << StringRaw(AnyAsString(args.at(0))) << endl;
else if (name == "ZS.System.Vec2")
{
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.");
return nullType;
}
#endif

878
ZSharp/color.hpp Normal file
View File

@ -0,0 +1,878 @@
#ifndef COLOR_HPP
#define COLOR_HPP
#include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <string>
#include <type_traits>
#include <utility>
#include <windows.h>
namespace hue
{
constexpr int DEFAULT_COLOR = 7;
constexpr int BAD_COLOR = -256;
const std::map<std::string, int> CODES = {
{"black", 0}, {"k", 0},
{"blue", 1}, {"b", 1},
{"green", 2}, {"g", 2},
{"aqua", 3}, {"a", 3},
{"red", 4}, {"r", 4},
{"purple", 5}, {"p", 5},
{"yellow", 6}, {"y", 6},
{"white", 7}, {"w", 7},
{"grey", 8}, {"e", 8},
{"light blue", 9}, {"lb", 9},
{"light green", 10}, {"lg", 10},
{"light aqua", 11}, {"la", 11},
{"light red", 12}, {"lr", 12},
{"light purple", 13}, {"lp", 13},
{"light yellow", 14}, {"ly", 14},
{"bright white", 15}, {"bw", 15}
};
const std::map<int, std::string> NAMES = {
{ 0, "black"},
{ 1, "blue"},
{ 2, "green"},
{ 3, "aqua"},
{ 4, "red"},
{ 5, "purple"},
{ 6, "yellow"},
{ 7, "white"},
{ 8, "grey"},
{ 9, "light blue"},
{10, "light green"},
{11, "light aqua"},
{12, "light red"},
{13, "light purple"},
{14, "light yellow"},
{15, "bright white"}
};
inline bool is_good(int c)
{
return 0 <= c && c < 256;
}
inline int itoc(int c)
{
return is_good(c) ? c : BAD_COLOR;
}
inline int itoc(int a, int b)
{
return itoc(a + b * 16);
}
// std::string to color
int stoc(std::string a)
{
// convert s to lowercase, and format variants like "light_blue"
std::transform(a.begin(), a.end(), a.begin(), [](char c)
{
if ('A' <= c && c <= 'Z')
c = c - 'A' + 'a';
else if (c == '_' || c == '-')
c = ' ';
return c;
});
// operator[] on std::map is non-const, use std::map::at instead
return (CODES.find(a) != CODES.end()) ? CODES.at(a) : BAD_COLOR;
}
int stoc(std::string a, std::string b)
{
return itoc(stoc(a), stoc(b));
}
std::string ctos(int c)
{
return (0 <= c && c < 256) ?
"(text) " + NAMES.at(c % 16) + " + " +
"(background) " + NAMES.at(c / 16) :
"BAD COLOR";
}
int get()
{
CONSOLE_SCREEN_BUFFER_INFO i;
return GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &i) ?
i.wAttributes : BAD_COLOR;
}
int get_text()
{
return (get() != BAD_COLOR) ? get() % 16 : BAD_COLOR;
}
int get_background()
{
return (get() != BAD_COLOR) ? get() / 16 : BAD_COLOR;
}
void set(int c)
{
if (is_good(c))
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), c);
}
void set(int a, int b)
{
set(a + b * 16);
}
void set(std::string a, std::string b)
{
set(stoc(a) + stoc(b) * 16);
}
void set_text(std::string a)
{
set(stoc(a), get_background());
}
void set_background(std::string b)
{
set(get_text(), stoc(b));
}
void reset()
{
set(DEFAULT_COLOR);
}
int invert(int c)
{
if (is_good(c)) {
int a = c % 16;
int b = c / 16;
return b + a * 16;
}
else
return BAD_COLOR;
}
std::ostream& reset(std::ostream& os) { reset(); return os; }
std::ostream& black(std::ostream& os) { set_text("k"); return os; }
std::ostream& blue(std::ostream& os) { set_text("b"); return os; }
std::ostream& green(std::ostream& os) { set_text("g"); return os; }
std::ostream& aqua(std::ostream& os) { set_text("a"); return os; }
std::ostream& red(std::ostream& os) { set_text("r"); return os; }
std::ostream& purple(std::ostream& os) { set_text("p"); return os; }
std::ostream& yellow(std::ostream& os) { set_text("y"); return os; }
std::ostream& white(std::ostream& os) { set_text("w"); return os; }
std::ostream& grey(std::ostream& os) { set_text("e"); return os; }
std::ostream& light_blue(std::ostream& os) { set_text("lb"); return os; }
std::ostream& light_green(std::ostream& os) { set_text("lg"); return os; }
std::ostream& light_aqua(std::ostream& os) { set_text("la"); return os; }
std::ostream& light_red(std::ostream& os) { set_text("lr"); return os; }
std::ostream& light_purple(std::ostream& os) { set_text("lp"); return os; }
std::ostream& light_yellow(std::ostream& os) { set_text("ly"); return os; }
std::ostream& bright_white(std::ostream& os) { set_text("bw"); return os; }
std::ostream& on_black(std::ostream& os) { set_background("k"); return os; }
std::ostream& on_blue(std::ostream& os) { set_background("b"); return os; }
std::ostream& on_green(std::ostream& os) { set_background("g"); return os; }
std::ostream& on_aqua(std::ostream& os) { set_background("a"); return os; }
std::ostream& on_red(std::ostream& os) { set_background("r"); return os; }
std::ostream& on_purple(std::ostream& os) { set_background("p"); return os; }
std::ostream& on_yellow(std::ostream& os) { set_background("y"); return os; }
std::ostream& on_white(std::ostream& os) { set_background("w"); return os; }
std::ostream& on_grey(std::ostream& os) { set_background("e"); return os; }
std::ostream& on_light_blue(std::ostream& os) { set_background("lb"); return os; }
std::ostream& on_light_green(std::ostream& os) { set_background("lg"); return os; }
std::ostream& on_light_aqua(std::ostream& os) { set_background("la"); return os; }
std::ostream& on_light_red(std::ostream& os) { set_background("lr"); return os; }
std::ostream& on_light_purple(std::ostream& os) { set_background("lp"); return os; }
std::ostream& on_light_yellow(std::ostream& os) { set_background("ly"); return os; }
std::ostream& on_bright_white(std::ostream& os) { set_background("bw"); return os; }
std::ostream& black_on_black(std::ostream& os) { set("k", "k"); return os; }
std::ostream& black_on_blue(std::ostream& os) { set("k", "b"); return os; }
std::ostream& black_on_green(std::ostream& os) { set("k", "g"); return os; }
std::ostream& black_on_aqua(std::ostream& os) { set("k", "a"); return os; }
std::ostream& black_on_red(std::ostream& os) { set("k", "r"); return os; }
std::ostream& black_on_purple(std::ostream& os) { set("k", "p"); return os; }
std::ostream& black_on_yellow(std::ostream& os) { set("k", "y"); return os; }
std::ostream& black_on_white(std::ostream& os) { set("k", "w"); return os; }
std::ostream& black_on_grey(std::ostream& os) { set("k", "e"); return os; }
std::ostream& black_on_light_blue(std::ostream& os) { set("k", "lb"); return os; }
std::ostream& black_on_light_green(std::ostream& os) { set("k", "lg"); return os; }
std::ostream& black_on_light_aqua(std::ostream& os) { set("k", "la"); return os; }
std::ostream& black_on_light_red(std::ostream& os) { set("k", "lr"); return os; }
std::ostream& black_on_light_purple(std::ostream& os) { set("k", "lp"); return os; }
std::ostream& black_on_light_yellow(std::ostream& os) { set("k", "ly"); return os; }
std::ostream& black_on_bright_white(std::ostream& os) { set("k", "bw"); return os; }
std::ostream& blue_on_black(std::ostream& os) { set("b", "k"); return os; }
std::ostream& blue_on_blue(std::ostream& os) { set("b", "b"); return os; }
std::ostream& blue_on_green(std::ostream& os) { set("b", "g"); return os; }
std::ostream& blue_on_aqua(std::ostream& os) { set("b", "a"); return os; }
std::ostream& blue_on_red(std::ostream& os) { set("b", "r"); return os; }
std::ostream& blue_on_purple(std::ostream& os) { set("b", "p"); return os; }
std::ostream& blue_on_yellow(std::ostream& os) { set("b", "y"); return os; }
std::ostream& blue_on_white(std::ostream& os) { set("b", "w"); return os; }
std::ostream& blue_on_grey(std::ostream& os) { set("b", "e"); return os; }
std::ostream& blue_on_light_blue(std::ostream& os) { set("b", "lb"); return os; }
std::ostream& blue_on_light_green(std::ostream& os) { set("b", "lg"); return os; }
std::ostream& blue_on_light_aqua(std::ostream& os) { set("b", "la"); return os; }
std::ostream& blue_on_light_red(std::ostream& os) { set("b", "lr"); return os; }
std::ostream& blue_on_light_purple(std::ostream& os) { set("b", "lp"); return os; }
std::ostream& blue_on_light_yellow(std::ostream& os) { set("b", "ly"); return os; }
std::ostream& blue_on_bright_white(std::ostream& os) { set("b", "bw"); return os; }
std::ostream& green_on_black(std::ostream& os) { set("g", "k"); return os; }
std::ostream& green_on_blue(std::ostream& os) { set("g", "b"); return os; }
std::ostream& green_on_green(std::ostream& os) { set("g", "g"); return os; }
std::ostream& green_on_aqua(std::ostream& os) { set("g", "a"); return os; }
std::ostream& green_on_red(std::ostream& os) { set("g", "r"); return os; }
std::ostream& green_on_purple(std::ostream& os) { set("g", "p"); return os; }
std::ostream& green_on_yellow(std::ostream& os) { set("g", "y"); return os; }
std::ostream& green_on_white(std::ostream& os) { set("g", "w"); return os; }
std::ostream& green_on_grey(std::ostream& os) { set("g", "e"); return os; }
std::ostream& green_on_light_blue(std::ostream& os) { set("g", "lb"); return os; }
std::ostream& green_on_light_green(std::ostream& os) { set("g", "lg"); return os; }
std::ostream& green_on_light_aqua(std::ostream& os) { set("g", "la"); return os; }
std::ostream& green_on_light_red(std::ostream& os) { set("g", "lr"); return os; }
std::ostream& green_on_light_purple(std::ostream& os) { set("g", "lp"); return os; }
std::ostream& green_on_light_yellow(std::ostream& os) { set("g", "ly"); return os; }
std::ostream& green_on_bright_white(std::ostream& os) { set("g", "bw"); return os; }
std::ostream& aqua_on_black(std::ostream& os) { set("a", "k"); return os; }
std::ostream& aqua_on_blue(std::ostream& os) { set("a", "b"); return os; }
std::ostream& aqua_on_green(std::ostream& os) { set("a", "g"); return os; }
std::ostream& aqua_on_aqua(std::ostream& os) { set("a", "a"); return os; }
std::ostream& aqua_on_red(std::ostream& os) { set("a", "r"); return os; }
std::ostream& aqua_on_purple(std::ostream& os) { set("a", "p"); return os; }
std::ostream& aqua_on_yellow(std::ostream& os) { set("a", "y"); return os; }
std::ostream& aqua_on_white(std::ostream& os) { set("a", "w"); return os; }
std::ostream& aqua_on_grey(std::ostream& os) { set("a", "e"); return os; }
std::ostream& aqua_on_light_blue(std::ostream& os) { set("a", "lb"); return os; }
std::ostream& aqua_on_light_green(std::ostream& os) { set("a", "lg"); return os; }
std::ostream& aqua_on_light_aqua(std::ostream& os) { set("a", "la"); return os; }
std::ostream& aqua_on_light_red(std::ostream& os) { set("a", "lr"); return os; }
std::ostream& aqua_on_light_purple(std::ostream& os) { set("a", "lp"); return os; }
std::ostream& aqua_on_light_yellow(std::ostream& os) { set("a", "ly"); return os; }
std::ostream& aqua_on_bright_white(std::ostream& os) { set("a", "bw"); return os; }
std::ostream& red_on_black(std::ostream& os) { set("r", "k"); return os; }
std::ostream& red_on_blue(std::ostream& os) { set("r", "b"); return os; }
std::ostream& red_on_green(std::ostream& os) { set("r", "g"); return os; }
std::ostream& red_on_aqua(std::ostream& os) { set("r", "a"); return os; }
std::ostream& red_on_red(std::ostream& os) { set("r", "r"); return os; }
std::ostream& red_on_purple(std::ostream& os) { set("r", "p"); return os; }
std::ostream& red_on_yellow(std::ostream& os) { set("r", "y"); return os; }
std::ostream& red_on_white(std::ostream& os) { set("r", "w"); return os; }
std::ostream& red_on_grey(std::ostream& os) { set("r", "e"); return os; }
std::ostream& red_on_light_blue(std::ostream& os) { set("r", "lb"); return os; }
std::ostream& red_on_light_green(std::ostream& os) { set("r", "lg"); return os; }
std::ostream& red_on_light_aqua(std::ostream& os) { set("r", "la"); return os; }
std::ostream& red_on_light_red(std::ostream& os) { set("r", "lr"); return os; }
std::ostream& red_on_light_purple(std::ostream& os) { set("r", "lp"); return os; }
std::ostream& red_on_light_yellow(std::ostream& os) { set("r", "ly"); return os; }
std::ostream& red_on_bright_white(std::ostream& os) { set("r", "bw"); return os; }
std::ostream& purple_on_black(std::ostream& os) { set("p", "k"); return os; }
std::ostream& purple_on_blue(std::ostream& os) { set("p", "b"); return os; }
std::ostream& purple_on_green(std::ostream& os) { set("p", "g"); return os; }
std::ostream& purple_on_aqua(std::ostream& os) { set("p", "a"); return os; }
std::ostream& purple_on_red(std::ostream& os) { set("p", "r"); return os; }
std::ostream& purple_on_purple(std::ostream& os) { set("p", "p"); return os; }
std::ostream& purple_on_yellow(std::ostream& os) { set("p", "y"); return os; }
std::ostream& purple_on_white(std::ostream& os) { set("p", "w"); return os; }
std::ostream& purple_on_grey(std::ostream& os) { set("p", "e"); return os; }
std::ostream& purple_on_light_blue(std::ostream& os) { set("p", "lb"); return os; }
std::ostream& purple_on_light_green(std::ostream& os) { set("p", "lg"); return os; }
std::ostream& purple_on_light_aqua(std::ostream& os) { set("p", "la"); return os; }
std::ostream& purple_on_light_red(std::ostream& os) { set("p", "lr"); return os; }
std::ostream& purple_on_light_purple(std::ostream& os) { set("p", "lp"); return os; }
std::ostream& purple_on_light_yellow(std::ostream& os) { set("p", "ly"); return os; }
std::ostream& purple_on_bright_white(std::ostream& os) { set("p", "bw"); return os; }
std::ostream& yellow_on_black(std::ostream& os) { set("y", "k"); return os; }
std::ostream& yellow_on_blue(std::ostream& os) { set("y", "b"); return os; }
std::ostream& yellow_on_green(std::ostream& os) { set("y", "g"); return os; }
std::ostream& yellow_on_aqua(std::ostream& os) { set("y", "a"); return os; }
std::ostream& yellow_on_red(std::ostream& os) { set("y", "r"); return os; }
std::ostream& yellow_on_purple(std::ostream& os) { set("y", "p"); return os; }
std::ostream& yellow_on_yellow(std::ostream& os) { set("y", "y"); return os; }
std::ostream& yellow_on_white(std::ostream& os) { set("y", "w"); return os; }
std::ostream& yellow_on_grey(std::ostream& os) { set("y", "e"); return os; }
std::ostream& yellow_on_light_blue(std::ostream& os) { set("y", "lb"); return os; }
std::ostream& yellow_on_light_green(std::ostream& os) { set("y", "lg"); return os; }
std::ostream& yellow_on_light_aqua(std::ostream& os) { set("y", "la"); return os; }
std::ostream& yellow_on_light_red(std::ostream& os) { set("y", "lr"); return os; }
std::ostream& yellow_on_light_purple(std::ostream& os) { set("y", "lp"); return os; }
std::ostream& yellow_on_light_yellow(std::ostream& os) { set("y", "ly"); return os; }
std::ostream& yellow_on_bright_white(std::ostream& os) { set("y", "bw"); return os; }
std::ostream& white_on_black(std::ostream& os) { set("w", "k"); return os; }
std::ostream& white_on_blue(std::ostream& os) { set("w", "b"); return os; }
std::ostream& white_on_green(std::ostream& os) { set("w", "g"); return os; }
std::ostream& white_on_aqua(std::ostream& os) { set("w", "a"); return os; }
std::ostream& white_on_red(std::ostream& os) { set("w", "r"); return os; }
std::ostream& white_on_purple(std::ostream& os) { set("w", "p"); return os; }
std::ostream& white_on_yellow(std::ostream& os) { set("w", "y"); return os; }
std::ostream& white_on_white(std::ostream& os) { set("w", "w"); return os; }
std::ostream& white_on_grey(std::ostream& os) { set("w", "e"); return os; }
std::ostream& white_on_light_blue(std::ostream& os) { set("w", "lb"); return os; }
std::ostream& white_on_light_green(std::ostream& os) { set("w", "lg"); return os; }
std::ostream& white_on_light_aqua(std::ostream& os) { set("w", "la"); return os; }
std::ostream& white_on_light_red(std::ostream& os) { set("w", "lr"); return os; }
std::ostream& white_on_light_purple(std::ostream& os) { set("w", "lp"); return os; }
std::ostream& white_on_light_yellow(std::ostream& os) { set("w", "ly"); return os; }
std::ostream& white_on_bright_white(std::ostream& os) { set("w", "bw"); return os; }
std::ostream& grey_on_black(std::ostream& os) { set("e", "k"); return os; }
std::ostream& grey_on_blue(std::ostream& os) { set("e", "b"); return os; }
std::ostream& grey_on_green(std::ostream& os) { set("e", "g"); return os; }
std::ostream& grey_on_aqua(std::ostream& os) { set("e", "a"); return os; }
std::ostream& grey_on_red(std::ostream& os) { set("e", "r"); return os; }
std::ostream& grey_on_purple(std::ostream& os) { set("e", "p"); return os; }
std::ostream& grey_on_yellow(std::ostream& os) { set("e", "y"); return os; }
std::ostream& grey_on_white(std::ostream& os) { set("e", "w"); return os; }
std::ostream& grey_on_grey(std::ostream& os) { set("e", "e"); return os; }
std::ostream& grey_on_light_blue(std::ostream& os) { set("e", "lb"); return os; }
std::ostream& grey_on_light_green(std::ostream& os) { set("e", "lg"); return os; }
std::ostream& grey_on_light_aqua(std::ostream& os) { set("e", "la"); return os; }
std::ostream& grey_on_light_red(std::ostream& os) { set("e", "lr"); return os; }
std::ostream& grey_on_light_purple(std::ostream& os) { set("e", "lp"); return os; }
std::ostream& grey_on_light_yellow(std::ostream& os) { set("e", "ly"); return os; }
std::ostream& grey_on_bright_white(std::ostream& os) { set("e", "bw"); return os; }
std::ostream& light_blue_on_black(std::ostream& os) { set("lb", "k"); return os; }
std::ostream& light_blue_on_blue(std::ostream& os) { set("lb", "b"); return os; }
std::ostream& light_blue_on_green(std::ostream& os) { set("lb", "g"); return os; }
std::ostream& light_blue_on_aqua(std::ostream& os) { set("lb", "a"); return os; }
std::ostream& light_blue_on_red(std::ostream& os) { set("lb", "r"); return os; }
std::ostream& light_blue_on_purple(std::ostream& os) { set("lb", "p"); return os; }
std::ostream& light_blue_on_yellow(std::ostream& os) { set("lb", "y"); return os; }
std::ostream& light_blue_on_white(std::ostream& os) { set("lb", "w"); return os; }
std::ostream& light_blue_on_grey(std::ostream& os) { set("lb", "e"); return os; }
std::ostream& light_blue_on_light_blue(std::ostream& os) { set("lb", "lb"); return os; }
std::ostream& light_blue_on_light_green(std::ostream& os) { set("lb", "lg"); return os; }
std::ostream& light_blue_on_light_aqua(std::ostream& os) { set("lb", "la"); return os; }
std::ostream& light_blue_on_light_red(std::ostream& os) { set("lb", "lr"); return os; }
std::ostream& light_blue_on_light_purple(std::ostream& os) { set("lb", "lp"); return os; }
std::ostream& light_blue_on_light_yellow(std::ostream& os) { set("lb", "ly"); return os; }
std::ostream& light_blue_on_bright_white(std::ostream& os) { set("lb", "bw"); return os; }
std::ostream& light_green_on_black(std::ostream& os) { set("lg", "k"); return os; }
std::ostream& light_green_on_blue(std::ostream& os) { set("lg", "b"); return os; }
std::ostream& light_green_on_green(std::ostream& os) { set("lg", "g"); return os; }
std::ostream& light_green_on_aqua(std::ostream& os) { set("lg", "a"); return os; }
std::ostream& light_green_on_red(std::ostream& os) { set("lg", "r"); return os; }
std::ostream& light_green_on_purple(std::ostream& os) { set("lg", "p"); return os; }
std::ostream& light_green_on_yellow(std::ostream& os) { set("lg", "y"); return os; }
std::ostream& light_green_on_white(std::ostream& os) { set("lg", "w"); return os; }
std::ostream& light_green_on_grey(std::ostream& os) { set("lg", "e"); return os; }
std::ostream& light_green_on_light_blue(std::ostream& os) { set("lg", "lb"); return os; }
std::ostream& light_green_on_light_green(std::ostream& os) { set("lg", "lg"); return os; }
std::ostream& light_green_on_light_aqua(std::ostream& os) { set("lg", "la"); return os; }
std::ostream& light_green_on_light_red(std::ostream& os) { set("lg", "lr"); return os; }
std::ostream& light_green_on_light_purple(std::ostream& os) { set("lg", "lp"); return os; }
std::ostream& light_green_on_light_yellow(std::ostream& os) { set("lg", "ly"); return os; }
std::ostream& light_green_on_bright_white(std::ostream& os) { set("lg", "bw"); return os; }
std::ostream& light_aqua_on_black(std::ostream& os) { set("la", "k"); return os; }
std::ostream& light_aqua_on_blue(std::ostream& os) { set("la", "b"); return os; }
std::ostream& light_aqua_on_green(std::ostream& os) { set("la", "g"); return os; }
std::ostream& light_aqua_on_aqua(std::ostream& os) { set("la", "a"); return os; }
std::ostream& light_aqua_on_red(std::ostream& os) { set("la", "r"); return os; }
std::ostream& light_aqua_on_purple(std::ostream& os) { set("la", "p"); return os; }
std::ostream& light_aqua_on_yellow(std::ostream& os) { set("la", "y"); return os; }
std::ostream& light_aqua_on_white(std::ostream& os) { set("la", "w"); return os; }
std::ostream& light_aqua_on_grey(std::ostream& os) { set("la", "e"); return os; }
std::ostream& light_aqua_on_light_blue(std::ostream& os) { set("la", "lb"); return os; }
std::ostream& light_aqua_on_light_green(std::ostream& os) { set("la", "lg"); return os; }
std::ostream& light_aqua_on_light_aqua(std::ostream& os) { set("la", "la"); return os; }
std::ostream& light_aqua_on_light_red(std::ostream& os) { set("la", "lr"); return os; }
std::ostream& light_aqua_on_light_purple(std::ostream& os) { set("la", "lp"); return os; }
std::ostream& light_aqua_on_light_yellow(std::ostream& os) { set("la", "ly"); return os; }
std::ostream& light_aqua_on_bright_white(std::ostream& os) { set("la", "bw"); return os; }
std::ostream& light_red_on_black(std::ostream& os) { set("lr", "k"); return os; }
std::ostream& light_red_on_blue(std::ostream& os) { set("lr", "b"); return os; }
std::ostream& light_red_on_green(std::ostream& os) { set("lr", "g"); return os; }
std::ostream& light_red_on_aqua(std::ostream& os) { set("lr", "a"); return os; }
std::ostream& light_red_on_red(std::ostream& os) { set("lr", "r"); return os; }
std::ostream& light_red_on_purple(std::ostream& os) { set("lr", "p"); return os; }
std::ostream& light_red_on_yellow(std::ostream& os) { set("lr", "y"); return os; }
std::ostream& light_red_on_white(std::ostream& os) { set("lr", "w"); return os; }
std::ostream& light_red_on_grey(std::ostream& os) { set("lr", "e"); return os; }
std::ostream& light_red_on_light_blue(std::ostream& os) { set("lr", "lb"); return os; }
std::ostream& light_red_on_light_green(std::ostream& os) { set("lr", "lg"); return os; }
std::ostream& light_red_on_light_aqua(std::ostream& os) { set("lr", "la"); return os; }
std::ostream& light_red_on_light_red(std::ostream& os) { set("lr", "lr"); return os; }
std::ostream& light_red_on_light_purple(std::ostream& os) { set("lr", "lp"); return os; }
std::ostream& light_red_on_light_yellow(std::ostream& os) { set("lr", "ly"); return os; }
std::ostream& light_red_on_bright_white(std::ostream& os) { set("lr", "bw"); return os; }
std::ostream& light_purple_on_black(std::ostream& os) { set("lp", "k"); return os; }
std::ostream& light_purple_on_blue(std::ostream& os) { set("lp", "b"); return os; }
std::ostream& light_purple_on_green(std::ostream& os) { set("lp", "g"); return os; }
std::ostream& light_purple_on_aqua(std::ostream& os) { set("lp", "a"); return os; }
std::ostream& light_purple_on_red(std::ostream& os) { set("lp", "r"); return os; }
std::ostream& light_purple_on_purple(std::ostream& os) { set("lp", "p"); return os; }
std::ostream& light_purple_on_yellow(std::ostream& os) { set("lp", "y"); return os; }
std::ostream& light_purple_on_white(std::ostream& os) { set("lp", "w"); return os; }
std::ostream& light_purple_on_grey(std::ostream& os) { set("lp", "e"); return os; }
std::ostream& light_purple_on_light_blue(std::ostream& os) { set("lp", "lb"); return os; }
std::ostream& light_purple_on_light_green(std::ostream& os) { set("lp", "lg"); return os; }
std::ostream& light_purple_on_light_aqua(std::ostream& os) { set("lp", "la"); return os; }
std::ostream& light_purple_on_light_red(std::ostream& os) { set("lp", "lr"); return os; }
std::ostream& light_purple_on_light_purple(std::ostream& os) { set("lp", "lp"); return os; }
std::ostream& light_purple_on_light_yellow(std::ostream& os) { set("lp", "ly"); return os; }
std::ostream& light_purple_on_bright_white(std::ostream& os) { set("lp", "bw"); return os; }
std::ostream& light_yellow_on_black(std::ostream& os) { set("ly", "k"); return os; }
std::ostream& light_yellow_on_blue(std::ostream& os) { set("ly", "b"); return os; }
std::ostream& light_yellow_on_green(std::ostream& os) { set("ly", "g"); return os; }
std::ostream& light_yellow_on_aqua(std::ostream& os) { set("ly", "a"); return os; }
std::ostream& light_yellow_on_red(std::ostream& os) { set("ly", "r"); return os; }
std::ostream& light_yellow_on_purple(std::ostream& os) { set("ly", "p"); return os; }
std::ostream& light_yellow_on_yellow(std::ostream& os) { set("ly", "y"); return os; }
std::ostream& light_yellow_on_white(std::ostream& os) { set("ly", "w"); return os; }
std::ostream& light_yellow_on_grey(std::ostream& os) { set("ly", "e"); return os; }
std::ostream& light_yellow_on_light_blue(std::ostream& os) { set("ly", "lb"); return os; }
std::ostream& light_yellow_on_light_green(std::ostream& os) { set("ly", "lg"); return os; }
std::ostream& light_yellow_on_light_aqua(std::ostream& os) { set("ly", "la"); return os; }
std::ostream& light_yellow_on_light_red(std::ostream& os) { set("ly", "lr"); return os; }
std::ostream& light_yellow_on_light_purple(std::ostream& os) { set("ly", "lp"); return os; }
std::ostream& light_yellow_on_light_yellow(std::ostream& os) { set("ly", "ly"); return os; }
std::ostream& light_yellow_on_bright_white(std::ostream& os) { set("ly", "bw"); return os; }
std::ostream& bright_white_on_black(std::ostream& os) { set("bw", "k"); return os; }
std::ostream& bright_white_on_blue(std::ostream& os) { set("bw", "b"); return os; }
std::ostream& bright_white_on_green(std::ostream& os) { set("bw", "g"); return os; }
std::ostream& bright_white_on_aqua(std::ostream& os) { set("bw", "a"); return os; }
std::ostream& bright_white_on_red(std::ostream& os) { set("bw", "r"); return os; }
std::ostream& bright_white_on_purple(std::ostream& os) { set("bw", "p"); return os; }
std::ostream& bright_white_on_yellow(std::ostream& os) { set("bw", "y"); return os; }
std::ostream& bright_white_on_white(std::ostream& os) { set("bw", "w"); return os; }
std::ostream& bright_white_on_grey(std::ostream& os) { set("bw", "e"); return os; }
std::ostream& bright_white_on_light_blue(std::ostream& os) { set("bw", "lb"); return os; }
std::ostream& bright_white_on_light_green(std::ostream& os) { set("bw", "lg"); return os; }
std::ostream& bright_white_on_light_aqua(std::ostream& os) { set("bw", "la"); return os; }
std::ostream& bright_white_on_light_red(std::ostream& os) { set("bw", "lr"); return os; }
std::ostream& bright_white_on_light_purple(std::ostream& os) { set("bw", "lp"); return os; }
std::ostream& bright_white_on_light_yellow(std::ostream& os) { set("bw", "ly"); return os; }
std::ostream& bright_white_on_bright_white(std::ostream& os) { set("bw", "bw"); return os; }
}
namespace dye
{
template<typename T>
using bar = typename std::conditional<std::is_same<T, const char*>::value, std::string, T>::type;
template<typename T> class colorful;
template<typename T> class item;
template<typename T>
class colorful : private std::list<item<T>>
{
public:
using std::list<item<T>>::list;
colorful<T>& operator+=(const colorful<T>& rhs)
{
this->insert(this->end(), rhs.begin(), rhs.end());
return *this;
}
colorful<T>& operator+=(colorful<T>&& rhs)
{
this->splice(this->end(), std::move(rhs));
return *this;
}
colorful<T>& operator+=(T t)
{
this->push_back(std::move(t));
return *this;
}
void push_front(T t)
{
this->std::list<item<T>>::push_front(item<T>(std::move(t)));
}
void push_back(T t)
{
this->std::list<item<T>>::push_back(item<T>(std::move(t)));
}
colorful<T>& invert()
{
for (auto& elem : *this)
elem.invert();
return *this;
}
template<typename U>
friend std::ostream& operator<<(std::ostream&, const colorful<U>&);
template<typename U>
friend colorful<U> invert(colorful<U> col);
};
template<typename T>
colorful<T> operator+(colorful<T> lhs, colorful<T> rhs)
{
colorful<T> res(std::move(lhs));
return res += rhs;
}
template<typename T>
colorful<T> operator+(colorful<T> lhs, std::string rhs)
{
colorful<T> res(std::move(lhs));
res.push_back(std::move(rhs));
return res;
}
template<typename T>
colorful<T> operator+(const std::string& lhs, colorful<T> rhs)
{
colorful<T> res(std::move(rhs));
res.push_front(std::move(lhs));
return res;
}
template<typename T>
std::ostream& operator<<(std::ostream& os, const colorful<T>& colorful)
{
for (const auto& elem : colorful)
os << elem;
return os;
}
template<typename T>
colorful<T> invert(colorful<T> col)
{
colorful<T> res(std::move(col));
for (auto& elem : res)
elem.invert();
return res;
}
template<typename T>
class item
{
T thing;
int color;
public:
item(T t) : thing(std::move(t)), color(hue::get()) {}
item(T t, int a) : thing(std::move(t)), color(hue::itoc(a)) {}
item(T t, int a, int b) : thing(std::move(t)), color(hue::itoc(a, b)) {}
item(T t, std::string a) : thing(std::move(t)), color(hue::stoc(a)) {}
item(T t, std::string a, std::string b) : thing(std::move(t)), color(hue::stoc(a, b)) {}
item<T>& invert()
{
color = hue::invert(color);
return *this;
}
template<typename U>
friend class colorful;
template<typename U>
friend std::ostream& operator<<(std::ostream&, const item<U>&);
};
template<typename T>
std::ostream& operator<<(std::ostream& os, const item<T>& it)
{
hue::set(it.color);
os << it.thing;
hue::reset();
return os;
}
template<typename T> using R = colorful<bar<T>>;
template<typename T> using S = item<bar<T>>;
template<typename T> R<T> colorize(T t, std::string a) { return R<T> { S<T>(t, a) }; }
template<typename T> R<T> vanilla(T t) { return R<T> { S<T>(t) }; }
template<typename T> R<T> black(T t) { return R<T> { S<T>(t, "k") }; }
template<typename T> R<T> blue(T t) { return R<T> { S<T>(t, "b") }; }
template<typename T> R<T> green(T t) { return R<T> { S<T>(t, "g") }; }
template<typename T> R<T> aqua(T t) { return R<T> { S<T>(t, "a") }; }
template<typename T> R<T> red(T t) { return R<T> { S<T>(t, "r") }; }
template<typename T> R<T> purple(T t) { return R<T> { S<T>(t, "p") }; }
template<typename T> R<T> yellow(T t) { return R<T> { S<T>(t, "y") }; }
template<typename T> R<T> white(T t) { return R<T> { S<T>(t, "w") }; }
template<typename T> R<T> grey(T t) { return R<T> { S<T>(t, "e") }; }
template<typename T> R<T> light_blue(T t) { return R<T> { S<T>(t, "lb") }; }
template<typename T> R<T> light_green(T t) { return R<T> { S<T>(t, "lg") }; }
template<typename T> R<T> light_aqua(T t) { return R<T> { S<T>(t, "la") }; }
template<typename T> R<T> light_red(T t) { return R<T> { S<T>(t, "lr") }; }
template<typename T> R<T> light_purple(T t) { return R<T> { S<T>(t, "lp") }; }
template<typename T> R<T> light_yellow(T t) { return R<T> { S<T>(t, "ly") }; }
template<typename T> R<T> bright_white(T t) { return R<T> { S<T>(t, "bw") }; }
template<typename T> R<T> on_black(T t) { return R<T> { S<T>(t, "k", "k") }; }
template<typename T> R<T> on_blue(T t) { return R<T> { S<T>(t, "k", "b") }; }
template<typename T> R<T> on_green(T t) { return R<T> { S<T>(t, "k", "g") }; }
template<typename T> R<T> on_aqua(T t) { return R<T> { S<T>(t, "k", "a") }; }
template<typename T> R<T> on_red(T t) { return R<T> { S<T>(t, "k", "r") }; }
template<typename T> R<T> on_purple(T t) { return R<T> { S<T>(t, "k", "p") }; }
template<typename T> R<T> on_yellow(T t) { return R<T> { S<T>(t, "k", "y") }; }
template<typename T> R<T> on_white(T t) { return R<T> { S<T>(t, "k", "w") }; }
template<typename T> R<T> on_grey(T t) { return R<T> { S<T>(t, "k", "e") }; }
template<typename T> R<T> on_light_blue(T t) { return R<T> { S<T>(t, "k", "lb") }; }
template<typename T> R<T> on_light_green(T t) { return R<T> { S<T>(t, "k", "lg") }; }
template<typename T> R<T> on_light_aqua(T t) { return R<T> { S<T>(t, "k", "la") }; }
template<typename T> R<T> on_light_red(T t) { return R<T> { S<T>(t, "k", "lr") }; }
template<typename T> R<T> on_light_purple(T t) { return R<T> { S<T>(t, "k", "lp") }; }
template<typename T> R<T> on_light_yellow(T t) { return R<T> { S<T>(t, "k", "ly") }; }
template<typename T> R<T> on_bright_white(T t) { return R<T> { S<T>(t, "k", "bw") }; }
template<typename T> R<T> black_on_black(T t) { return R<T> { S<T>(t, "k", "k") }; }
template<typename T> R<T> black_on_blue(T t) { return R<T> { S<T>(t, "k", "b") }; }
template<typename T> R<T> black_on_green(T t) { return R<T> { S<T>(t, "k", "g") }; }
template<typename T> R<T> black_on_aqua(T t) { return R<T> { S<T>(t, "k", "a") }; }
template<typename T> R<T> black_on_red(T t) { return R<T> { S<T>(t, "k", "r") }; }
template<typename T> R<T> black_on_purple(T t) { return R<T> { S<T>(t, "k", "p") }; }
template<typename T> R<T> black_on_yellow(T t) { return R<T> { S<T>(t, "k", "y") }; }
template<typename T> R<T> black_on_white(T t) { return R<T> { S<T>(t, "k", "w") }; }
template<typename T> R<T> black_on_grey(T t) { return R<T> { S<T>(t, "k", "e") }; }
template<typename T> R<T> black_on_light_blue(T t) { return R<T> { S<T>(t, "k", "lb") }; }
template<typename T> R<T> black_on_light_green(T t) { return R<T> { S<T>(t, "k", "lg") }; }
template<typename T> R<T> black_on_light_aqua(T t) { return R<T> { S<T>(t, "k", "la") }; }
template<typename T> R<T> black_on_light_red(T t) { return R<T> { S<T>(t, "k", "lr") }; }
template<typename T> R<T> black_on_light_purple(T t) { return R<T> { S<T>(t, "k", "lp") }; }
template<typename T> R<T> black_on_light_yellow(T t) { return R<T> { S<T>(t, "k", "ly") }; }
template<typename T> R<T> black_on_bright_white(T t) { return R<T> { S<T>(t, "k", "bw") }; }
template<typename T> R<T> blue_on_black(T t) { return R<T> { S<T>(t, "b", "k") }; }
template<typename T> R<T> blue_on_blue(T t) { return R<T> { S<T>(t, "b", "b") }; }
template<typename T> R<T> blue_on_green(T t) { return R<T> { S<T>(t, "b", "g") }; }
template<typename T> R<T> blue_on_aqua(T t) { return R<T> { S<T>(t, "b", "a") }; }
template<typename T> R<T> blue_on_red(T t) { return R<T> { S<T>(t, "b", "r") }; }
template<typename T> R<T> blue_on_purple(T t) { return R<T> { S<T>(t, "b", "p") }; }
template<typename T> R<T> blue_on_yellow(T t) { return R<T> { S<T>(t, "b", "y") }; }
template<typename T> R<T> blue_on_white(T t) { return R<T> { S<T>(t, "b", "w") }; }
template<typename T> R<T> blue_on_grey(T t) { return R<T> { S<T>(t, "b", "e") }; }
template<typename T> R<T> blue_on_light_blue(T t) { return R<T> { S<T>(t, "b", "lb") }; }
template<typename T> R<T> blue_on_light_green(T t) { return R<T> { S<T>(t, "b", "lg") }; }
template<typename T> R<T> blue_on_light_aqua(T t) { return R<T> { S<T>(t, "b", "la") }; }
template<typename T> R<T> blue_on_light_red(T t) { return R<T> { S<T>(t, "b", "lr") }; }
template<typename T> R<T> blue_on_light_purple(T t) { return R<T> { S<T>(t, "b", "lp") }; }
template<typename T> R<T> blue_on_light_yellow(T t) { return R<T> { S<T>(t, "b", "ly") }; }
template<typename T> R<T> blue_on_bright_white(T t) { return R<T> { S<T>(t, "b", "bw") }; }
template<typename T> R<T> green_on_black(T t) { return R<T> { S<T>(t, "g", "k") }; }
template<typename T> R<T> green_on_blue(T t) { return R<T> { S<T>(t, "g", "b") }; }
template<typename T> R<T> green_on_green(T t) { return R<T> { S<T>(t, "g", "g") }; }
template<typename T> R<T> green_on_aqua(T t) { return R<T> { S<T>(t, "g", "a") }; }
template<typename T> R<T> green_on_red(T t) { return R<T> { S<T>(t, "g", "r") }; }
template<typename T> R<T> green_on_purple(T t) { return R<T> { S<T>(t, "g", "p") }; }
template<typename T> R<T> green_on_yellow(T t) { return R<T> { S<T>(t, "g", "y") }; }
template<typename T> R<T> green_on_white(T t) { return R<T> { S<T>(t, "g", "w") }; }
template<typename T> R<T> green_on_grey(T t) { return R<T> { S<T>(t, "g", "e") }; }
template<typename T> R<T> green_on_light_blue(T t) { return R<T> { S<T>(t, "g", "lb") }; }
template<typename T> R<T> green_on_light_green(T t) { return R<T> { S<T>(t, "g", "lg") }; }
template<typename T> R<T> green_on_light_aqua(T t) { return R<T> { S<T>(t, "g", "la") }; }
template<typename T> R<T> green_on_light_red(T t) { return R<T> { S<T>(t, "g", "lr") }; }
template<typename T> R<T> green_on_light_purple(T t) { return R<T> { S<T>(t, "g", "lp") }; }
template<typename T> R<T> green_on_light_yellow(T t) { return R<T> { S<T>(t, "g", "ly") }; }
template<typename T> R<T> green_on_bright_white(T t) { return R<T> { S<T>(t, "g", "bw") }; }
template<typename T> R<T> aqua_on_black(T t) { return R<T> { S<T>(t, "a", "k") }; }
template<typename T> R<T> aqua_on_blue(T t) { return R<T> { S<T>(t, "a", "b") }; }
template<typename T> R<T> aqua_on_green(T t) { return R<T> { S<T>(t, "a", "g") }; }
template<typename T> R<T> aqua_on_aqua(T t) { return R<T> { S<T>(t, "a", "a") }; }
template<typename T> R<T> aqua_on_red(T t) { return R<T> { S<T>(t, "a", "r") }; }
template<typename T> R<T> aqua_on_purple(T t) { return R<T> { S<T>(t, "a", "p") }; }
template<typename T> R<T> aqua_on_yellow(T t) { return R<T> { S<T>(t, "a", "y") }; }
template<typename T> R<T> aqua_on_white(T t) { return R<T> { S<T>(t, "a", "w") }; }
template<typename T> R<T> aqua_on_grey(T t) { return R<T> { S<T>(t, "a", "e") }; }
template<typename T> R<T> aqua_on_light_blue(T t) { return R<T> { S<T>(t, "a", "lb") }; }
template<typename T> R<T> aqua_on_light_green(T t) { return R<T> { S<T>(t, "a", "lg") }; }
template<typename T> R<T> aqua_on_light_aqua(T t) { return R<T> { S<T>(t, "a", "la") }; }
template<typename T> R<T> aqua_on_light_red(T t) { return R<T> { S<T>(t, "a", "lr") }; }
template<typename T> R<T> aqua_on_light_purple(T t) { return R<T> { S<T>(t, "a", "lp") }; }
template<typename T> R<T> aqua_on_light_yellow(T t) { return R<T> { S<T>(t, "a", "ly") }; }
template<typename T> R<T> aqua_on_bright_white(T t) { return R<T> { S<T>(t, "a", "bw") }; }
template<typename T> R<T> red_on_black(T t) { return R<T> { S<T>(t, "r", "k") }; }
template<typename T> R<T> red_on_blue(T t) { return R<T> { S<T>(t, "r", "b") }; }
template<typename T> R<T> red_on_green(T t) { return R<T> { S<T>(t, "r", "g") }; }
template<typename T> R<T> red_on_aqua(T t) { return R<T> { S<T>(t, "r", "a") }; }
template<typename T> R<T> red_on_red(T t) { return R<T> { S<T>(t, "r", "r") }; }
template<typename T> R<T> red_on_purple(T t) { return R<T> { S<T>(t, "r", "p") }; }
template<typename T> R<T> red_on_yellow(T t) { return R<T> { S<T>(t, "r", "y") }; }
template<typename T> R<T> red_on_white(T t) { return R<T> { S<T>(t, "r", "w") }; }
template<typename T> R<T> red_on_grey(T t) { return R<T> { S<T>(t, "r", "e") }; }
template<typename T> R<T> red_on_light_blue(T t) { return R<T> { S<T>(t, "r", "lb") }; }
template<typename T> R<T> red_on_light_green(T t) { return R<T> { S<T>(t, "r", "lg") }; }
template<typename T> R<T> red_on_light_aqua(T t) { return R<T> { S<T>(t, "r", "la") }; }
template<typename T> R<T> red_on_light_red(T t) { return R<T> { S<T>(t, "r", "lr") }; }
template<typename T> R<T> red_on_light_purple(T t) { return R<T> { S<T>(t, "r", "lp") }; }
template<typename T> R<T> red_on_light_yellow(T t) { return R<T> { S<T>(t, "r", "ly") }; }
template<typename T> R<T> red_on_bright_white(T t) { return R<T> { S<T>(t, "r", "bw") }; }
template<typename T> R<T> purple_on_black(T t) { return R<T> { S<T>(t, "p", "k") }; }
template<typename T> R<T> purple_on_blue(T t) { return R<T> { S<T>(t, "p", "b") }; }
template<typename T> R<T> purple_on_green(T t) { return R<T> { S<T>(t, "p", "g") }; }
template<typename T> R<T> purple_on_aqua(T t) { return R<T> { S<T>(t, "p", "a") }; }
template<typename T> R<T> purple_on_red(T t) { return R<T> { S<T>(t, "p", "r") }; }
template<typename T> R<T> purple_on_purple(T t) { return R<T> { S<T>(t, "p", "p") }; }
template<typename T> R<T> purple_on_yellow(T t) { return R<T> { S<T>(t, "p", "y") }; }
template<typename T> R<T> purple_on_white(T t) { return R<T> { S<T>(t, "p", "w") }; }
template<typename T> R<T> purple_on_grey(T t) { return R<T> { S<T>(t, "p", "e") }; }
template<typename T> R<T> purple_on_light_blue(T t) { return R<T> { S<T>(t, "p", "lb") }; }
template<typename T> R<T> purple_on_light_green(T t) { return R<T> { S<T>(t, "p", "lg") }; }
template<typename T> R<T> purple_on_light_aqua(T t) { return R<T> { S<T>(t, "p", "la") }; }
template<typename T> R<T> purple_on_light_red(T t) { return R<T> { S<T>(t, "p", "lr") }; }
template<typename T> R<T> purple_on_light_purple(T t) { return R<T> { S<T>(t, "p", "lp") }; }
template<typename T> R<T> purple_on_light_yellow(T t) { return R<T> { S<T>(t, "p", "ly") }; }
template<typename T> R<T> purple_on_bright_white(T t) { return R<T> { S<T>(t, "p", "bw") }; }
template<typename T> R<T> yellow_on_black(T t) { return R<T> { S<T>(t, "y", "k") }; }
template<typename T> R<T> yellow_on_blue(T t) { return R<T> { S<T>(t, "y", "b") }; }
template<typename T> R<T> yellow_on_green(T t) { return R<T> { S<T>(t, "y", "g") }; }
template<typename T> R<T> yellow_on_aqua(T t) { return R<T> { S<T>(t, "y", "a") }; }
template<typename T> R<T> yellow_on_red(T t) { return R<T> { S<T>(t, "y", "r") }; }
template<typename T> R<T> yellow_on_purple(T t) { return R<T> { S<T>(t, "y", "p") }; }
template<typename T> R<T> yellow_on_yellow(T t) { return R<T> { S<T>(t, "y", "y") }; }
template<typename T> R<T> yellow_on_white(T t) { return R<T> { S<T>(t, "y", "w") }; }
template<typename T> R<T> yellow_on_grey(T t) { return R<T> { S<T>(t, "y", "e") }; }
template<typename T> R<T> yellow_on_light_blue(T t) { return R<T> { S<T>(t, "y", "lb") }; }
template<typename T> R<T> yellow_on_light_green(T t) { return R<T> { S<T>(t, "y", "lg") }; }
template<typename T> R<T> yellow_on_light_aqua(T t) { return R<T> { S<T>(t, "y", "la") }; }
template<typename T> R<T> yellow_on_light_red(T t) { return R<T> { S<T>(t, "y", "lr") }; }
template<typename T> R<T> yellow_on_light_purple(T t) { return R<T> { S<T>(t, "y", "lp") }; }
template<typename T> R<T> yellow_on_light_yellow(T t) { return R<T> { S<T>(t, "y", "ly") }; }
template<typename T> R<T> yellow_on_bright_white(T t) { return R<T> { S<T>(t, "y", "bw") }; }
template<typename T> R<T> white_on_black(T t) { return R<T> { S<T>(t, "w", "k") }; }
template<typename T> R<T> white_on_blue(T t) { return R<T> { S<T>(t, "w", "b") }; }
template<typename T> R<T> white_on_green(T t) { return R<T> { S<T>(t, "w", "g") }; }
template<typename T> R<T> white_on_aqua(T t) { return R<T> { S<T>(t, "w", "a") }; }
template<typename T> R<T> white_on_red(T t) { return R<T> { S<T>(t, "w", "r") }; }
template<typename T> R<T> white_on_purple(T t) { return R<T> { S<T>(t, "w", "p") }; }
template<typename T> R<T> white_on_yellow(T t) { return R<T> { S<T>(t, "w", "y") }; }
template<typename T> R<T> white_on_white(T t) { return R<T> { S<T>(t, "w", "w") }; }
template<typename T> R<T> white_on_grey(T t) { return R<T> { S<T>(t, "w", "e") }; }
template<typename T> R<T> white_on_light_blue(T t) { return R<T> { S<T>(t, "w", "lb") }; }
template<typename T> R<T> white_on_light_green(T t) { return R<T> { S<T>(t, "w", "lg") }; }
template<typename T> R<T> white_on_light_aqua(T t) { return R<T> { S<T>(t, "w", "la") }; }
template<typename T> R<T> white_on_light_red(T t) { return R<T> { S<T>(t, "w", "lr") }; }
template<typename T> R<T> white_on_light_purple(T t) { return R<T> { S<T>(t, "w", "lp") }; }
template<typename T> R<T> white_on_light_yellow(T t) { return R<T> { S<T>(t, "w", "ly") }; }
template<typename T> R<T> white_on_bright_white(T t) { return R<T> { S<T>(t, "w", "bw") }; }
template<typename T> R<T> grey_on_black(T t) { return R<T> { S<T>(t, "e", "k") }; }
template<typename T> R<T> grey_on_blue(T t) { return R<T> { S<T>(t, "e", "b") }; }
template<typename T> R<T> grey_on_green(T t) { return R<T> { S<T>(t, "e", "g") }; }
template<typename T> R<T> grey_on_aqua(T t) { return R<T> { S<T>(t, "e", "a") }; }
template<typename T> R<T> grey_on_red(T t) { return R<T> { S<T>(t, "e", "r") }; }
template<typename T> R<T> grey_on_purple(T t) { return R<T> { S<T>(t, "e", "p") }; }
template<typename T> R<T> grey_on_yellow(T t) { return R<T> { S<T>(t, "e", "y") }; }
template<typename T> R<T> grey_on_white(T t) { return R<T> { S<T>(t, "e", "w") }; }
template<typename T> R<T> grey_on_grey(T t) { return R<T> { S<T>(t, "e", "e") }; }
template<typename T> R<T> grey_on_light_blue(T t) { return R<T> { S<T>(t, "e", "lb") }; }
template<typename T> R<T> grey_on_light_green(T t) { return R<T> { S<T>(t, "e", "lg") }; }
template<typename T> R<T> grey_on_light_aqua(T t) { return R<T> { S<T>(t, "e", "la") }; }
template<typename T> R<T> grey_on_light_red(T t) { return R<T> { S<T>(t, "e", "lr") }; }
template<typename T> R<T> grey_on_light_purple(T t) { return R<T> { S<T>(t, "e", "lp") }; }
template<typename T> R<T> grey_on_light_yellow(T t) { return R<T> { S<T>(t, "e", "ly") }; }
template<typename T> R<T> grey_on_bright_white(T t) { return R<T> { S<T>(t, "e", "bw") }; }
template<typename T> R<T> light_blue_on_black(T t) { return R<T> { S<T>(t, "lb", "k") }; }
template<typename T> R<T> light_blue_on_blue(T t) { return R<T> { S<T>(t, "lb", "b") }; }
template<typename T> R<T> light_blue_on_green(T t) { return R<T> { S<T>(t, "lb", "g") }; }
template<typename T> R<T> light_blue_on_aqua(T t) { return R<T> { S<T>(t, "lb", "a") }; }
template<typename T> R<T> light_blue_on_red(T t) { return R<T> { S<T>(t, "lb", "r") }; }
template<typename T> R<T> light_blue_on_purple(T t) { return R<T> { S<T>(t, "lb", "p") }; }
template<typename T> R<T> light_blue_on_yellow(T t) { return R<T> { S<T>(t, "lb", "y") }; }
template<typename T> R<T> light_blue_on_white(T t) { return R<T> { S<T>(t, "lb", "w") }; }
template<typename T> R<T> light_blue_on_grey(T t) { return R<T> { S<T>(t, "lb", "e") }; }
template<typename T> R<T> light_blue_on_light_blue(T t) { return R<T> { S<T>(t, "lb", "lb") }; }
template<typename T> R<T> light_blue_on_light_green(T t) { return R<T> { S<T>(t, "lb", "lg") }; }
template<typename T> R<T> light_blue_on_light_aqua(T t) { return R<T> { S<T>(t, "lb", "la") }; }
template<typename T> R<T> light_blue_on_light_red(T t) { return R<T> { S<T>(t, "lb", "lr") }; }
template<typename T> R<T> light_blue_on_light_purple(T t) { return R<T> { S<T>(t, "lb", "lp") }; }
template<typename T> R<T> light_blue_on_light_yellow(T t) { return R<T> { S<T>(t, "lb", "ly") }; }
template<typename T> R<T> light_blue_on_bright_white(T t) { return R<T> { S<T>(t, "lb", "bw") }; }
template<typename T> R<T> light_green_on_black(T t) { return R<T> { S<T>(t, "lg", "k") }; }
template<typename T> R<T> light_green_on_blue(T t) { return R<T> { S<T>(t, "lg", "b") }; }
template<typename T> R<T> light_green_on_green(T t) { return R<T> { S<T>(t, "lg", "g") }; }
template<typename T> R<T> light_green_on_aqua(T t) { return R<T> { S<T>(t, "lg", "a") }; }
template<typename T> R<T> light_green_on_red(T t) { return R<T> { S<T>(t, "lg", "r") }; }
template<typename T> R<T> light_green_on_purple(T t) { return R<T> { S<T>(t, "lg", "p") }; }
template<typename T> R<T> light_green_on_yellow(T t) { return R<T> { S<T>(t, "lg", "y") }; }
template<typename T> R<T> light_green_on_white(T t) { return R<T> { S<T>(t, "lg", "w") }; }
template<typename T> R<T> light_green_on_grey(T t) { return R<T> { S<T>(t, "lg", "e") }; }
template<typename T> R<T> light_green_on_light_blue(T t) { return R<T> { S<T>(t, "lg", "lb") }; }
template<typename T> R<T> light_green_on_light_green(T t) { return R<T> { S<T>(t, "lg", "lg") }; }
template<typename T> R<T> light_green_on_light_aqua(T t) { return R<T> { S<T>(t, "lg", "la") }; }
template<typename T> R<T> light_green_on_light_red(T t) { return R<T> { S<T>(t, "lg", "lr") }; }
template<typename T> R<T> light_green_on_light_purple(T t) { return R<T> { S<T>(t, "lg", "lp") }; }
template<typename T> R<T> light_green_on_light_yellow(T t) { return R<T> { S<T>(t, "lg", "ly") }; }
template<typename T> R<T> light_green_on_bright_white(T t) { return R<T> { S<T>(t, "lg", "bw") }; }
template<typename T> R<T> light_aqua_on_black(T t) { return R<T> { S<T>(t, "la", "k") }; }
template<typename T> R<T> light_aqua_on_blue(T t) { return R<T> { S<T>(t, "la", "b") }; }
template<typename T> R<T> light_aqua_on_green(T t) { return R<T> { S<T>(t, "la", "g") }; }
template<typename T> R<T> light_aqua_on_aqua(T t) { return R<T> { S<T>(t, "la", "a") }; }
template<typename T> R<T> light_aqua_on_red(T t) { return R<T> { S<T>(t, "la", "r") }; }
template<typename T> R<T> light_aqua_on_purple(T t) { return R<T> { S<T>(t, "la", "p") }; }
template<typename T> R<T> light_aqua_on_yellow(T t) { return R<T> { S<T>(t, "la", "y") }; }
template<typename T> R<T> light_aqua_on_white(T t) { return R<T> { S<T>(t, "la", "w") }; }
template<typename T> R<T> light_aqua_on_grey(T t) { return R<T> { S<T>(t, "la", "e") }; }
template<typename T> R<T> light_aqua_on_light_blue(T t) { return R<T> { S<T>(t, "la", "lb") }; }
template<typename T> R<T> light_aqua_on_light_green(T t) { return R<T> { S<T>(t, "la", "lg") }; }
template<typename T> R<T> light_aqua_on_light_aqua(T t) { return R<T> { S<T>(t, "la", "la") }; }
template<typename T> R<T> light_aqua_on_light_red(T t) { return R<T> { S<T>(t, "la", "lr") }; }
template<typename T> R<T> light_aqua_on_light_purple(T t) { return R<T> { S<T>(t, "la", "lp") }; }
template<typename T> R<T> light_aqua_on_light_yellow(T t) { return R<T> { S<T>(t, "la", "ly") }; }
template<typename T> R<T> light_aqua_on_bright_white(T t) { return R<T> { S<T>(t, "la", "bw") }; }
template<typename T> R<T> light_red_on_black(T t) { return R<T> { S<T>(t, "lr", "k") }; }
template<typename T> R<T> light_red_on_blue(T t) { return R<T> { S<T>(t, "lr", "b") }; }
template<typename T> R<T> light_red_on_green(T t) { return R<T> { S<T>(t, "lr", "g") }; }
template<typename T> R<T> light_red_on_aqua(T t) { return R<T> { S<T>(t, "lr", "a") }; }
template<typename T> R<T> light_red_on_red(T t) { return R<T> { S<T>(t, "lr", "r") }; }
template<typename T> R<T> light_red_on_purple(T t) { return R<T> { S<T>(t, "lr", "p") }; }
template<typename T> R<T> light_red_on_yellow(T t) { return R<T> { S<T>(t, "lr", "y") }; }
template<typename T> R<T> light_red_on_white(T t) { return R<T> { S<T>(t, "lr", "w") }; }
template<typename T> R<T> light_red_on_grey(T t) { return R<T> { S<T>(t, "lr", "e") }; }
template<typename T> R<T> light_red_on_light_blue(T t) { return R<T> { S<T>(t, "lr", "lb") }; }
template<typename T> R<T> light_red_on_light_green(T t) { return R<T> { S<T>(t, "lr", "lg") }; }
template<typename T> R<T> light_red_on_light_aqua(T t) { return R<T> { S<T>(t, "lr", "la") }; }
template<typename T> R<T> light_red_on_light_red(T t) { return R<T> { S<T>(t, "lr", "lr") }; }
template<typename T> R<T> light_red_on_light_purple(T t) { return R<T> { S<T>(t, "lr", "lp") }; }
template<typename T> R<T> light_red_on_light_yellow(T t) { return R<T> { S<T>(t, "lr", "ly") }; }
template<typename T> R<T> light_red_on_bright_white(T t) { return R<T> { S<T>(t, "lr", "bw") }; }
template<typename T> R<T> light_purple_on_black(T t) { return R<T> { S<T>(t, "lp", "k") }; }
template<typename T> R<T> light_purple_on_blue(T t) { return R<T> { S<T>(t, "lp", "b") }; }
template<typename T> R<T> light_purple_on_green(T t) { return R<T> { S<T>(t, "lp", "g") }; }
template<typename T> R<T> light_purple_on_aqua(T t) { return R<T> { S<T>(t, "lp", "a") }; }
template<typename T> R<T> light_purple_on_red(T t) { return R<T> { S<T>(t, "lp", "r") }; }
template<typename T> R<T> light_purple_on_purple(T t) { return R<T> { S<T>(t, "lp", "p") }; }
template<typename T> R<T> light_purple_on_yellow(T t) { return R<T> { S<T>(t, "lp", "y") }; }
template<typename T> R<T> light_purple_on_white(T t) { return R<T> { S<T>(t, "lp", "w") }; }
template<typename T> R<T> light_purple_on_grey(T t) { return R<T> { S<T>(t, "lp", "e") }; }
template<typename T> R<T> light_purple_on_light_blue(T t) { return R<T> { S<T>(t, "lp", "lb") }; }
template<typename T> R<T> light_purple_on_light_green(T t) { return R<T> { S<T>(t, "lp", "lg") }; }
template<typename T> R<T> light_purple_on_light_aqua(T t) { return R<T> { S<T>(t, "lp", "la") }; }
template<typename T> R<T> light_purple_on_light_red(T t) { return R<T> { S<T>(t, "lp", "lr") }; }
template<typename T> R<T> light_purple_on_light_purple(T t) { return R<T> { S<T>(t, "lp", "lp") }; }
template<typename T> R<T> light_purple_on_light_yellow(T t) { return R<T> { S<T>(t, "lp", "ly") }; }
template<typename T> R<T> light_purple_on_bright_white(T t) { return R<T> { S<T>(t, "lp", "bw") }; }
template<typename T> R<T> light_yellow_on_black(T t) { return R<T> { S<T>(t, "ly", "k") }; }
template<typename T> R<T> light_yellow_on_blue(T t) { return R<T> { S<T>(t, "ly", "b") }; }
template<typename T> R<T> light_yellow_on_green(T t) { return R<T> { S<T>(t, "ly", "g") }; }
template<typename T> R<T> light_yellow_on_aqua(T t) { return R<T> { S<T>(t, "ly", "a") }; }
template<typename T> R<T> light_yellow_on_red(T t) { return R<T> { S<T>(t, "ly", "r") }; }
template<typename T> R<T> light_yellow_on_purple(T t) { return R<T> { S<T>(t, "ly", "p") }; }
template<typename T> R<T> light_yellow_on_yellow(T t) { return R<T> { S<T>(t, "ly", "y") }; }
template<typename T> R<T> light_yellow_on_white(T t) { return R<T> { S<T>(t, "ly", "w") }; }
template<typename T> R<T> light_yellow_on_grey(T t) { return R<T> { S<T>(t, "ly", "e") }; }
template<typename T> R<T> light_yellow_on_light_blue(T t) { return R<T> { S<T>(t, "ly", "lb") }; }
template<typename T> R<T> light_yellow_on_light_green(T t) { return R<T> { S<T>(t, "ly", "lg") }; }
template<typename T> R<T> light_yellow_on_light_aqua(T t) { return R<T> { S<T>(t, "ly", "la") }; }
template<typename T> R<T> light_yellow_on_light_red(T t) { return R<T> { S<T>(t, "ly", "lr") }; }
template<typename T> R<T> light_yellow_on_light_purple(T t) { return R<T> { S<T>(t, "ly", "lp") }; }
template<typename T> R<T> light_yellow_on_light_yellow(T t) { return R<T> { S<T>(t, "ly", "ly") }; }
template<typename T> R<T> light_yellow_on_bright_white(T t) { return R<T> { S<T>(t, "ly", "bw") }; }
template<typename T> R<T> bright_white_on_black(T t) { return R<T> { S<T>(t, "bw", "k") }; }
template<typename T> R<T> bright_white_on_blue(T t) { return R<T> { S<T>(t, "bw", "b") }; }
template<typename T> R<T> bright_white_on_green(T t) { return R<T> { S<T>(t, "bw", "g") }; }
template<typename T> R<T> bright_white_on_aqua(T t) { return R<T> { S<T>(t, "bw", "a") }; }
template<typename T> R<T> bright_white_on_red(T t) { return R<T> { S<T>(t, "bw", "r") }; }
template<typename T> R<T> bright_white_on_purple(T t) { return R<T> { S<T>(t, "bw", "p") }; }
template<typename T> R<T> bright_white_on_yellow(T t) { return R<T> { S<T>(t, "bw", "y") }; }
template<typename T> R<T> bright_white_on_white(T t) { return R<T> { S<T>(t, "bw", "w") }; }
template<typename T> R<T> bright_white_on_grey(T t) { return R<T> { S<T>(t, "bw", "e") }; }
template<typename T> R<T> bright_white_on_light_blue(T t) { return R<T> { S<T>(t, "bw", "lb") }; }
template<typename T> R<T> bright_white_on_light_green(T t) { return R<T> { S<T>(t, "bw", "lg") }; }
template<typename T> R<T> bright_white_on_light_aqua(T t) { return R<T> { S<T>(t, "bw", "la") }; }
template<typename T> R<T> bright_white_on_light_red(T t) { return R<T> { S<T>(t, "bw", "lr") }; }
template<typename T> R<T> bright_white_on_light_purple(T t) { return R<T> { S<T>(t, "bw", "lp") }; }
template<typename T> R<T> bright_white_on_light_yellow(T t) { return R<T> { S<T>(t, "bw", "ly") }; }
template<typename T> R<T> bright_white_on_bright_white(T t) { return R<T> { S<T>(t, "bw", "bw") }; }
}
#endif

View File

@ -1,4 +1,4 @@
// SLB program to evaluate a given expression
// ZS program to evaluate a given expression
#include <iostream>
#include <fstream>
#include <string>
@ -7,6 +7,7 @@
#include <stack>
#include "eval.h"
#include "strops.h"
#include <math.h>
// #include "builtin.h"
using namespace std;

View File

@ -12,7 +12,7 @@
#include "strops.h"
#include "main.h"
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_image.h>
#include <stdio.h>
#include <chrono>
#include <SDL.h>
@ -26,6 +26,7 @@ using namespace boost;
int WINDOW_WIDTH = 1280;
int WINDOW_HEIGHT = 720;
int PIXEL_SCALE = 1;
unordered_map<string, int> KEYS =
{
@ -113,9 +114,11 @@ SDL_Renderer* gRenderer = NULL;
SDL_Surface* gScreenSurface = NULL;
bool running = true;
bool buttons[4] = {};
float dt = 0.0f;
float clamp(float v, float min, float max);
SDL_Surface* loadSurface(std::string path)
{
//The final optimized image
@ -217,6 +220,7 @@ public:
return x;
if (componentName == "y")
return y;
return 0;
}
Vec2 EditSubComponent(std::string componentName, std::string oper, boost::any otherVal)
@ -360,6 +364,9 @@ public:
rect.y = static_cast<int>(position.y);
rect.w = scale.x;
rect.h = scale.y;
// Centers
rect.x = position.x - (rect.w / 2);
rect.y = position.y - (rect.h / 2);
Load();
}
@ -383,10 +390,12 @@ public:
int Draw()
{
SDL_RenderCopy(gRenderer, texture, NULL, &rect);
// Centers
rect.w = scale.x;
rect.h = scale.y;
rect.x = position.x - (rect.w / 2);
rect.y = position.y - (rect.h / 2);
SDL_RenderCopy(gRenderer, texture, NULL, &rect);
return 0;
}
@ -409,6 +418,7 @@ public:
return scale.x;
if (componentName == "scale.y")
return scale.y;
return 0;
}
Sprite EditSubComponent(std::string componentName, std::string oper, boost::any otherVal)
@ -493,6 +503,11 @@ public:
else if (oper == "/=")
scale.y /= AnyAsFloat(otherVal);
}
// Centers
rect.w = scale.x;
rect.h = scale.y;
rect.x = position.x - (rect.w / 2);
rect.y = position.y - (rect.h / 2);
return *this;
}
@ -508,8 +523,8 @@ public:
class Text
{
public:
Text(std::string content, std::string pathToFont, Vec2 position, float fontSize, double angle, int r, int g, int b)
: position(position), angle(angle), content(content), pathToFont(pathToFont), fontSize(fontSize), r(r), g(g), b(b)
Text(std::string content, std::string pathToFont, Vec2 position, float fontSize, double angle, Uint8 r, Uint8 g, Uint8 b, bool antialias)
: position(position), angle(angle), content(content), pathToFont(pathToFont), fontSize(fontSize), r(r), g(g), b(b), antialias(antialias)
{
rect.x = position.x;
rect.y = position.y;
@ -523,9 +538,12 @@ public:
{
SDL_Color color = { r, g, b };
SDL_Surface* surface = TTF_RenderText_Solid(font, content.c_str(), color);
SDL_Surface* surface;
if (antialias)
surface = TTF_RenderText_Blended(font, content.c_str(), color);
else
surface = TTF_RenderText_Solid(font, content.c_str(), color);
SDL_DestroyTexture(texture);
texture = SDL_CreateTextureFromSurface(gRenderer, surface);
TTF_SizeText(font, content.c_str(), &rect.w, &rect.h);
@ -534,8 +552,8 @@ public:
scale.y = rect.h;
// Centers
position.x = rect.x - (rect.w / 2);
position.y = rect.y - (rect.h / 2);
rect.x = position.x - (rect.w / 2);
rect.y = position.y - (rect.h / 2);
SDL_FreeSurface(surface);
return 0;
@ -545,7 +563,11 @@ public:
{
SDL_Color color = { r, g, b };
SDL_Surface* surface = TTF_RenderText_Solid(font, content.c_str(), color);
SDL_Surface* surface;
if (antialias)
surface = TTF_RenderText_Blended(font, content.c_str(), color);
else
surface = TTF_RenderText_Solid(font, content.c_str(), color);
SDL_DestroyTexture(texture);
texture = SDL_CreateTextureFromSurface(gRenderer, surface);
@ -556,8 +578,8 @@ public:
scale.y = rect.h;
// Centers
position.x = rect.x - (rect.w / 2);
position.y = rect.y - (rect.h / 2);
rect.x = position.x - (rect.w / 2);
rect.y = position.y - (rect.h / 2);
SDL_FreeSurface(surface);
return 0;
@ -590,6 +612,9 @@ public:
return content;
if (componentName == "pathToFont")
return pathToFont;
if (componentName == "antialias")
return antialias;
return 0;
}
Text EditSubComponent(const std::string componentName, const std::string oper, const boost::any otherVal)
@ -696,19 +721,26 @@ public:
else if (oper == "+=")
content += AnyAsString(otherVal);
}
else if (componentName == "antialias")
{
if (oper == "=")
antialias = AnyAsBool(otherVal);
}
// Updates changes to text
Update();
return *this;
}
bool antialias = true;
Vec2 position;
Vec2 scale;
float fontSize;
double angle;
int r;
int g;
int b;
Uint8 r;
Uint8 g;
Uint8 b;
std::string content;
std::string pathToFont;
@ -729,6 +761,12 @@ int cleanupGraphics()
return 0;
}
//void DrawPixel(int x, int y, int r, int g, int b) {
// SDL_SetRenderDrawColor(gRenderer, r, g, b, 255);
// SDL_RenderDrawPoint(gRenderer, x, y);
// SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 0);
//}
int updateLoop()
{
@ -1002,22 +1040,26 @@ int updateLoop()
// Calculate frame time
auto stopTime = std::chrono::high_resolution_clock::now();
dt = std::chrono::duration<float, std::chrono::milliseconds::period>(stopTime - startTime).count() / 1000.0f;
dt = clamp(dt, 0, 1000);
}
return 0;
}
int initGraphics(std::string windowTitle, int width, int height)
int initGraphics(std::string windowTitle, int width, int height, int pixelScale)
{
WINDOW_WIDTH = width;
WINDOW_HEIGHT = height;
PIXEL_SCALE = pixelScale;
// Initialize SDL components
SDL_Init(SDL_INIT_VIDEO);
TTF_Init();
gWindow = SDL_CreateWindow(windowTitle.c_str(), 40, 40, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_SHOWN | SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
gWindow = SDL_CreateWindow(windowTitle.c_str(), 40, 40, WINDOW_WIDTH * PIXEL_SCALE, WINDOW_HEIGHT * PIXEL_SCALE, SDL_WINDOW_SHOWN | SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
gRenderer = SDL_CreateRenderer(gWindow, -1, 0);
SDL_RenderSetLogicalSize(gRenderer, WINDOW_WIDTH * PIXEL_SCALE, WINDOW_HEIGHT * PIXEL_SCALE);
SDL_RenderSetScale(gRenderer, PIXEL_SCALE, PIXEL_SCALE);
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, 0);
//Get window surface
gScreenSurface = SDL_GetWindowSurface(gWindow);

BIN
ZSharp/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 800 KiB

View File

@ -0,0 +1,415 @@
# This is the CMakeCache file.
# For build in directory: /home/sam/Z-Sharp/ZSharp/linux-build
# It was generated by CMake: /usr/bin/cmake
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
# VALUE is the current value for the KEY.
########################
# EXTERNAL cache entries
########################
//The directory containing a CMake configuration file for Boost.
Boost_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0
//Path to a file.
Boost_INCLUDE_DIR:PATH=/usr/include
Boost_SYSTEM_LIBRARY_RELEASE:STRING=/usr/lib/x86_64-linux-gnu/libboost_system.so.1.71.0
//Path to a program.
CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line
//Path to a program.
CMAKE_AR:FILEPATH=/usr/bin/ar
//Choose the type of build, options are: None Debug Release RelWithDebInfo
// MinSizeRel ...
CMAKE_BUILD_TYPE:STRING=Release
//Enable/Disable color output during build.
CMAKE_COLOR_MAKEFILE:BOOL=ON
//CXX compiler
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++
//A wrapper around 'ar' adding the appropriate '--plugin' option
// for the GCC compiler
CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-9
//A wrapper around 'ranlib' adding the appropriate '--plugin' option
// for the GCC compiler
CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-9
//Flags used by the CXX compiler during all build types.
CMAKE_CXX_FLAGS:STRING=
//Flags used by the CXX compiler during DEBUG builds.
CMAKE_CXX_FLAGS_DEBUG:STRING=-g
//Flags used by the CXX compiler during MINSIZEREL builds.
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
//Flags used by the CXX compiler during RELEASE builds.
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
//Flags used by the CXX compiler during RELWITHDEBINFO builds.
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
//C compiler
CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc
//A wrapper around 'ar' adding the appropriate '--plugin' option
// for the GCC compiler
CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-9
//A wrapper around 'ranlib' adding the appropriate '--plugin' option
// for the GCC compiler
CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-9
//Flags used by the C compiler during all build types.
CMAKE_C_FLAGS:STRING=
//Flags used by the C compiler during DEBUG builds.
CMAKE_C_FLAGS_DEBUG:STRING=-g
//Flags used by the C compiler during MINSIZEREL builds.
CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
//Flags used by the C compiler during RELEASE builds.
CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
//Flags used by the C compiler during RELWITHDEBINFO builds.
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
//Path to a program.
CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND
//Flags used by the linker during all build types.
CMAKE_EXE_LINKER_FLAGS:STRING=
//Flags used by the linker during DEBUG builds.
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
//Flags used by the linker during MINSIZEREL builds.
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
//Flags used by the linker during RELEASE builds.
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
//Flags used by the linker during RELWITHDEBINFO builds.
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
//Enable/Disable output of compile commands during generation.
CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF
//Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=/usr/local
//Path to a program.
CMAKE_LINKER:FILEPATH=/usr/bin/ld
//Path to a program.
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make
//Flags used by the linker during the creation of modules during
// all build types.
CMAKE_MODULE_LINKER_FLAGS:STRING=
//Flags used by the linker during the creation of modules during
// DEBUG builds.
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
//Flags used by the linker during the creation of modules during
// MINSIZEREL builds.
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
//Flags used by the linker during the creation of modules during
// RELEASE builds.
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
//Flags used by the linker during the creation of modules during
// RELWITHDEBINFO builds.
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
//Path to a program.
CMAKE_NM:FILEPATH=/usr/bin/nm
//Path to a program.
CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy
//Path to a program.
CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump
//Value Computed by CMake
CMAKE_PROJECT_DESCRIPTION:STATIC=
//Value Computed by CMake
CMAKE_PROJECT_HOMEPAGE_URL:STATIC=
//Value Computed by CMake
CMAKE_PROJECT_NAME:STATIC=ZSharp
//Path to a program.
CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib
//Path to a program.
CMAKE_READELF:FILEPATH=/usr/bin/readelf
//Flags used by the linker during the creation of shared libraries
// during all build types.
CMAKE_SHARED_LINKER_FLAGS:STRING=
//Flags used by the linker during the creation of shared libraries
// during DEBUG builds.
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
//Flags used by the linker during the creation of shared libraries
// during MINSIZEREL builds.
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
//Flags used by the linker during the creation of shared libraries
// during RELEASE builds.
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
//Flags used by the linker during the creation of shared libraries
// during RELWITHDEBINFO builds.
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
//If set, runtime paths are not added when installing shared libraries,
// but are added when building.
CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
//If set, runtime paths are not added when using shared libraries.
CMAKE_SKIP_RPATH:BOOL=NO
//Flags used by the linker during the creation of static libraries
// during all build types.
CMAKE_STATIC_LINKER_FLAGS:STRING=
//Flags used by the linker during the creation of static libraries
// during DEBUG builds.
CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
//Flags used by the linker during the creation of static libraries
// during MINSIZEREL builds.
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
//Flags used by the linker during the creation of static libraries
// during RELEASE builds.
CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
//Flags used by the linker during the creation of static libraries
// during RELWITHDEBINFO builds.
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
//Path to a program.
CMAKE_STRIP:FILEPATH=/usr/bin/strip
//If this value is on, makefiles will be generated without the
// .SILENT directive, and all commands will be echoed to the console
// during the make. This is useful for debugging only. With Visual
// Studio IDE projects all commands are done without /nologo.
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
//The directory containing a CMake configuration file for SDL2.
SDL2_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/SDL2
//Path to a file.
SDL2_IMAGE_INCLUDE_DIR:PATH=/usr/include/SDL2
//Path to a library.
SDL2_IMAGE_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libSDL2_image.so
//Path to a file.
SDL2_TTF_INCLUDE_DIR:PATH=/usr/include/SDL2
//Path to a library.
SDL2_TTF_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libSDL2_ttf.so
//Value Computed by CMake
ZSharp_BINARY_DIR:STATIC=/home/sam/Z-Sharp/ZSharp/linux-build
//Value Computed by CMake
ZSharp_SOURCE_DIR:STATIC=/home/sam/Z-Sharp/ZSharp
//The directory containing a CMake configuration file for boost_headers.
boost_headers_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/boost_headers-1.71.0
//The directory containing a CMake configuration file for boost_system.
boost_system_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/boost_system-1.71.0
########################
# INTERNAL cache entries
########################
//ADVANCED property for variable: Boost_DIR
Boost_DIR-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_ADDR2LINE
CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_AR
CMAKE_AR-ADVANCED:INTERNAL=1
//This is the directory where this CMakeCache.txt was created
CMAKE_CACHEFILE_DIR:INTERNAL=/home/sam/Z-Sharp/ZSharp/linux-build
//Major version of cmake used to create the current loaded cache
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
//Minor version of cmake used to create the current loaded cache
CMAKE_CACHE_MINOR_VERSION:INTERNAL=16
//Patch version of cmake used to create the current loaded cache
CMAKE_CACHE_PATCH_VERSION:INTERNAL=3
//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE
CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1
//Path to CMake executable.
CMAKE_COMMAND:INTERNAL=/usr/bin/cmake
//Path to cpack program executable.
CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack
//Path to ctest program executable.
CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest
//ADVANCED property for variable: CMAKE_CXX_COMPILER
CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR
CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB
CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_COMPILER
CMAKE_C_COMPILER-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_COMPILER_AR
CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB
CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS
CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_DLLTOOL
CMAKE_DLLTOOL-ADVANCED:INTERNAL=1
//Executable file format
CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS
CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG
CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE
CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS
CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1
//Name of external makefile project generator.
CMAKE_EXTRA_GENERATOR:INTERNAL=
//Name of generator.
CMAKE_GENERATOR:INTERNAL=Unix Makefiles
//Generator instance identifier.
CMAKE_GENERATOR_INSTANCE:INTERNAL=
//Name of generator platform.
CMAKE_GENERATOR_PLATFORM:INTERNAL=
//Name of generator toolset.
CMAKE_GENERATOR_TOOLSET:INTERNAL=
//Source directory with the top level CMakeLists.txt file for this
// project
CMAKE_HOME_DIRECTORY:INTERNAL=/home/sam/Z-Sharp/ZSharp
//Install .so files without execute permission.
CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1
//ADVANCED property for variable: CMAKE_LINKER
CMAKE_LINKER-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MAKE_PROGRAM
CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG
CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE
CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_NM
CMAKE_NM-ADVANCED:INTERNAL=1
//number of local generators
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1
//ADVANCED property for variable: CMAKE_OBJCOPY
CMAKE_OBJCOPY-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_OBJDUMP
CMAKE_OBJDUMP-ADVANCED:INTERNAL=1
//Platform information initialized
CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1
//ADVANCED property for variable: CMAKE_RANLIB
CMAKE_RANLIB-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_READELF
CMAKE_READELF-ADVANCED:INTERNAL=1
//Path to CMake installation.
CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.16
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG
CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE
CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH
CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SKIP_RPATH
CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS
CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG
CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE
CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STRIP
CMAKE_STRIP-ADVANCED:INTERNAL=1
//uname command
CMAKE_UNAME:INTERNAL=/usr/bin/uname
//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE
CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1
//Details about finding Boost
FIND_PACKAGE_MESSAGE_DETAILS_Boost:INTERNAL=[/usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake][cfound components: system ][v1.71.0()]
//Details about finding SDL2_image
FIND_PACKAGE_MESSAGE_DETAILS_SDL2_image:INTERNAL=[/usr/lib/x86_64-linux-gnu/libSDL2_image.so][/usr/include/SDL2][v()]
//Details about finding SDL2_ttf
FIND_PACKAGE_MESSAGE_DETAILS_SDL2_ttf:INTERNAL=[/usr/lib/x86_64-linux-gnu/libSDL2_ttf.so][/usr/include/SDL2][v()]
//ADVANCED property for variable: SDL2_IMAGE_INCLUDE_DIR
SDL2_IMAGE_INCLUDE_DIR-ADVANCED:INTERNAL=1
//ADVANCED property for variable: SDL2_IMAGE_LIBRARY
SDL2_IMAGE_LIBRARY-ADVANCED:INTERNAL=1
//ADVANCED property for variable: SDL2_TTF_INCLUDE_DIR
SDL2_TTF_INCLUDE_DIR-ADVANCED:INTERNAL=1
//ADVANCED property for variable: SDL2_TTF_LIBRARY
SDL2_TTF_LIBRARY-ADVANCED:INTERNAL=1
//ADVANCED property for variable: boost_headers_DIR
boost_headers_DIR-ADVANCED:INTERNAL=1
//ADVANCED property for variable: boost_system_DIR
boost_system_DIR-ADVANCED:INTERNAL=1

View File

@ -0,0 +1,76 @@
set(CMAKE_C_COMPILER "/usr/bin/cc")
set(CMAKE_C_COMPILER_ARG1 "")
set(CMAKE_C_COMPILER_ID "GNU")
set(CMAKE_C_COMPILER_VERSION "9.3.0")
set(CMAKE_C_COMPILER_VERSION_INTERNAL "")
set(CMAKE_C_COMPILER_WRAPPER "")
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11")
set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert")
set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes")
set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros")
set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert")
set(CMAKE_C_PLATFORM_ID "Linux")
set(CMAKE_C_SIMULATE_ID "")
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "")
set(CMAKE_C_SIMULATE_VERSION "")
set(CMAKE_AR "/usr/bin/ar")
set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-9")
set(CMAKE_RANLIB "/usr/bin/ranlib")
set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-9")
set(CMAKE_LINKER "/usr/bin/ld")
set(CMAKE_MT "")
set(CMAKE_COMPILER_IS_GNUCC 1)
set(CMAKE_C_COMPILER_LOADED 1)
set(CMAKE_C_COMPILER_WORKS TRUE)
set(CMAKE_C_ABI_COMPILED TRUE)
set(CMAKE_COMPILER_IS_MINGW )
set(CMAKE_COMPILER_IS_CYGWIN )
if(CMAKE_COMPILER_IS_CYGWIN)
set(CYGWIN 1)
set(UNIX 1)
endif()
set(CMAKE_C_COMPILER_ENV_VAR "CC")
if(CMAKE_COMPILER_IS_MINGW)
set(MINGW 1)
endif()
set(CMAKE_C_COMPILER_ID_RUN 1)
set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
set(CMAKE_C_LINKER_PREFERENCE 10)
# Save compiler ABI information.
set(CMAKE_C_SIZEOF_DATA_PTR "8")
set(CMAKE_C_COMPILER_ABI "ELF")
set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
if(CMAKE_C_SIZEOF_DATA_PTR)
set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
endif()
if(CMAKE_C_COMPILER_ABI)
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
endif()
if(CMAKE_C_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
endif()
set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "")
if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
endif()
set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/9/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include")
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s")
set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib")
set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")

View File

@ -0,0 +1,88 @@
set(CMAKE_CXX_COMPILER "/usr/bin/c++")
set(CMAKE_CXX_COMPILER_ARG1 "")
set(CMAKE_CXX_COMPILER_ID "GNU")
set(CMAKE_CXX_COMPILER_VERSION "9.3.0")
set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "")
set(CMAKE_CXX_COMPILER_WRAPPER "")
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "14")
set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20")
set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters")
set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates")
set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates")
set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17")
set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20")
set(CMAKE_CXX_PLATFORM_ID "Linux")
set(CMAKE_CXX_SIMULATE_ID "")
set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "")
set(CMAKE_CXX_SIMULATE_VERSION "")
set(CMAKE_AR "/usr/bin/ar")
set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar-9")
set(CMAKE_RANLIB "/usr/bin/ranlib")
set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib-9")
set(CMAKE_LINKER "/usr/bin/ld")
set(CMAKE_MT "")
set(CMAKE_COMPILER_IS_GNUCXX 1)
set(CMAKE_CXX_COMPILER_LOADED 1)
set(CMAKE_CXX_COMPILER_WORKS TRUE)
set(CMAKE_CXX_ABI_COMPILED TRUE)
set(CMAKE_COMPILER_IS_MINGW )
set(CMAKE_COMPILER_IS_CYGWIN )
if(CMAKE_COMPILER_IS_CYGWIN)
set(CYGWIN 1)
set(UNIX 1)
endif()
set(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
if(CMAKE_COMPILER_IS_MINGW)
set(MINGW 1)
endif()
set(CMAKE_CXX_COMPILER_ID_RUN 1)
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP)
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
foreach (lang C OBJC OBJCXX)
if (CMAKE_${lang}_COMPILER_ID_RUN)
foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS)
list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension})
endforeach()
endif()
endforeach()
set(CMAKE_CXX_LINKER_PREFERENCE 30)
set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
# Save compiler ABI information.
set(CMAKE_CXX_SIZEOF_DATA_PTR "8")
set(CMAKE_CXX_COMPILER_ABI "ELF")
set(CMAKE_CXX_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
if(CMAKE_CXX_SIZEOF_DATA_PTR)
set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}")
endif()
if(CMAKE_CXX_COMPILER_ABI)
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
endif()
if(CMAKE_CXX_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
endif()
set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "")
if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX)
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}")
endif()
set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/9;/usr/include/x86_64-linux-gnu/c++/9;/usr/include/c++/9/backward;/usr/lib/gcc/x86_64-linux-gnu/9/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include")
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc")
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib")
set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")

View File

@ -0,0 +1,15 @@
set(CMAKE_HOST_SYSTEM "Linux-5.13.0-27-generic")
set(CMAKE_HOST_SYSTEM_NAME "Linux")
set(CMAKE_HOST_SYSTEM_VERSION "5.13.0-27-generic")
set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
set(CMAKE_SYSTEM "Linux-5.13.0-27-generic")
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_VERSION "5.13.0-27-generic")
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(CMAKE_CROSSCOMPILING "FALSE")
set(CMAKE_SYSTEM_LOADED 1)

View File

@ -0,0 +1,671 @@
#ifdef __cplusplus
# error "A C++ compiler has been selected for C."
#endif
#if defined(__18CXX)
# define ID_VOID_MAIN
#endif
#if defined(__CLASSIC_C__)
/* cv-qualifiers did not exist in K&R C */
# define const
# define volatile
#endif
/* Version number components: V=Version, R=Revision, P=Patch
Version date components: YYYY=Year, MM=Month, DD=Day */
#if defined(__INTEL_COMPILER) || defined(__ICC)
# define COMPILER_ID "Intel"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# if defined(__GNUC__)
# define SIMULATE_ID "GNU"
# endif
/* __INTEL_COMPILER = VRP */
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
# if defined(__INTEL_COMPILER_UPDATE)
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
# else
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
# endif
# if defined(__INTEL_COMPILER_BUILD_DATE)
/* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
# endif
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
# if defined(__GNUC__)
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
# elif defined(__GNUG__)
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
# endif
# if defined(__GNUC_MINOR__)
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
# endif
# if defined(__GNUC_PATCHLEVEL__)
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
# endif
#elif defined(__PATHCC__)
# define COMPILER_ID "PathScale"
# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
# if defined(__PATHCC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
# endif
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
# define COMPILER_ID "Embarcadero"
# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
#elif defined(__BORLANDC__)
# define COMPILER_ID "Borland"
/* __BORLANDC__ = 0xVRR */
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
# define COMPILER_ID "Watcom"
/* __WATCOMC__ = VVRR */
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# if (__WATCOMC__ % 10) > 0
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
# endif
#elif defined(__WATCOMC__)
# define COMPILER_ID "OpenWatcom"
/* __WATCOMC__ = VVRP + 1100 */
# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# if (__WATCOMC__ % 10) > 0
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
# endif
#elif defined(__SUNPRO_C)
# define COMPILER_ID "SunPro"
# if __SUNPRO_C >= 0x5100
/* __SUNPRO_C = 0xVRRP */
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
# else
/* __SUNPRO_CC = 0xVRP */
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
# endif
#elif defined(__HP_cc)
# define COMPILER_ID "HP"
/* __HP_cc = VVRRPP */
# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100)
#elif defined(__DECC)
# define COMPILER_ID "Compaq"
/* __DECC_VER = VVRRTPPPP */
# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100)
# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)
#elif defined(__IBMC__) && defined(__COMPILER_VER__)
# define COMPILER_ID "zOS"
/* __IBMC__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
#elif defined(__ibmxl__) && defined(__clang__)
# define COMPILER_ID "XLClang"
# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800
# define COMPILER_ID "XL"
/* __IBMC__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800
# define COMPILER_ID "VisualAge"
/* __IBMC__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
#elif defined(__PGI)
# define COMPILER_ID "PGI"
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
# if defined(__PGIC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
# endif
#elif defined(_CRAYC)
# define COMPILER_ID "Cray"
# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
#elif defined(__TI_COMPILER_VERSION__)
# define COMPILER_ID "TI"
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)
# define COMPILER_ID "Fujitsu"
#elif defined(__ghs__)
# define COMPILER_ID "GHS"
/* __GHS_VERSION_NUMBER = VVVVRP */
# ifdef __GHS_VERSION_NUMBER
# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
# endif
#elif defined(__TINYC__)
# define COMPILER_ID "TinyCC"
#elif defined(__BCC__)
# define COMPILER_ID "Bruce"
#elif defined(__SCO_VERSION__)
# define COMPILER_ID "SCO"
#elif defined(__ARMCC_VERSION) && !defined(__clang__)
# define COMPILER_ID "ARMCC"
#if __ARMCC_VERSION >= 1000000
/* __ARMCC_VERSION = VRRPPPP */
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
#else
/* __ARMCC_VERSION = VRPPPP */
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
#endif
#elif defined(__clang__) && defined(__apple_build_version__)
# define COMPILER_ID "AppleClang"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
# define COMPILER_ID "ARMClang"
# define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
# define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
# define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000)
# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
#elif defined(__clang__)
# define COMPILER_ID "Clang"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
#elif defined(__GNUC__)
# define COMPILER_ID "GNU"
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
# if defined(__GNUC_MINOR__)
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
# endif
# if defined(__GNUC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
# endif
#elif defined(_MSC_VER)
# define COMPILER_ID "MSVC"
/* _MSC_VER = VVRR */
# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
# if defined(_MSC_FULL_VER)
# if _MSC_VER >= 1400
/* _MSC_FULL_VER = VVRRPPPPP */
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
# else
/* _MSC_FULL_VER = VVRRPPPP */
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
# endif
# endif
# if defined(_MSC_BUILD)
# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
# endif
#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
# define COMPILER_ID "ADSP"
#if defined(__VISUALDSPVERSION__)
/* __VISUALDSPVERSION__ = 0xVVRRPP00 */
# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
#endif
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
# define COMPILER_ID "IAR"
# if defined(__VER__) && defined(__ICCARM__)
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__))
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
# endif
#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC)
# define COMPILER_ID "SDCC"
# if defined(__SDCC_VERSION_MAJOR)
# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR)
# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR)
# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH)
# else
/* SDCC = VRP */
# define COMPILER_VERSION_MAJOR DEC(SDCC/100)
# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
# define COMPILER_VERSION_PATCH DEC(SDCC % 10)
# endif
/* These compilers are either not known or too old to define an
identification macro. Try to identify the platform and guess that
it is the native compiler. */
#elif defined(__hpux) || defined(__hpua)
# define COMPILER_ID "HP"
#else /* unknown compiler */
# define COMPILER_ID ""
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
#ifdef SIMULATE_ID
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
#endif
#ifdef __QNXNTO__
char const* qnxnto = "INFO" ":" "qnxnto[]";
#endif
#if defined(__CRAYXE) || defined(__CRAYXC)
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
#endif
#define STRINGIFY_HELPER(X) #X
#define STRINGIFY(X) STRINGIFY_HELPER(X)
/* Identify known platforms by name. */
#if defined(__linux) || defined(__linux__) || defined(linux)
# define PLATFORM_ID "Linux"
#elif defined(__CYGWIN__)
# define PLATFORM_ID "Cygwin"
#elif defined(__MINGW32__)
# define PLATFORM_ID "MinGW"
#elif defined(__APPLE__)
# define PLATFORM_ID "Darwin"
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
# define PLATFORM_ID "Windows"
#elif defined(__FreeBSD__) || defined(__FreeBSD)
# define PLATFORM_ID "FreeBSD"
#elif defined(__NetBSD__) || defined(__NetBSD)
# define PLATFORM_ID "NetBSD"
#elif defined(__OpenBSD__) || defined(__OPENBSD)
# define PLATFORM_ID "OpenBSD"
#elif defined(__sun) || defined(sun)
# define PLATFORM_ID "SunOS"
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
# define PLATFORM_ID "AIX"
#elif defined(__hpux) || defined(__hpux__)
# define PLATFORM_ID "HP-UX"
#elif defined(__HAIKU__)
# define PLATFORM_ID "Haiku"
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
# define PLATFORM_ID "BeOS"
#elif defined(__QNX__) || defined(__QNXNTO__)
# define PLATFORM_ID "QNX"
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
# define PLATFORM_ID "Tru64"
#elif defined(__riscos) || defined(__riscos__)
# define PLATFORM_ID "RISCos"
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
# define PLATFORM_ID "SINIX"
#elif defined(__UNIX_SV__)
# define PLATFORM_ID "UNIX_SV"
#elif defined(__bsdos__)
# define PLATFORM_ID "BSDOS"
#elif defined(_MPRAS) || defined(MPRAS)
# define PLATFORM_ID "MP-RAS"
#elif defined(__osf) || defined(__osf__)
# define PLATFORM_ID "OSF1"
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
# define PLATFORM_ID "SCO_SV"
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
# define PLATFORM_ID "ULTRIX"
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
# define PLATFORM_ID "Xenix"
#elif defined(__WATCOMC__)
# if defined(__LINUX__)
# define PLATFORM_ID "Linux"
# elif defined(__DOS__)
# define PLATFORM_ID "DOS"
# elif defined(__OS2__)
# define PLATFORM_ID "OS2"
# elif defined(__WINDOWS__)
# define PLATFORM_ID "Windows3x"
# else /* unknown platform */
# define PLATFORM_ID
# endif
#elif defined(__INTEGRITY)
# if defined(INT_178B)
# define PLATFORM_ID "Integrity178"
# else /* regular Integrity */
# define PLATFORM_ID "Integrity"
# endif
#else /* unknown platform */
# define PLATFORM_ID
#endif
/* For windows compilers MSVC and Intel we can determine
the architecture of the compiler being used. This is because
the compilers do not have flags that can change the architecture,
but rather depend on which compiler is being used
*/
#if defined(_WIN32) && defined(_MSC_VER)
# if defined(_M_IA64)
# define ARCHITECTURE_ID "IA64"
# elif defined(_M_X64) || defined(_M_AMD64)
# define ARCHITECTURE_ID "x64"
# elif defined(_M_IX86)
# define ARCHITECTURE_ID "X86"
# elif defined(_M_ARM64)
# define ARCHITECTURE_ID "ARM64"
# elif defined(_M_ARM)
# if _M_ARM == 4
# define ARCHITECTURE_ID "ARMV4I"
# elif _M_ARM == 5
# define ARCHITECTURE_ID "ARMV5I"
# else
# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
# endif
# elif defined(_M_MIPS)
# define ARCHITECTURE_ID "MIPS"
# elif defined(_M_SH)
# define ARCHITECTURE_ID "SHx"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__WATCOMC__)
# if defined(_M_I86)
# define ARCHITECTURE_ID "I86"
# elif defined(_M_IX86)
# define ARCHITECTURE_ID "X86"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
# if defined(__ICCARM__)
# define ARCHITECTURE_ID "ARM"
# elif defined(__ICCRX__)
# define ARCHITECTURE_ID "RX"
# elif defined(__ICCRH850__)
# define ARCHITECTURE_ID "RH850"
# elif defined(__ICCRL78__)
# define ARCHITECTURE_ID "RL78"
# elif defined(__ICCRISCV__)
# define ARCHITECTURE_ID "RISCV"
# elif defined(__ICCAVR__)
# define ARCHITECTURE_ID "AVR"
# elif defined(__ICC430__)
# define ARCHITECTURE_ID "MSP430"
# elif defined(__ICCV850__)
# define ARCHITECTURE_ID "V850"
# elif defined(__ICC8051__)
# define ARCHITECTURE_ID "8051"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__ghs__)
# if defined(__PPC64__)
# define ARCHITECTURE_ID "PPC64"
# elif defined(__ppc__)
# define ARCHITECTURE_ID "PPC"
# elif defined(__ARM__)
# define ARCHITECTURE_ID "ARM"
# elif defined(__x86_64__)
# define ARCHITECTURE_ID "x64"
# elif defined(__i386__)
# define ARCHITECTURE_ID "X86"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#else
# define ARCHITECTURE_ID
#endif
/* Convert integer to decimal digit literals. */
#define DEC(n) \
('0' + (((n) / 10000000)%10)), \
('0' + (((n) / 1000000)%10)), \
('0' + (((n) / 100000)%10)), \
('0' + (((n) / 10000)%10)), \
('0' + (((n) / 1000)%10)), \
('0' + (((n) / 100)%10)), \
('0' + (((n) / 10)%10)), \
('0' + ((n) % 10))
/* Convert integer to hex digit literals. */
#define HEX(n) \
('0' + ((n)>>28 & 0xF)), \
('0' + ((n)>>24 & 0xF)), \
('0' + ((n)>>20 & 0xF)), \
('0' + ((n)>>16 & 0xF)), \
('0' + ((n)>>12 & 0xF)), \
('0' + ((n)>>8 & 0xF)), \
('0' + ((n)>>4 & 0xF)), \
('0' + ((n) & 0xF))
/* Construct a string literal encoding the version number components. */
#ifdef COMPILER_VERSION_MAJOR
char const info_version[] = {
'I', 'N', 'F', 'O', ':',
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
COMPILER_VERSION_MAJOR,
# ifdef COMPILER_VERSION_MINOR
'.', COMPILER_VERSION_MINOR,
# ifdef COMPILER_VERSION_PATCH
'.', COMPILER_VERSION_PATCH,
# ifdef COMPILER_VERSION_TWEAK
'.', COMPILER_VERSION_TWEAK,
# endif
# endif
# endif
']','\0'};
#endif
/* Construct a string literal encoding the internal version number. */
#ifdef COMPILER_VERSION_INTERNAL
char const info_version_internal[] = {
'I', 'N', 'F', 'O', ':',
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
'i','n','t','e','r','n','a','l','[',
COMPILER_VERSION_INTERNAL,']','\0'};
#endif
/* Construct a string literal encoding the version number components. */
#ifdef SIMULATE_VERSION_MAJOR
char const info_simulate_version[] = {
'I', 'N', 'F', 'O', ':',
's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
SIMULATE_VERSION_MAJOR,
# ifdef SIMULATE_VERSION_MINOR
'.', SIMULATE_VERSION_MINOR,
# ifdef SIMULATE_VERSION_PATCH
'.', SIMULATE_VERSION_PATCH,
# ifdef SIMULATE_VERSION_TWEAK
'.', SIMULATE_VERSION_TWEAK,
# endif
# endif
# endif
']','\0'};
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
#if !defined(__STDC__)
# if (defined(_MSC_VER) && !defined(__clang__)) \
|| (defined(__ibmxl__) || defined(__IBMC__))
# define C_DIALECT "90"
# else
# define C_DIALECT
# endif
#elif __STDC_VERSION__ >= 201000L
# define C_DIALECT "11"
#elif __STDC_VERSION__ >= 199901L
# define C_DIALECT "99"
#else
# define C_DIALECT "90"
#endif
const char* info_language_dialect_default =
"INFO" ":" "dialect_default[" C_DIALECT "]";
/*--------------------------------------------------------------------------*/
#ifdef ID_VOID_MAIN
void main() {}
#else
# if defined(__CLASSIC_C__)
int main(argc, argv) int argc; char *argv[];
# else
int main(int argc, char* argv[])
# endif
{
int require = 0;
require += info_compiler[argc];
require += info_platform[argc];
require += info_arch[argc];
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
#ifdef COMPILER_VERSION_INTERNAL
require += info_version_internal[argc];
#endif
#ifdef SIMULATE_ID
require += info_simulate[argc];
#endif
#ifdef SIMULATE_VERSION_MAJOR
require += info_simulate_version[argc];
#endif
#if defined(__CRAYXE) || defined(__CRAYXC)
require += info_cray[argc];
#endif
require += info_language_dialect_default[argc];
(void)argv;
return require;
}
#endif

Binary file not shown.

View File

@ -0,0 +1,660 @@
/* This source file must have a .cpp extension so that all C++ compilers
recognize the extension without flags. Borland does not know .cxx for
example. */
#ifndef __cplusplus
# error "A C compiler has been selected for C++."
#endif
/* Version number components: V=Version, R=Revision, P=Patch
Version date components: YYYY=Year, MM=Month, DD=Day */
#if defined(__COMO__)
# define COMPILER_ID "Comeau"
/* __COMO_VERSION__ = VRR */
# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)
#elif defined(__INTEL_COMPILER) || defined(__ICC)
# define COMPILER_ID "Intel"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# if defined(__GNUC__)
# define SIMULATE_ID "GNU"
# endif
/* __INTEL_COMPILER = VRP */
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
# if defined(__INTEL_COMPILER_UPDATE)
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
# else
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
# endif
# if defined(__INTEL_COMPILER_BUILD_DATE)
/* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
# endif
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
# if defined(__GNUC__)
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
# elif defined(__GNUG__)
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
# endif
# if defined(__GNUC_MINOR__)
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
# endif
# if defined(__GNUC_PATCHLEVEL__)
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
# endif
#elif defined(__PATHCC__)
# define COMPILER_ID "PathScale"
# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
# if defined(__PATHCC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
# endif
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
# define COMPILER_ID "Embarcadero"
# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
#elif defined(__BORLANDC__)
# define COMPILER_ID "Borland"
/* __BORLANDC__ = 0xVRR */
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
# define COMPILER_ID "Watcom"
/* __WATCOMC__ = VVRR */
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# if (__WATCOMC__ % 10) > 0
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
# endif
#elif defined(__WATCOMC__)
# define COMPILER_ID "OpenWatcom"
/* __WATCOMC__ = VVRP + 1100 */
# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# if (__WATCOMC__ % 10) > 0
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
# endif
#elif defined(__SUNPRO_CC)
# define COMPILER_ID "SunPro"
# if __SUNPRO_CC >= 0x5100
/* __SUNPRO_CC = 0xVRRP */
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
# else
/* __SUNPRO_CC = 0xVRP */
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
# endif
#elif defined(__HP_aCC)
# define COMPILER_ID "HP"
/* __HP_aCC = VVRRPP */
# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100)
#elif defined(__DECCXX)
# define COMPILER_ID "Compaq"
/* __DECCXX_VER = VVRRTPPPP */
# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100)
# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000)
#elif defined(__IBMCPP__) && defined(__COMPILER_VER__)
# define COMPILER_ID "zOS"
/* __IBMCPP__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
#elif defined(__ibmxl__) && defined(__clang__)
# define COMPILER_ID "XLClang"
# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800
# define COMPILER_ID "XL"
/* __IBMCPP__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800
# define COMPILER_ID "VisualAge"
/* __IBMCPP__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
#elif defined(__PGI)
# define COMPILER_ID "PGI"
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
# if defined(__PGIC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
# endif
#elif defined(_CRAYC)
# define COMPILER_ID "Cray"
# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
#elif defined(__TI_COMPILER_VERSION__)
# define COMPILER_ID "TI"
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)
# define COMPILER_ID "Fujitsu"
#elif defined(__ghs__)
# define COMPILER_ID "GHS"
/* __GHS_VERSION_NUMBER = VVVVRP */
# ifdef __GHS_VERSION_NUMBER
# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
# endif
#elif defined(__SCO_VERSION__)
# define COMPILER_ID "SCO"
#elif defined(__ARMCC_VERSION) && !defined(__clang__)
# define COMPILER_ID "ARMCC"
#if __ARMCC_VERSION >= 1000000
/* __ARMCC_VERSION = VRRPPPP */
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
#else
/* __ARMCC_VERSION = VRPPPP */
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
#endif
#elif defined(__clang__) && defined(__apple_build_version__)
# define COMPILER_ID "AppleClang"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
# define COMPILER_ID "ARMClang"
# define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
# define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
# define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000)
# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
#elif defined(__clang__)
# define COMPILER_ID "Clang"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
#elif defined(__GNUC__) || defined(__GNUG__)
# define COMPILER_ID "GNU"
# if defined(__GNUC__)
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
# else
# define COMPILER_VERSION_MAJOR DEC(__GNUG__)
# endif
# if defined(__GNUC_MINOR__)
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
# endif
# if defined(__GNUC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
# endif
#elif defined(_MSC_VER)
# define COMPILER_ID "MSVC"
/* _MSC_VER = VVRR */
# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
# if defined(_MSC_FULL_VER)
# if _MSC_VER >= 1400
/* _MSC_FULL_VER = VVRRPPPPP */
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
# else
/* _MSC_FULL_VER = VVRRPPPP */
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
# endif
# endif
# if defined(_MSC_BUILD)
# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
# endif
#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
# define COMPILER_ID "ADSP"
#if defined(__VISUALDSPVERSION__)
/* __VISUALDSPVERSION__ = 0xVVRRPP00 */
# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
#endif
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
# define COMPILER_ID "IAR"
# if defined(__VER__) && defined(__ICCARM__)
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__))
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
# endif
/* These compilers are either not known or too old to define an
identification macro. Try to identify the platform and guess that
it is the native compiler. */
#elif defined(__hpux) || defined(__hpua)
# define COMPILER_ID "HP"
#else /* unknown compiler */
# define COMPILER_ID ""
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
#ifdef SIMULATE_ID
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
#endif
#ifdef __QNXNTO__
char const* qnxnto = "INFO" ":" "qnxnto[]";
#endif
#if defined(__CRAYXE) || defined(__CRAYXC)
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
#endif
#define STRINGIFY_HELPER(X) #X
#define STRINGIFY(X) STRINGIFY_HELPER(X)
/* Identify known platforms by name. */
#if defined(__linux) || defined(__linux__) || defined(linux)
# define PLATFORM_ID "Linux"
#elif defined(__CYGWIN__)
# define PLATFORM_ID "Cygwin"
#elif defined(__MINGW32__)
# define PLATFORM_ID "MinGW"
#elif defined(__APPLE__)
# define PLATFORM_ID "Darwin"
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
# define PLATFORM_ID "Windows"
#elif defined(__FreeBSD__) || defined(__FreeBSD)
# define PLATFORM_ID "FreeBSD"
#elif defined(__NetBSD__) || defined(__NetBSD)
# define PLATFORM_ID "NetBSD"
#elif defined(__OpenBSD__) || defined(__OPENBSD)
# define PLATFORM_ID "OpenBSD"
#elif defined(__sun) || defined(sun)
# define PLATFORM_ID "SunOS"
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
# define PLATFORM_ID "AIX"
#elif defined(__hpux) || defined(__hpux__)
# define PLATFORM_ID "HP-UX"
#elif defined(__HAIKU__)
# define PLATFORM_ID "Haiku"
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
# define PLATFORM_ID "BeOS"
#elif defined(__QNX__) || defined(__QNXNTO__)
# define PLATFORM_ID "QNX"
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
# define PLATFORM_ID "Tru64"
#elif defined(__riscos) || defined(__riscos__)
# define PLATFORM_ID "RISCos"
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
# define PLATFORM_ID "SINIX"
#elif defined(__UNIX_SV__)
# define PLATFORM_ID "UNIX_SV"
#elif defined(__bsdos__)
# define PLATFORM_ID "BSDOS"
#elif defined(_MPRAS) || defined(MPRAS)
# define PLATFORM_ID "MP-RAS"
#elif defined(__osf) || defined(__osf__)
# define PLATFORM_ID "OSF1"
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
# define PLATFORM_ID "SCO_SV"
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
# define PLATFORM_ID "ULTRIX"
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
# define PLATFORM_ID "Xenix"
#elif defined(__WATCOMC__)
# if defined(__LINUX__)
# define PLATFORM_ID "Linux"
# elif defined(__DOS__)
# define PLATFORM_ID "DOS"
# elif defined(__OS2__)
# define PLATFORM_ID "OS2"
# elif defined(__WINDOWS__)
# define PLATFORM_ID "Windows3x"
# else /* unknown platform */
# define PLATFORM_ID
# endif
#elif defined(__INTEGRITY)
# if defined(INT_178B)
# define PLATFORM_ID "Integrity178"
# else /* regular Integrity */
# define PLATFORM_ID "Integrity"
# endif
#else /* unknown platform */
# define PLATFORM_ID
#endif
/* For windows compilers MSVC and Intel we can determine
the architecture of the compiler being used. This is because
the compilers do not have flags that can change the architecture,
but rather depend on which compiler is being used
*/
#if defined(_WIN32) && defined(_MSC_VER)
# if defined(_M_IA64)
# define ARCHITECTURE_ID "IA64"
# elif defined(_M_X64) || defined(_M_AMD64)
# define ARCHITECTURE_ID "x64"
# elif defined(_M_IX86)
# define ARCHITECTURE_ID "X86"
# elif defined(_M_ARM64)
# define ARCHITECTURE_ID "ARM64"
# elif defined(_M_ARM)
# if _M_ARM == 4
# define ARCHITECTURE_ID "ARMV4I"
# elif _M_ARM == 5
# define ARCHITECTURE_ID "ARMV5I"
# else
# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
# endif
# elif defined(_M_MIPS)
# define ARCHITECTURE_ID "MIPS"
# elif defined(_M_SH)
# define ARCHITECTURE_ID "SHx"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__WATCOMC__)
# if defined(_M_I86)
# define ARCHITECTURE_ID "I86"
# elif defined(_M_IX86)
# define ARCHITECTURE_ID "X86"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
# if defined(__ICCARM__)
# define ARCHITECTURE_ID "ARM"
# elif defined(__ICCRX__)
# define ARCHITECTURE_ID "RX"
# elif defined(__ICCRH850__)
# define ARCHITECTURE_ID "RH850"
# elif defined(__ICCRL78__)
# define ARCHITECTURE_ID "RL78"
# elif defined(__ICCRISCV__)
# define ARCHITECTURE_ID "RISCV"
# elif defined(__ICCAVR__)
# define ARCHITECTURE_ID "AVR"
# elif defined(__ICC430__)
# define ARCHITECTURE_ID "MSP430"
# elif defined(__ICCV850__)
# define ARCHITECTURE_ID "V850"
# elif defined(__ICC8051__)
# define ARCHITECTURE_ID "8051"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__ghs__)
# if defined(__PPC64__)
# define ARCHITECTURE_ID "PPC64"
# elif defined(__ppc__)
# define ARCHITECTURE_ID "PPC"
# elif defined(__ARM__)
# define ARCHITECTURE_ID "ARM"
# elif defined(__x86_64__)
# define ARCHITECTURE_ID "x64"
# elif defined(__i386__)
# define ARCHITECTURE_ID "X86"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#else
# define ARCHITECTURE_ID
#endif
/* Convert integer to decimal digit literals. */
#define DEC(n) \
('0' + (((n) / 10000000)%10)), \
('0' + (((n) / 1000000)%10)), \
('0' + (((n) / 100000)%10)), \
('0' + (((n) / 10000)%10)), \
('0' + (((n) / 1000)%10)), \
('0' + (((n) / 100)%10)), \
('0' + (((n) / 10)%10)), \
('0' + ((n) % 10))
/* Convert integer to hex digit literals. */
#define HEX(n) \
('0' + ((n)>>28 & 0xF)), \
('0' + ((n)>>24 & 0xF)), \
('0' + ((n)>>20 & 0xF)), \
('0' + ((n)>>16 & 0xF)), \
('0' + ((n)>>12 & 0xF)), \
('0' + ((n)>>8 & 0xF)), \
('0' + ((n)>>4 & 0xF)), \
('0' + ((n) & 0xF))
/* Construct a string literal encoding the version number components. */
#ifdef COMPILER_VERSION_MAJOR
char const info_version[] = {
'I', 'N', 'F', 'O', ':',
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
COMPILER_VERSION_MAJOR,
# ifdef COMPILER_VERSION_MINOR
'.', COMPILER_VERSION_MINOR,
# ifdef COMPILER_VERSION_PATCH
'.', COMPILER_VERSION_PATCH,
# ifdef COMPILER_VERSION_TWEAK
'.', COMPILER_VERSION_TWEAK,
# endif
# endif
# endif
']','\0'};
#endif
/* Construct a string literal encoding the internal version number. */
#ifdef COMPILER_VERSION_INTERNAL
char const info_version_internal[] = {
'I', 'N', 'F', 'O', ':',
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
'i','n','t','e','r','n','a','l','[',
COMPILER_VERSION_INTERNAL,']','\0'};
#endif
/* Construct a string literal encoding the version number components. */
#ifdef SIMULATE_VERSION_MAJOR
char const info_simulate_version[] = {
'I', 'N', 'F', 'O', ':',
's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
SIMULATE_VERSION_MAJOR,
# ifdef SIMULATE_VERSION_MINOR
'.', SIMULATE_VERSION_MINOR,
# ifdef SIMULATE_VERSION_PATCH
'.', SIMULATE_VERSION_PATCH,
# ifdef SIMULATE_VERSION_TWEAK
'.', SIMULATE_VERSION_TWEAK,
# endif
# endif
# endif
']','\0'};
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L
# if defined(__INTEL_CXX11_MODE__)
# if defined(__cpp_aggregate_nsdmi)
# define CXX_STD 201402L
# else
# define CXX_STD 201103L
# endif
# else
# define CXX_STD 199711L
# endif
#elif defined(_MSC_VER) && defined(_MSVC_LANG)
# define CXX_STD _MSVC_LANG
#else
# define CXX_STD __cplusplus
#endif
const char* info_language_dialect_default = "INFO" ":" "dialect_default["
#if CXX_STD > 201703L
"20"
#elif CXX_STD >= 201703L
"17"
#elif CXX_STD >= 201402L
"14"
#elif CXX_STD >= 201103L
"11"
#else
"98"
#endif
"]";
/*--------------------------------------------------------------------------*/
int main(int argc, char* argv[])
{
int require = 0;
require += info_compiler[argc];
require += info_platform[argc];
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
#ifdef COMPILER_VERSION_INTERNAL
require += info_version_internal[argc];
#endif
#ifdef SIMULATE_ID
require += info_simulate[argc];
#endif
#ifdef SIMULATE_VERSION_MAJOR
require += info_simulate_version[argc];
#endif
#if defined(__CRAYXE) || defined(__CRAYXC)
require += info_cray[argc];
#endif
require += info_language_dialect_default[argc];
(void)argv;
return require;
}

Binary file not shown.

View File

@ -0,0 +1,16 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.16
# Relative path conversion top directories.
set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/sam/Z-Sharp/ZSharp")
set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/sam/Z-Sharp/ZSharp/linux-build")
# Force unix paths in dependencies.
set(CMAKE_FORCE_UNIX_PATHS 1)
# The C and CXX include file regular expressions for this directory.
set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})

View File

@ -0,0 +1,64 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.16
# The generator used is:
set(CMAKE_DEPENDS_GENERATOR "Unix Makefiles")
# The top level Makefile was generated from the following files:
set(CMAKE_MAKEFILE_DEPENDS
"CMakeCache.txt"
"../CMakeFiles/FindSDL2_image.cmake"
"../CMakeFiles/FindSDL2_ttf.cmake"
"../CMakeLists.txt"
"CMakeFiles/3.16.3/CMakeCCompiler.cmake"
"CMakeFiles/3.16.3/CMakeCXXCompiler.cmake"
"CMakeFiles/3.16.3/CMakeSystem.cmake"
"/usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake"
"/usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfigVersion.cmake"
"/usr/lib/x86_64-linux-gnu/cmake/BoostDetectToolset-1.71.0.cmake"
"/usr/lib/x86_64-linux-gnu/cmake/SDL2/sdl2-config.cmake"
"/usr/lib/x86_64-linux-gnu/cmake/boost_headers-1.71.0/boost_headers-config-version.cmake"
"/usr/lib/x86_64-linux-gnu/cmake/boost_headers-1.71.0/boost_headers-config.cmake"
"/usr/lib/x86_64-linux-gnu/cmake/boost_system-1.71.0/boost_system-config-version.cmake"
"/usr/lib/x86_64-linux-gnu/cmake/boost_system-1.71.0/boost_system-config.cmake"
"/usr/lib/x86_64-linux-gnu/cmake/boost_system-1.71.0/libboost_system-variant-shared.cmake"
"/usr/lib/x86_64-linux-gnu/cmake/boost_system-1.71.0/libboost_system-variant-static.cmake"
"/usr/share/cmake-3.16/Modules/CMakeCInformation.cmake"
"/usr/share/cmake-3.16/Modules/CMakeCXXInformation.cmake"
"/usr/share/cmake-3.16/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake"
"/usr/share/cmake-3.16/Modules/CMakeCommonLanguageInclude.cmake"
"/usr/share/cmake-3.16/Modules/CMakeGenericSystem.cmake"
"/usr/share/cmake-3.16/Modules/CMakeInitializeConfigs.cmake"
"/usr/share/cmake-3.16/Modules/CMakeLanguageInformation.cmake"
"/usr/share/cmake-3.16/Modules/CMakeSystemSpecificInformation.cmake"
"/usr/share/cmake-3.16/Modules/CMakeSystemSpecificInitialize.cmake"
"/usr/share/cmake-3.16/Modules/Compiler/CMakeCommonCompilerMacros.cmake"
"/usr/share/cmake-3.16/Modules/Compiler/GNU-C.cmake"
"/usr/share/cmake-3.16/Modules/Compiler/GNU-CXX.cmake"
"/usr/share/cmake-3.16/Modules/Compiler/GNU.cmake"
"/usr/share/cmake-3.16/Modules/FindBoost.cmake"
"/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake"
"/usr/share/cmake-3.16/Modules/FindPackageMessage.cmake"
"/usr/share/cmake-3.16/Modules/Internal/CMakeCheckCompilerFlag.cmake"
"/usr/share/cmake-3.16/Modules/Platform/Linux-GNU-C.cmake"
"/usr/share/cmake-3.16/Modules/Platform/Linux-GNU-CXX.cmake"
"/usr/share/cmake-3.16/Modules/Platform/Linux-GNU.cmake"
"/usr/share/cmake-3.16/Modules/Platform/Linux.cmake"
"/usr/share/cmake-3.16/Modules/Platform/UnixPaths.cmake"
)
# The corresponding makefile is:
set(CMAKE_MAKEFILE_OUTPUTS
"Makefile"
"CMakeFiles/cmake.check_cache"
)
# Byproducts of CMake generate step:
set(CMAKE_MAKEFILE_PRODUCTS
"CMakeFiles/CMakeDirectoryInformation.cmake"
)
# Dependency information for all targets:
set(CMAKE_DEPEND_INFO_FILES
"CMakeFiles/ZSharp.dir/DependInfo.cmake"
)

View File

@ -0,0 +1,106 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.16
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file.
RM = /usr/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/sam/Z-Sharp/ZSharp
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/sam/Z-Sharp/ZSharp/linux-build
#=============================================================================
# Directory level rules for the build root directory
# The main recursive "all" target.
all: CMakeFiles/ZSharp.dir/all
.PHONY : all
# The main recursive "preinstall" target.
preinstall:
.PHONY : preinstall
# The main recursive "clean" target.
clean: CMakeFiles/ZSharp.dir/clean
.PHONY : clean
#=============================================================================
# Target rules for target CMakeFiles/ZSharp.dir
# All Build rule for target.
CMakeFiles/ZSharp.dir/all:
$(MAKE) -f CMakeFiles/ZSharp.dir/build.make CMakeFiles/ZSharp.dir/depend
$(MAKE) -f CMakeFiles/ZSharp.dir/build.make CMakeFiles/ZSharp.dir/build
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles --progress-num=1,2,3,4 "Built target ZSharp"
.PHONY : CMakeFiles/ZSharp.dir/all
# Build rule for subdir invocation for target.
CMakeFiles/ZSharp.dir/rule: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles 4
$(MAKE) -f CMakeFiles/Makefile2 CMakeFiles/ZSharp.dir/all
$(CMAKE_COMMAND) -E cmake_progress_start /home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles 0
.PHONY : CMakeFiles/ZSharp.dir/rule
# Convenience name for target.
ZSharp: CMakeFiles/ZSharp.dir/rule
.PHONY : ZSharp
# clean rule for target.
CMakeFiles/ZSharp.dir/clean:
$(MAKE) -f CMakeFiles/ZSharp.dir/build.make CMakeFiles/ZSharp.dir/clean
.PHONY : CMakeFiles/ZSharp.dir/clean
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system

View File

@ -0,0 +1,3 @@
/home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles/rebuild_cache.dir
/home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles/edit_cache.dir
/home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles/ZSharp.dir

View File

@ -0,0 +1,816 @@
#IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">])
#IncludeRegexScan: ^.*$
#IncludeRegexComplain: ^$
#IncludeRegexTransform:
/home/sam/Z-Sharp/ZSharp/Main.cpp
iostream
-
fstream
-
string
-
regex
-
limits
-
algorithm
-
cstdlib
-
sstream
-
boost/any.hpp
-
unordered_map
-
stdio.h
-
codecvt
-
unistd.h
-
filesystem
-
windows.h
-
eval.h
/home/sam/Z-Sharp/ZSharp/eval.h
strops.h
/home/sam/Z-Sharp/ZSharp/strops.h
builtin.h
/home/sam/Z-Sharp/ZSharp/builtin.h
main.h
/home/sam/Z-Sharp/ZSharp/main.h
anyops.h
/home/sam/Z-Sharp/ZSharp/anyops.h
ZS.h
/home/sam/Z-Sharp/ZSharp/ZS.h
/home/sam/Z-Sharp/ZSharp/ZS.h
string
-
/home/sam/Z-Sharp/ZSharp/anyops.h
builtin.h
/home/sam/Z-Sharp/ZSharp/builtin.h
boost/any.hpp
-
/home/sam/Z-Sharp/ZSharp/builtin.h
iostream
-
fstream
-
string
-
regex
-
limits
-
algorithm
-
unordered_map
-
boost/any.hpp
-
SDL.h
-
ctime
-
math.h
-
strops.h
/home/sam/Z-Sharp/ZSharp/strops.h
graphics.h
/home/sam/Z-Sharp/ZSharp/graphics.h
anyops.h
/home/sam/Z-Sharp/ZSharp/anyops.h
color.hpp
/home/sam/Z-Sharp/ZSharp/color.hpp
/home/sam/Z-Sharp/ZSharp/color.hpp
algorithm
-
iostream
-
list
-
map
-
string
-
type_traits
-
utility
-
windows.h
-
/home/sam/Z-Sharp/ZSharp/eval.cpp
iostream
-
fstream
-
string
-
regex
-
limits
-
stack
-
eval.h
/home/sam/Z-Sharp/ZSharp/eval.h
strops.h
/home/sam/Z-Sharp/ZSharp/strops.h
math.h
-
/home/sam/Z-Sharp/ZSharp/eval.h
/home/sam/Z-Sharp/ZSharp/graphics.h
iostream
-
fstream
-
string
-
regex
-
limits
-
algorithm
-
boost/any.hpp
-
strops.h
/home/sam/Z-Sharp/ZSharp/strops.h
main.h
/home/sam/Z-Sharp/ZSharp/main.h
SDL.h
-
SDL_image.h
-
stdio.h
-
chrono
-
SDL.h
-
SDL_ttf.h
-
SDL_image.h
-
string
-
any
-
/home/sam/Z-Sharp/ZSharp/main.h
/home/sam/Z-Sharp/ZSharp/strops.cpp
iostream
-
fstream
-
string
-
regex
-
limits
-
boost/any.hpp
-
strops.h
/home/sam/Z-Sharp/ZSharp/strops.h
/home/sam/Z-Sharp/ZSharp/strops.h
boost/any.hpp
-
/usr/include/SDL2/SDL.h
SDL_main.h
/usr/include/SDL2/SDL_main.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_assert.h
/usr/include/SDL2/SDL_assert.h
SDL_atomic.h
/usr/include/SDL2/SDL_atomic.h
SDL_audio.h
/usr/include/SDL2/SDL_audio.h
SDL_clipboard.h
/usr/include/SDL2/SDL_clipboard.h
SDL_cpuinfo.h
/usr/include/SDL2/SDL_cpuinfo.h
SDL_endian.h
/usr/include/SDL2/SDL_endian.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
SDL_events.h
/usr/include/SDL2/SDL_events.h
SDL_filesystem.h
/usr/include/SDL2/SDL_filesystem.h
SDL_gamecontroller.h
/usr/include/SDL2/SDL_gamecontroller.h
SDL_haptic.h
/usr/include/SDL2/SDL_haptic.h
SDL_hints.h
/usr/include/SDL2/SDL_hints.h
SDL_joystick.h
/usr/include/SDL2/SDL_joystick.h
SDL_loadso.h
/usr/include/SDL2/SDL_loadso.h
SDL_log.h
/usr/include/SDL2/SDL_log.h
SDL_messagebox.h
/usr/include/SDL2/SDL_messagebox.h
SDL_mutex.h
/usr/include/SDL2/SDL_mutex.h
SDL_power.h
/usr/include/SDL2/SDL_power.h
SDL_render.h
/usr/include/SDL2/SDL_render.h
SDL_rwops.h
/usr/include/SDL2/SDL_rwops.h
SDL_sensor.h
/usr/include/SDL2/SDL_sensor.h
SDL_shape.h
/usr/include/SDL2/SDL_shape.h
SDL_system.h
/usr/include/SDL2/SDL_system.h
SDL_thread.h
/usr/include/SDL2/SDL_thread.h
SDL_timer.h
/usr/include/SDL2/SDL_timer.h
SDL_version.h
/usr/include/SDL2/SDL_version.h
SDL_video.h
/usr/include/SDL2/SDL_video.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_assert.h
SDL_config.h
/usr/include/SDL2/SDL_config.h
begin_code.h
/usr/include/SDL2/begin_code.h
signal.h
-
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_atomic.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_platform.h
/usr/include/SDL2/SDL_platform.h
begin_code.h
/usr/include/SDL2/begin_code.h
sys/cpuinline.h
-
mbarrier.h
-
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_audio.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
SDL_endian.h
/usr/include/SDL2/SDL_endian.h
SDL_mutex.h
/usr/include/SDL2/SDL_mutex.h
SDL_thread.h
/usr/include/SDL2/SDL_thread.h
SDL_rwops.h
/usr/include/SDL2/SDL_rwops.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_blendmode.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_clipboard.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_config.h
SDL2/_real_SDL_config.h
-
/usr/include/SDL2/SDL_cpuinfo.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
intrin.h
-
intrin.h
-
altivec.h
-
arm_neon.h
-
armintr.h
-
arm_neon.h
-
armintr.h
-
arm_neon.h
-
mm3dnow.h
-
immintrin.h
-
mmintrin.h
-
xmmintrin.h
-
emmintrin.h
-
pmmintrin.h
-
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_endian.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
endian.h
-
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_error.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_events.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
SDL_video.h
/usr/include/SDL2/SDL_video.h
SDL_keyboard.h
/usr/include/SDL2/SDL_keyboard.h
SDL_mouse.h
/usr/include/SDL2/SDL_mouse.h
SDL_joystick.h
/usr/include/SDL2/SDL_joystick.h
SDL_gamecontroller.h
/usr/include/SDL2/SDL_gamecontroller.h
SDL_quit.h
/usr/include/SDL2/SDL_quit.h
SDL_gesture.h
/usr/include/SDL2/SDL_gesture.h
SDL_touch.h
/usr/include/SDL2/SDL_touch.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_filesystem.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_gamecontroller.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
SDL_rwops.h
/usr/include/SDL2/SDL_rwops.h
SDL_joystick.h
/usr/include/SDL2/SDL_joystick.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_gesture.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
SDL_video.h
/usr/include/SDL2/SDL_video.h
SDL_touch.h
/usr/include/SDL2/SDL_touch.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_haptic.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
SDL_joystick.h
/usr/include/SDL2/SDL_joystick.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_hints.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_image.h
SDL.h
/usr/include/SDL2/SDL.h
SDL_version.h
/usr/include/SDL2/SDL_version.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_joystick.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_keyboard.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
SDL_keycode.h
/usr/include/SDL2/SDL_keycode.h
SDL_video.h
/usr/include/SDL2/SDL_video.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_keycode.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_scancode.h
/usr/include/SDL2/SDL_scancode.h
/usr/include/SDL2/SDL_loadso.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_log.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_main.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_messagebox.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_video.h
/usr/include/SDL2/SDL_video.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_mouse.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
SDL_video.h
/usr/include/SDL2/SDL_video.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_mutex.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_pixels.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_endian.h
/usr/include/SDL2/SDL_endian.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_platform.h
AvailabilityMacros.h
/usr/include/SDL2/AvailabilityMacros.h
TargetConditionals.h
/usr/include/SDL2/TargetConditionals.h
winapifamily.h
-
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_power.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_quit.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
/usr/include/SDL2/SDL_rect.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
SDL_pixels.h
/usr/include/SDL2/SDL_pixels.h
SDL_rwops.h
/usr/include/SDL2/SDL_rwops.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_render.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_rect.h
/usr/include/SDL2/SDL_rect.h
SDL_video.h
/usr/include/SDL2/SDL_video.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_rwops.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_scancode.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
/usr/include/SDL2/SDL_sensor.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_shape.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_pixels.h
/usr/include/SDL2/SDL_pixels.h
SDL_rect.h
/usr/include/SDL2/SDL_rect.h
SDL_surface.h
/usr/include/SDL2/SDL_surface.h
SDL_video.h
/usr/include/SDL2/SDL_video.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_stdinc.h
SDL_config.h
/usr/include/SDL2/SDL_config.h
sys/types.h
-
stdio.h
-
stdlib.h
-
stddef.h
-
stdarg.h
-
stdlib.h
-
malloc.h
-
stddef.h
-
stdarg.h
-
memory.h
-
string.h
-
strings.h
-
wchar.h
-
inttypes.h
-
stdint.h
-
ctype.h
-
math.h
-
float.h
-
alloca.h
-
malloc.h
-
malloc.h
-
malloc.h
-
stdlib.h
-
sal.h
-
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_surface.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_pixels.h
/usr/include/SDL2/SDL_pixels.h
SDL_rect.h
/usr/include/SDL2/SDL_rect.h
SDL_blendmode.h
/usr/include/SDL2/SDL_blendmode.h
SDL_rwops.h
/usr/include/SDL2/SDL_rwops.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_system.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_keyboard.h
/usr/include/SDL2/SDL_keyboard.h
SDL_render.h
/usr/include/SDL2/SDL_render.h
SDL_video.h
/usr/include/SDL2/SDL_video.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_thread.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
SDL_atomic.h
/usr/include/SDL2/SDL_atomic.h
SDL_mutex.h
/usr/include/SDL2/SDL_mutex.h
begin_code.h
/usr/include/SDL2/begin_code.h
process.h
-
process.h
-
stdlib.h
-
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_timer.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_touch.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_error.h
/usr/include/SDL2/SDL_error.h
SDL_video.h
/usr/include/SDL2/SDL_video.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_ttf.h
SDL.h
/usr/include/SDL2/SDL.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_version.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/SDL_video.h
SDL_stdinc.h
/usr/include/SDL2/SDL_stdinc.h
SDL_pixels.h
/usr/include/SDL2/SDL_pixels.h
SDL_rect.h
/usr/include/SDL2/SDL_rect.h
SDL_surface.h
/usr/include/SDL2/SDL_surface.h
begin_code.h
/usr/include/SDL2/begin_code.h
close_code.h
/usr/include/SDL2/close_code.h
/usr/include/SDL2/begin_code.h
/usr/include/SDL2/close_code.h

View File

@ -0,0 +1,29 @@
# The set of languages for which implicit dependencies are needed:
set(CMAKE_DEPENDS_LANGUAGES
"CXX"
)
# The set of files for implicit dependencies of each language:
set(CMAKE_DEPENDS_CHECK_CXX
"/home/sam/Z-Sharp/ZSharp/Main.cpp" "/home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles/ZSharp.dir/Main.cpp.o"
"/home/sam/Z-Sharp/ZSharp/eval.cpp" "/home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles/ZSharp.dir/eval.cpp.o"
"/home/sam/Z-Sharp/ZSharp/strops.cpp" "/home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles/ZSharp.dir/strops.cpp.o"
)
set(CMAKE_CXX_COMPILER_ID "GNU")
# Preprocessor definitions for this target.
set(CMAKE_TARGET_DEFINITIONS_CXX
"BOOST_ALL_NO_LIB"
"BOOST_SYSTEM_DYN_LINK"
)
# The include file search paths:
set(CMAKE_CXX_TARGET_INCLUDE_PATH
"/usr/include/SDL2"
)
# Targets to which this target links.
set(CMAKE_TARGET_LINKED_INFO_FILES
)
# Fortran module output directory.
set(CMAKE_Fortran_TARGET_MODULE_DIR "")

Binary file not shown.

View File

@ -0,0 +1,131 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.16
# Delete rule output on recipe failure.
.DELETE_ON_ERROR:
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file.
RM = /usr/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/sam/Z-Sharp/ZSharp
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/sam/Z-Sharp/ZSharp/linux-build
# Include any dependencies generated for this target.
include CMakeFiles/ZSharp.dir/depend.make
# Include the progress variables for this target.
include CMakeFiles/ZSharp.dir/progress.make
# Include the compile flags for this target's objects.
include CMakeFiles/ZSharp.dir/flags.make
CMakeFiles/ZSharp.dir/Main.cpp.o: CMakeFiles/ZSharp.dir/flags.make
CMakeFiles/ZSharp.dir/Main.cpp.o: ../Main.cpp
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object CMakeFiles/ZSharp.dir/Main.cpp.o"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/ZSharp.dir/Main.cpp.o -c /home/sam/Z-Sharp/ZSharp/Main.cpp
CMakeFiles/ZSharp.dir/Main.cpp.i: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/ZSharp.dir/Main.cpp.i"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/sam/Z-Sharp/ZSharp/Main.cpp > CMakeFiles/ZSharp.dir/Main.cpp.i
CMakeFiles/ZSharp.dir/Main.cpp.s: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/ZSharp.dir/Main.cpp.s"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/sam/Z-Sharp/ZSharp/Main.cpp -o CMakeFiles/ZSharp.dir/Main.cpp.s
CMakeFiles/ZSharp.dir/strops.cpp.o: CMakeFiles/ZSharp.dir/flags.make
CMakeFiles/ZSharp.dir/strops.cpp.o: ../strops.cpp
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building CXX object CMakeFiles/ZSharp.dir/strops.cpp.o"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/ZSharp.dir/strops.cpp.o -c /home/sam/Z-Sharp/ZSharp/strops.cpp
CMakeFiles/ZSharp.dir/strops.cpp.i: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/ZSharp.dir/strops.cpp.i"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/sam/Z-Sharp/ZSharp/strops.cpp > CMakeFiles/ZSharp.dir/strops.cpp.i
CMakeFiles/ZSharp.dir/strops.cpp.s: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/ZSharp.dir/strops.cpp.s"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/sam/Z-Sharp/ZSharp/strops.cpp -o CMakeFiles/ZSharp.dir/strops.cpp.s
CMakeFiles/ZSharp.dir/eval.cpp.o: CMakeFiles/ZSharp.dir/flags.make
CMakeFiles/ZSharp.dir/eval.cpp.o: ../eval.cpp
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Building CXX object CMakeFiles/ZSharp.dir/eval.cpp.o"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/ZSharp.dir/eval.cpp.o -c /home/sam/Z-Sharp/ZSharp/eval.cpp
CMakeFiles/ZSharp.dir/eval.cpp.i: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/ZSharp.dir/eval.cpp.i"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/sam/Z-Sharp/ZSharp/eval.cpp > CMakeFiles/ZSharp.dir/eval.cpp.i
CMakeFiles/ZSharp.dir/eval.cpp.s: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/ZSharp.dir/eval.cpp.s"
/usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/sam/Z-Sharp/ZSharp/eval.cpp -o CMakeFiles/ZSharp.dir/eval.cpp.s
# Object files for target ZSharp
ZSharp_OBJECTS = \
"CMakeFiles/ZSharp.dir/Main.cpp.o" \
"CMakeFiles/ZSharp.dir/strops.cpp.o" \
"CMakeFiles/ZSharp.dir/eval.cpp.o"
# External object files for target ZSharp
ZSharp_EXTERNAL_OBJECTS =
ZSharp: CMakeFiles/ZSharp.dir/Main.cpp.o
ZSharp: CMakeFiles/ZSharp.dir/strops.cpp.o
ZSharp: CMakeFiles/ZSharp.dir/eval.cpp.o
ZSharp: CMakeFiles/ZSharp.dir/build.make
ZSharp: /usr/lib/x86_64-linux-gnu/libboost_system.so.1.71.0
ZSharp: /usr/lib/x86_64-linux-gnu/libSDL2_image.so
ZSharp: /usr/lib/x86_64-linux-gnu/libSDL2_ttf.so
ZSharp: CMakeFiles/ZSharp.dir/link.txt
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_4) "Linking CXX executable ZSharp"
$(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/ZSharp.dir/link.txt --verbose=$(VERBOSE)
# Rule to build all files generated by this target.
CMakeFiles/ZSharp.dir/build: ZSharp
.PHONY : CMakeFiles/ZSharp.dir/build
CMakeFiles/ZSharp.dir/clean:
$(CMAKE_COMMAND) -P CMakeFiles/ZSharp.dir/cmake_clean.cmake
.PHONY : CMakeFiles/ZSharp.dir/clean
CMakeFiles/ZSharp.dir/depend:
cd /home/sam/Z-Sharp/ZSharp/linux-build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/sam/Z-Sharp/ZSharp /home/sam/Z-Sharp/ZSharp /home/sam/Z-Sharp/ZSharp/linux-build /home/sam/Z-Sharp/ZSharp/linux-build /home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles/ZSharp.dir/DependInfo.cmake --color=$(COLOR)
.PHONY : CMakeFiles/ZSharp.dir/depend

View File

@ -0,0 +1,12 @@
file(REMOVE_RECURSE
"CMakeFiles/ZSharp.dir/Main.cpp.o"
"CMakeFiles/ZSharp.dir/eval.cpp.o"
"CMakeFiles/ZSharp.dir/strops.cpp.o"
"ZSharp"
"ZSharp.pdb"
)
# Per-language clean rules from dependency scanning.
foreach(lang CXX)
include(CMakeFiles/ZSharp.dir/cmake_clean_${lang}.cmake OPTIONAL)
endforeach()

View File

@ -0,0 +1,67 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.16
CMakeFiles/ZSharp.dir/Main.cpp.o
/home/sam/Z-Sharp/ZSharp/Main.cpp
/home/sam/Z-Sharp/ZSharp/ZS.h
/home/sam/Z-Sharp/ZSharp/anyops.h
/home/sam/Z-Sharp/ZSharp/builtin.h
/home/sam/Z-Sharp/ZSharp/color.hpp
/home/sam/Z-Sharp/ZSharp/eval.h
/home/sam/Z-Sharp/ZSharp/graphics.h
/home/sam/Z-Sharp/ZSharp/main.h
/home/sam/Z-Sharp/ZSharp/strops.h
/usr/include/SDL2/SDL.h
/usr/include/SDL2/SDL_assert.h
/usr/include/SDL2/SDL_atomic.h
/usr/include/SDL2/SDL_audio.h
/usr/include/SDL2/SDL_blendmode.h
/usr/include/SDL2/SDL_clipboard.h
/usr/include/SDL2/SDL_config.h
/usr/include/SDL2/SDL_cpuinfo.h
/usr/include/SDL2/SDL_endian.h
/usr/include/SDL2/SDL_error.h
/usr/include/SDL2/SDL_events.h
/usr/include/SDL2/SDL_filesystem.h
/usr/include/SDL2/SDL_gamecontroller.h
/usr/include/SDL2/SDL_gesture.h
/usr/include/SDL2/SDL_haptic.h
/usr/include/SDL2/SDL_hints.h
/usr/include/SDL2/SDL_image.h
/usr/include/SDL2/SDL_joystick.h
/usr/include/SDL2/SDL_keyboard.h
/usr/include/SDL2/SDL_keycode.h
/usr/include/SDL2/SDL_loadso.h
/usr/include/SDL2/SDL_log.h
/usr/include/SDL2/SDL_main.h
/usr/include/SDL2/SDL_messagebox.h
/usr/include/SDL2/SDL_mouse.h
/usr/include/SDL2/SDL_mutex.h
/usr/include/SDL2/SDL_pixels.h
/usr/include/SDL2/SDL_platform.h
/usr/include/SDL2/SDL_power.h
/usr/include/SDL2/SDL_quit.h
/usr/include/SDL2/SDL_rect.h
/usr/include/SDL2/SDL_render.h
/usr/include/SDL2/SDL_rwops.h
/usr/include/SDL2/SDL_scancode.h
/usr/include/SDL2/SDL_sensor.h
/usr/include/SDL2/SDL_shape.h
/usr/include/SDL2/SDL_stdinc.h
/usr/include/SDL2/SDL_surface.h
/usr/include/SDL2/SDL_system.h
/usr/include/SDL2/SDL_thread.h
/usr/include/SDL2/SDL_timer.h
/usr/include/SDL2/SDL_touch.h
/usr/include/SDL2/SDL_ttf.h
/usr/include/SDL2/SDL_version.h
/usr/include/SDL2/SDL_video.h
/usr/include/SDL2/begin_code.h
/usr/include/SDL2/close_code.h
CMakeFiles/ZSharp.dir/eval.cpp.o
/home/sam/Z-Sharp/ZSharp/eval.cpp
/home/sam/Z-Sharp/ZSharp/eval.h
/home/sam/Z-Sharp/ZSharp/strops.h
CMakeFiles/ZSharp.dir/strops.cpp.o
/home/sam/Z-Sharp/ZSharp/strops.cpp
/home/sam/Z-Sharp/ZSharp/strops.h

View File

@ -0,0 +1,67 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.16
CMakeFiles/ZSharp.dir/Main.cpp.o: ../Main.cpp
CMakeFiles/ZSharp.dir/Main.cpp.o: ../ZS.h
CMakeFiles/ZSharp.dir/Main.cpp.o: ../anyops.h
CMakeFiles/ZSharp.dir/Main.cpp.o: ../builtin.h
CMakeFiles/ZSharp.dir/Main.cpp.o: ../color.hpp
CMakeFiles/ZSharp.dir/Main.cpp.o: ../eval.h
CMakeFiles/ZSharp.dir/Main.cpp.o: ../graphics.h
CMakeFiles/ZSharp.dir/Main.cpp.o: ../main.h
CMakeFiles/ZSharp.dir/Main.cpp.o: ../strops.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_assert.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_atomic.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_audio.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_blendmode.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_clipboard.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_config.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_cpuinfo.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_endian.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_error.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_events.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_filesystem.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_gamecontroller.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_gesture.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_haptic.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_hints.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_image.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_joystick.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_keyboard.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_keycode.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_loadso.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_log.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_main.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_messagebox.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_mouse.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_mutex.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_pixels.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_platform.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_power.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_quit.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_rect.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_render.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_rwops.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_scancode.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_sensor.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_shape.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_stdinc.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_surface.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_system.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_thread.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_timer.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_touch.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_ttf.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_version.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/SDL_video.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/begin_code.h
CMakeFiles/ZSharp.dir/Main.cpp.o: /usr/include/SDL2/close_code.h
CMakeFiles/ZSharp.dir/eval.cpp.o: ../eval.cpp
CMakeFiles/ZSharp.dir/eval.cpp.o: ../eval.h
CMakeFiles/ZSharp.dir/eval.cpp.o: ../strops.h
CMakeFiles/ZSharp.dir/strops.cpp.o: ../strops.cpp
CMakeFiles/ZSharp.dir/strops.cpp.o: ../strops.h

Binary file not shown.

View File

@ -0,0 +1,10 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.16
# compile CXX with /usr/bin/c++
CXX_FLAGS = -O3 -DNDEBUG -std=gnu++17
CXX_DEFINES = -DBOOST_ALL_NO_LIB -DBOOST_SYSTEM_DYN_LINK
CXX_INCLUDES = -I/usr/include/SDL2

View File

@ -0,0 +1 @@
/usr/bin/c++ -O3 -DNDEBUG -rdynamic CMakeFiles/ZSharp.dir/Main.cpp.o CMakeFiles/ZSharp.dir/strops.cpp.o CMakeFiles/ZSharp.dir/eval.cpp.o -o ZSharp -lm /usr/lib/x86_64-linux-gnu/libboost_system.so.1.71.0 -lSDL2 -lSDL2_image -lSDL2_ttf

View File

@ -0,0 +1,5 @@
CMAKE_PROGRESS_1 = 1
CMAKE_PROGRESS_2 = 2
CMAKE_PROGRESS_3 = 3
CMAKE_PROGRESS_4 = 4

Binary file not shown.

View File

@ -0,0 +1 @@
# This file is generated by cmake for dependency checking of the CMakeCache.txt file

View File

@ -0,0 +1 @@
4

238
ZSharp/linux-build/Makefile Normal file
View File

@ -0,0 +1,238 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.16
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file.
RM = /usr/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/sam/Z-Sharp/ZSharp
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/sam/Z-Sharp/ZSharp/linux-build
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/bin/cmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
/usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles /home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles/progress.marks
$(MAKE) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /home/sam/Z-Sharp/ZSharp/linux-build/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
$(MAKE) -f CMakeFiles/Makefile2 clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast
# clear depends
depend:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
#=============================================================================
# Target rules for targets named ZSharp
# Build rule for target.
ZSharp: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 ZSharp
.PHONY : ZSharp
# fast build rule for target.
ZSharp/fast:
$(MAKE) -f CMakeFiles/ZSharp.dir/build.make CMakeFiles/ZSharp.dir/build
.PHONY : ZSharp/fast
Main.o: Main.cpp.o
.PHONY : Main.o
# target to build an object file
Main.cpp.o:
$(MAKE) -f CMakeFiles/ZSharp.dir/build.make CMakeFiles/ZSharp.dir/Main.cpp.o
.PHONY : Main.cpp.o
Main.i: Main.cpp.i
.PHONY : Main.i
# target to preprocess a source file
Main.cpp.i:
$(MAKE) -f CMakeFiles/ZSharp.dir/build.make CMakeFiles/ZSharp.dir/Main.cpp.i
.PHONY : Main.cpp.i
Main.s: Main.cpp.s
.PHONY : Main.s
# target to generate assembly for a file
Main.cpp.s:
$(MAKE) -f CMakeFiles/ZSharp.dir/build.make CMakeFiles/ZSharp.dir/Main.cpp.s
.PHONY : Main.cpp.s
eval.o: eval.cpp.o
.PHONY : eval.o
# target to build an object file
eval.cpp.o:
$(MAKE) -f CMakeFiles/ZSharp.dir/build.make CMakeFiles/ZSharp.dir/eval.cpp.o
.PHONY : eval.cpp.o
eval.i: eval.cpp.i
.PHONY : eval.i
# target to preprocess a source file
eval.cpp.i:
$(MAKE) -f CMakeFiles/ZSharp.dir/build.make CMakeFiles/ZSharp.dir/eval.cpp.i
.PHONY : eval.cpp.i
eval.s: eval.cpp.s
.PHONY : eval.s
# target to generate assembly for a file
eval.cpp.s:
$(MAKE) -f CMakeFiles/ZSharp.dir/build.make CMakeFiles/ZSharp.dir/eval.cpp.s
.PHONY : eval.cpp.s
strops.o: strops.cpp.o
.PHONY : strops.o
# target to build an object file
strops.cpp.o:
$(MAKE) -f CMakeFiles/ZSharp.dir/build.make CMakeFiles/ZSharp.dir/strops.cpp.o
.PHONY : strops.cpp.o
strops.i: strops.cpp.i
.PHONY : strops.i
# target to preprocess a source file
strops.cpp.i:
$(MAKE) -f CMakeFiles/ZSharp.dir/build.make CMakeFiles/ZSharp.dir/strops.cpp.i
.PHONY : strops.cpp.i
strops.s: strops.cpp.s
.PHONY : strops.s
# target to generate assembly for a file
strops.cpp.s:
$(MAKE) -f CMakeFiles/ZSharp.dir/build.make CMakeFiles/ZSharp.dir/strops.cpp.s
.PHONY : strops.cpp.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... rebuild_cache"
@echo "... edit_cache"
@echo "... ZSharp"
@echo "... Main.o"
@echo "... Main.i"
@echo "... Main.s"
@echo "... eval.o"
@echo "... eval.i"
@echo "... eval.s"
@echo "... strops.o"
@echo "... strops.i"
@echo "... strops.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system

BIN
ZSharp/linux-build/ZSharp Executable file

Binary file not shown.

View File

@ -0,0 +1,49 @@
# Install script for directory: /home/sam/Z-Sharp/ZSharp
# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "Release")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()
# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()
# Install shared libraries without execute permission?
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
set(CMAKE_INSTALL_SO_NO_EXE "1")
endif()
# Is this installation the result of a crosscompile?
if(NOT DEFINED CMAKE_CROSSCOMPILING)
set(CMAKE_CROSSCOMPILING "FALSE")
endif()
if(CMAKE_INSTALL_COMPONENT)
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
else()
set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
endif()
string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
"${CMAKE_INSTALL_MANIFEST_FILES}")
file(WRITE "/home/sam/Z-Sharp/ZSharp/linux-build/${CMAKE_INSTALL_MANIFEST}"
"${CMAKE_INSTALL_MANIFEST_CONTENT}")

219
ZSharp/modpath.iss Normal file
View File

@ -0,0 +1,219 @@
// ----------------------------------------------------------------------------
//
// Inno Setup Ver: 5.4.2
// Script Version: 1.4.2
// Author: Jared Breland <jbreland@legroom.net>
// Homepage: http://www.legroom.net/software
// License: GNU Lesser General Public License (LGPL), version 3
// http://www.gnu.org/licenses/lgpl.html
//
// Script Function:
// Allow modification of environmental path directly from Inno Setup installers
//
// Instructions:
// Copy modpath.iss to the same directory as your setup script
//
// Add this statement to your [Setup] section
// ChangesEnvironment=true
//
// Add this statement to your [Tasks] section
// You can change the Description or Flags
// You can change the Name, but it must match the ModPathName setting below
// Name: modifypath; Description: &Add application directory to your environmental path; Flags: unchecked
//
// Add the following to the end of your [Code] section
// ModPathName defines the name of the task defined above
// ModPathType defines whether the 'user' or 'system' path will be modified;
// this will default to user if anything other than system is set
// setArrayLength must specify the total number of dirs to be added
// Result[0] contains first directory, Result[1] contains second, etc.
// const
// ModPathName = 'modifypath';
// ModPathType = 'user';
//
// function ModPathDir(): TArrayOfString;
// begin
// setArrayLength(Result, 1);
// Result[0] := ExpandConstant('{app}');
// end;
// #include "modpath.iss"
// ----------------------------------------------------------------------------
procedure ModPath();
var
oldpath: String;
newpath: String;
updatepath: Boolean;
pathArr: TArrayOfString;
aExecFile: String;
aExecArr: TArrayOfString;
i, d: Integer;
pathdir: TArrayOfString;
regroot: Integer;
regpath: String;
begin
// Get constants from main script and adjust behavior accordingly
// ModPathType MUST be 'system' or 'user'; force 'user' if invalid
if ModPathType = 'system' then begin
regroot := HKEY_LOCAL_MACHINE;
regpath := 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
end else begin
regroot := HKEY_CURRENT_USER;
regpath := 'Environment';
end;
// Get array of new directories and act on each individually
pathdir := ModPathDir();
for d := 0 to GetArrayLength(pathdir)-1 do begin
updatepath := true;
// Modify WinNT path
if UsingWinNT() = true then begin
// Get current path, split into an array
RegQueryStringValue(regroot, regpath, 'Path', oldpath);
oldpath := oldpath + ';';
i := 0;
while (Pos(';', oldpath) > 0) do begin
SetArrayLength(pathArr, i+1);
pathArr[i] := Copy(oldpath, 0, Pos(';', oldpath)-1);
oldpath := Copy(oldpath, Pos(';', oldpath)+1, Length(oldpath));
i := i + 1;
// Check if current directory matches app dir
if pathdir[d] = pathArr[i-1] then begin
// if uninstalling, remove dir from path
if IsUninstaller() = true then begin
continue;
// if installing, flag that dir already exists in path
end else begin
updatepath := false;
end;
end;
// Add current directory to new path
if i = 1 then begin
newpath := pathArr[i-1];
end else begin
newpath := newpath + ';' + pathArr[i-1];
end;
end;
// Append app dir to path if not already included
if (IsUninstaller() = false) AND (updatepath = true) then
newpath := newpath + ';' + pathdir[d];
// Write new path
RegWriteStringValue(regroot, regpath, 'Path', newpath);
// Modify Win9x path
end else begin
// Convert to shortened dirname
pathdir[d] := GetShortName(pathdir[d]);
// If autoexec.bat exists, check if app dir already exists in path
aExecFile := 'C:\AUTOEXEC.BAT';
if FileExists(aExecFile) then begin
LoadStringsFromFile(aExecFile, aExecArr);
for i := 0 to GetArrayLength(aExecArr)-1 do begin
if IsUninstaller() = false then begin
// If app dir already exists while installing, skip add
if (Pos(pathdir[d], aExecArr[i]) > 0) then
updatepath := false;
break;
end else begin
// If app dir exists and = what we originally set, then delete at uninstall
if aExecArr[i] = 'SET PATH=%PATH%;' + pathdir[d] then
aExecArr[i] := '';
end;
end;
end;
// If app dir not found, or autoexec.bat didn't exist, then (create and) append to current path
if (IsUninstaller() = false) AND (updatepath = true) then begin
SaveStringToFile(aExecFile, #13#10 + 'SET PATH=%PATH%;' + pathdir[d], True);
// If uninstalling, write the full autoexec out
end else begin
SaveStringsToFile(aExecFile, aExecArr, False);
end;
end;
end;
end;
// Split a string into an array using passed delimeter
procedure MPExplode(var Dest: TArrayOfString; Text: String; Separator: String);
var
i: Integer;
begin
i := 0;
repeat
SetArrayLength(Dest, i+1);
if Pos(Separator,Text) > 0 then begin
Dest[i] := Copy(Text, 1, Pos(Separator, Text)-1);
Text := Copy(Text, Pos(Separator,Text) + Length(Separator), Length(Text));
i := i + 1;
end else begin
Dest[i] := Text;
Text := '';
end;
until Length(Text)=0;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
taskname: String;
begin
taskname := ModPathName;
if CurStep = ssPostInstall then
if IsTaskSelected(taskname) then
ModPath();
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
aSelectedTasks: TArrayOfString;
i: Integer;
taskname: String;
regpath: String;
regstring: String;
appid: String;
begin
// only run during actual uninstall
if CurUninstallStep = usUninstall then begin
// get list of selected tasks saved in registry at install time
appid := '{#emit SetupSetting("AppId")}';
if appid = '' then appid := '{#emit SetupSetting("AppName")}';
regpath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\'+appid+'_is1');
RegQueryStringValue(HKLM, regpath, 'Inno Setup: Selected Tasks', regstring);
if regstring = '' then RegQueryStringValue(HKCU, regpath, 'Inno Setup: Selected Tasks', regstring);
// check each task; if matches modpath taskname, trigger patch removal
if regstring <> '' then begin
taskname := ModPathName;
MPExplode(aSelectedTasks, regstring, ',');
if GetArrayLength(aSelectedTasks) > 0 then begin
for i := 0 to GetArrayLength(aSelectedTasks)-1 do begin
if comparetext(aSelectedTasks[i], taskname) = 0 then
ModPath();
end;
end;
end;
end;
end;
function NeedRestart(): Boolean;
var
taskname: String;
begin
taskname := ModPathName;
if IsTaskSelected(taskname) and not UsingWinNT() then begin
Result := True;
end else begin
Result := False;
end;
end;

View File

@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Slang.rc
// Used by ZSharp.rc
//
#define IDI_ICON1 101

View File

@ -8,7 +8,8 @@
//#include "builtin.h"
using namespace std;
const string WHITESPACE = " \n\r\t\f\v";
const string WHITESPACE = " \t\f";
//const string WHITESPACE = " \n\r\t\f\v";
bool isNumber(const string& str)
@ -25,6 +26,51 @@ bool stob(const string& str)
return b;
}
string unescape(const string& s)
{
string res;
string::const_iterator it = s.begin();
while (it != s.end())
{
char c = *it++;
if (c == '\\' && it != s.end())
{
switch (*it++) {
case '\\': c = '\\'; break;
case 'n': c = '\n'; break;
case 't': c = '\t'; break;
// all other escapes
default:
// invalid escape sequence - skip it. alternatively you can copy it as is, throw an exception...
continue;
}
}
res += c;
}
return res;
}
std::string escaped(const std::string& input)
{
std::string output;
output.reserve(input.size());
for (const char c : input) {
switch (c) {
case '\a': output += "\\a"; break;
case '\b': output += "\\b"; break;
case '\f': output += "\\f"; break;
case '\n': output += "\\n"; break;
case '\r': output += "\\r"; break;
case '\t': output += "\\t"; break;
case '\v': output += "\\v"; break;
default: output += c; break;
}
}
return output;
}
string StringRaw(const string& s)
{
string str = trim(s);
@ -42,7 +88,7 @@ string StringRaw(const string& s)
if (str[str.size() - 1] != '\"')
withoutQuotes += str[str.size() - 1];
return withoutQuotes;
return unescape(withoutQuotes);
}
string Quoted(const string& s)
@ -150,6 +196,81 @@ int countNoOverlap(const string& str, const char& searchFor, const char& ch1, co
return cnt;
}
vector<string> splitNoOverlap(const string& str, const char& splitBy, const char& openChar, const char& closeChar)
{
vector<string> newStr;
int openCount = 0;
string tmpStr = "";
for (int i = 0; i < (int)str.size(); i++)
{
if (i == (int)str.size() - 1)
{
newStr.push_back(trim(tmpStr + str[i]));
break;
}
if (str[i] == splitBy && openCount == 0)
{
newStr.push_back(trim(tmpStr));
tmpStr = "";
continue;
}
else if (str[i] == openChar) {
tmpStr += str[i];
openCount += 1;
}
else if (str[i] == closeChar) {
tmpStr += str[i];
openCount -= 1;
}
else
tmpStr += str[i];
}
return newStr;
}
string betweenChars(const string& str, const char& openChar, const char& closeChar)
{
string content = "";
int startPos = 0;
int endPos = (int)str.size();
for (int i = 0; i < (int)str.size(); i++)
{
if (str[i] == openChar){
startPos = i+1;
break;
}
}
for (int i = (int)str.size()-1; i >=0; i--)
{
if (str[i] == closeChar){
endPos = i-(startPos); // or startPos-1 idk I cant do math right now
break;
}
}
return str.substr(startPos, endPos);
}
bool startsWith(const string& str, const string& lookFor)
{
if (str.empty() || lookFor.size() > str.size())
return false;
for (int i = 0; i < (int)lookFor.size(); i++)
{
if (str[i] != lookFor[i])
return false;
}
return true;
}
int countOutsideParenthesis(const string& str, const char& searchFor)
{
int cnt = 0;
@ -341,4 +462,13 @@ string replace(const string& str, const string& strToReplace, const string& repl
}
return newStr;
}
bool isEscaped(const string& str, int curChar)
{
if (curChar > 0)
if (str[curChar - 1] == '\\')
return true;
return false;
}

View File

@ -12,6 +12,7 @@ int AnyAsInt(const boost::any& val);
bool AnyAsBool(const boost::any& val);
bool isNumber(const string& str);
bool stob(const string& str);
@ -30,6 +31,10 @@ string trim(const string& s);
vector<string> split(const string& str, const char& del);
string betweenChars(const string& str, const char& openChar, const char& closeChar);
vector<string> splitNoOverlap(const string& str, const char& splitBy, const char& openChar, const char& closeChar);
int count(const string& str, const char& ch);
int countNoOverlap(const string& str, const char& searchFor, const char& ch1, const char& ch2);
@ -60,4 +65,10 @@ float floatval(const string& s);
string replace(const string& str, const string& strToReplace, const string& replaceWith);
bool isEscaped(const string& str, int curChar);
bool startsWith(const string& str, const string& lookFor);
std::string escaped(const std::string& input);
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

View File

@ -0,0 +1,157 @@
int g_screenw = 256
int g_screenh = 224
int g_resolutionScale = 3
float g_playerWalkSpeed = 150
float g_playerRunSpeed = 210
float g_jumpHeight = 200
float g_currPlayerSpeed = 400
bool g_running = false
bool g_colliding = false
float g_gravitySpeed = 86
bool g_jumping = false
float g_jumpingTime = 0
//include "./extra-include.zs"
func Main()
{
//SplitThread(ThreadedFunction())
EXIT_WHEN_DONE = false
// Immediately creates the window, then runs Start(), then the game loop. The game loop calls Update() every frame
ZS.Graphics.Init("Platformer game", g_screenw, g_screenh, g_resolutionScale)
}
func Start()
{
float centerX = g_screenw / 2
float centerY = g_screenh / 2
global Vec2 v_aa = NVec2(g_screenw / 2 + -40, g_screenh / 2 + -40)
global Sprite s_aa = ZS.Graphics.Sprite("./mariostill.png", v_aa, NVec2(16, 16), 0)
global Vec2 v_ab = NVec2(g_screenw / 2 + -30, g_screenh / 2 + -40)
global Sprite s_ab = ZS.Graphics.Sprite("./mariostill.png", v_ab, NVec2(16, 16), 0)
global Vec2 v_ac = NVec2(g_screenw / 2 + -20, g_screenh / 2 + -40)
global Sprite s_ac = ZS.Graphics.Sprite("./mariostill.png", v_ac, NVec2(16, 16), 0)
global Vec2 v_ad = NVec2(g_screenw / 2 + -10, g_screenh / 2 + -40)
global Sprite s_ad = ZS.Graphics.Sprite("./mariostill.png", v_ad, NVec2(16, 16), 0)
global Vec2 v_ae = NVec2(g_screenw / 2 + -0, g_screenh / 2 + -40)
global Sprite s_ae = ZS.Graphics.Sprite("./mariostill.png", v_ae, NVec2(16, 16), 0)
global Vec2 v_af = NVec2(g_screenw / 2 + 10, g_screenh / 2 + -40)
global Sprite s_af = ZS.Graphics.Sprite("./mariostill.png", v_af, NVec2(16, 16), 0)
global Vec2 v_ag = NVec2(g_screenw / 2 + 20, g_screenh / 2 + -40)
global Sprite s_ag = ZS.Graphics.Sprite("./mariostill.png", v_ag, NVec2(16, 16), 0)
global Vec2 v_ah = NVec2(g_screenw / 2 + 30, g_screenh / 2 + -40)
global Sprite s_ah = ZS.Graphics.Sprite("./mariostill.png", v_ah, NVec2(16, 16), 0)
global Vec2 v_ai = NVec2(g_screenw / 2 + 40, g_screenh / 2 + -40)
global Sprite s_ai = ZS.Graphics.Sprite("./mariostill.png", v_ai, NVec2(16, 16), 0)
global Vec2 v_aj = NVec2(g_screenw / 2 + -40, g_screenh / 2 + -30)
global Sprite s_aj = ZS.Graphics.Sprite("./mariostill.png", v_aj, NVec2(16, 16), 0)
global Vec2 v_ak = NVec2(g_screenw / 2 + -30, g_screenh / 2 + -30)
global Sprite s_ak = ZS.Graphics.Sprite("./mariostill.png", v_ak, NVec2(16, 16), 0)
global Vec2 v_al = NVec2(g_screenw / 2 + -20, g_screenh / 2 + -30)
global Sprite s_al = ZS.Graphics.Sprite("./mariostill.png", v_al, NVec2(16, 16), 0)
}
func Update(deltaTime)
{
float fps = 1 / deltaTime
Printl("FPS: " + fps)
// // Shift key lets you sprint
// g_running = GetKey("SHIFT_L")
// if g_running == true
// {
// g_currPlayerSpeed = g_playerRunSpeed
// }
// if g_running == false
// {
// g_currPlayerSpeed = g_playerWalkSpeed
// }
// // Move Left And Right
// if GetKey("D") == true
// {
// g_playerTargetPosition.x += g_currPlayerSpeed * deltaTime
// }
// if GetKey("A") == true
// {
// g_playerTargetPosition.x -= g_currPlayerSpeed * deltaTime
// }
// // Apply gravity
// g_colliding = Colliding(g_playerSprite, g_groundSprite)
// if g_colliding == false
// {
// if g_jumping == false
// {
// g_playerTargetPosition.y += deltaTime * g_gravitySpeed
// }
// if g_jumping == true
// {
// g_playerTargetPosition.y -= (g_jumpHeight * deltaTime) + (deltaTime * g_gravitySpeed * -g_jumpingTime * 5)
// }
// }
// if g_colliding == true
// {
// if GetKey("SPACE") == false
// {
// if g_jumpingTime > 1
// {
// g_jumping = false
// }
// }
// if GetKey("SPACE") == true
// {
// g_jumping = true
// g_jumpingTime = 0
// g_playerTargetPosition.y -= 2
// }
// }
// // Lerps from old position to destination smoothly
// float stopSpeed = deltaTime * 15
// float lerpedX = Lerp(g_playerSprite.position.x, g_playerTargetPosition.x, stopSpeed)
// s_aa.position = NVec2(lerpedX, g_playerTargetPosition.y)
// Finally draws all of the sprites
ZS.Graphics.Draw(s_aa)
ZS.Graphics.Draw(s_ab)
ZS.Graphics.Draw(s_ac)
ZS.Graphics.Draw(s_ad)
ZS.Graphics.Draw(s_ae)
ZS.Graphics.Draw(s_af)
ZS.Graphics.Draw(s_ag)
ZS.Graphics.Draw(s_ah)
ZS.Graphics.Draw(s_ai)
ZS.Graphics.Draw(s_aj)
ZS.Graphics.Draw(s_ak)
ZS.Graphics.Draw(s_al)
}
func Colliding(a, b)
{
bool bo = ZS.Physics.AxisAlignedCollision(a, b)
return bo
}

View File

@ -0,0 +1,103 @@
// This is an "included" ZS file, which can keep your main script
// tidier and more organized or easily share the same functions
// across multiple programs.
func TestInclude()
{
Printl("Hello World!")
}
//////////////////////////////////////////////////////////////////////////////
// Benchmark, to check if performance suffers from too many functions/variables
//////////////////////////////////////////////////////////////////////////////
func b1()
{
Printl("Hello World!")
}
func b2()
{
Printl("Hello World!")
}
func b3()
{
Printl("Hello World!")
}
func b4()
{
Printl("Hello World!")
}
func b5()
{
Printl("Hello World!")
}
func b6()
{
Printl("Hello World!")
}
func b7()
{
Printl("Hello World!")
}
func b8()
{
Printl("Hello World!")
}
func b9()
{
Printl("Hello World!")
}
func b10()
{
Printl("Hello World!")
}
func b11()
{
Printl("Hello World!")
}
func b12()
{
Printl("Hello World!")
}
func b13()
{
Printl("Hello World!")
}
func b14()
{
Printl("Hello World!")
}
func b15()
{
Printl("Hello World!")
}
func b16()
{
Printl("Hello World!")
}
int a = 4
int b = 4
int c = 4
int d = 4
int e = 4
int f = 4
int g = 4
int h = 4
int i = 4
int j = 4
int k = 4
int l = 4
int m = 4
int n = 4
int o = 4
int p = 4
int q = 4
int r = 4
int s = 4
int t = 4
int u = 4
int v = 4
int w = 4
int x = 4
int y = 4
int z = 4

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

View File

@ -0,0 +1,128 @@
int g_screenw = 256
int g_screenh = 224
int g_resolutionScale = 3
float g_playerWalkSpeed = 150
float g_playerRunSpeed = 210
float g_jumpHeight = 200
float g_currPlayerSpeed = 400
bool g_running = false
bool g_colliding = false
float g_gravitySpeed = 86
bool g_jumping = false
float g_jumpingTime = 0
//include "./extra-include.zs"
func Main()
{
//SplitThread(ThreadedFunction())
EXIT_WHEN_DONE = false
// Immediately creates the window, then runs Start(), then the game loop. The game loop calls Update() every frame
ZS.Graphics.Init("Platformer game", g_screenw, g_screenh, g_resolutionScale)
}
func ThreadedFunction()
{
Printl("threaded:")
}
func Start()
{
float centerX = g_screenw / 2
float centerY = g_screenh / 2
global Vec2 g_screencenter = NVec2(g_screenw / 2, g_screenh / 2)
global Sprite g_playerSprite = ZS.Graphics.Sprite("./mariostill.png", g_screencenter, NVec2(16, 16), 0)
global Sprite g_groundSprite = ZS.Graphics.Sprite("./square.png", NVec2(g_screencenter.x, 192), NVec2(256, 16), 0)
global Text g_instructionsText = ZS.Graphics.Text("Use Arrow Keys or WASD to Move and Spacebar to Jump", "./arial.ttf", NVec2(g_screencenter.x, g_screencenter.y), 8, 0, 255, 255, 255)
g_instructionsText.antialias = false
global Vec2 g_playerTargetPosition = g_screencenter
}
func Update(deltaTime)
{
float fps = 1 / deltaTime
g_jumpingTime += deltaTime
Printl("FPS: " + fps)
//TestInclude()
// Shift key lets you sprint
g_running = GetKey("SHIFT_L")
if g_running == true
{
g_currPlayerSpeed = g_playerRunSpeed
}
if g_running == false
{
g_currPlayerSpeed = g_playerWalkSpeed
}
// Move Left And Right
if GetKey("D") == true
{
g_playerTargetPosition.x += g_currPlayerSpeed * deltaTime
}
if GetKey("A") == true
{
g_playerTargetPosition.x -= g_currPlayerSpeed * deltaTime
}
// Apply gravity
g_colliding = Colliding(g_playerSprite, g_groundSprite)
if g_colliding == false
{
if g_jumping == false
{
g_playerTargetPosition.y += deltaTime * g_gravitySpeed
}
if g_jumping == true
{
g_playerTargetPosition.y -= (g_jumpHeight * deltaTime) + (deltaTime * g_gravitySpeed * -g_jumpingTime * 5)
}
}
if g_colliding == true
{
if GetKey("SPACE") == false
{
if g_jumpingTime > 1
{
g_jumping = false
}
}
if GetKey("SPACE") == true
{
g_jumping = true
g_jumpingTime = 0
g_playerTargetPosition.y -= 2
}
}
// Lerps from old position to destination smoothly
float stopSpeed = deltaTime * 15
float lerpedX = Lerp(g_playerSprite.position.x, g_playerTargetPosition.x, stopSpeed)
g_playerSprite.position = NVec2(lerpedX, g_playerTargetPosition.y)
// Finally draws all of the sprites
ZS.Graphics.Draw(g_playerSprite)
ZS.Graphics.Draw(g_groundSprite)
// Draw the text
ZS.Graphics.DrawText(g_instructionsText)
}
func Colliding(a, b)
{
bool bo = ZS.Physics.AxisAlignedCollision(a, b)
return bo
}

View File

Before

Width:  |  Height:  |  Size: 82 B

After

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

View File

Before

Width:  |  Height:  |  Size: 93 B

After

Width:  |  Height:  |  Size: 93 B

View File

@ -4,16 +4,22 @@ int SCREENH = 600
int scoreOne = 0
int scoreTwo = 0
float ballSpeed = 8
float ballSpeed = 400
float paddleMoveSpeed = 16
float paddleMoveSpeed = 600
float lerpSpeed = 14
bool aiOn = false
// Main is always run at the VERY BEGINNING. Start() is the start of GRAPHICS
// so if you never call SLB.Grapgics.Init, then Start won't run
// so if you never call ZS.Graphics.Init, then Start won't run
func Main()
{
EXIT_WHEN_DONE = false
// Immediately creates the window, then Start(), then the game loop. The game loop calls Update() every frame
SLB.Graphics.Init("This is a pong game", SCREENW, SCREENH)
ZS.Graphics.Init("This is a pong game", SCREENW, SCREENH)
}
func Start()
@ -24,11 +30,9 @@ func Start()
Vec2 ballScale = NVec2(10, 10)
Vec2 ballPos = centerOfScreen
ballPos -= ballScale
Vec2 paddleScale = NVec2(4, 70)
float yPosPaddle = centerOfScreen.y
yPosPaddle -= paddleScale.y / 2
Vec2 lPaddlePosition = NVec2(15, yPosPaddle)
global Vec2 lPaddleTargetPosition = NVec2(15, yPosPaddle)
@ -37,89 +41,126 @@ func Start()
Vec2 rPaddlePosition = NVec2(rOffset, yPosPaddle)
global Vec2 rPaddleTargetPosition = NVec2(rOffset, yPosPaddle)
global Sprite ballSpr = SLB.Graphics.Sprite("./square.png", ballPos, ballScale, 0)
global Sprite lPaddle = SLB.Graphics.Sprite("./square.png", lPaddlePosition, paddleScale, 0)
global Sprite rPaddle = SLB.Graphics.Sprite("./square.png", rPaddlePosition, paddleScale, 0)
global Sprite ballSpr = ZS.Graphics.Sprite("./ball.png", ballPos, ballScale, 0)
global Sprite lPaddle = ZS.Graphics.Sprite("./square.png", lPaddlePosition, paddleScale, 0)
global Sprite rPaddle = ZS.Graphics.Sprite("./square.png", rPaddlePosition, paddleScale, 0)
Vec2 netScale = NVec2(1, SCREENH)
global Sprite net = SLB.Graphics.Sprite("./net.png", centerOfScreen, netScale, 0)
global Sprite net = ZS.Graphics.Sprite("./net.png", centerOfScreen, netScale, 0)
float leftOffset = SCREENW / 4
Vec2 scoreOnePos = NVec2(leftOffset, 30)
global Text scoreTextOne = SLB.Graphics.Text("0", "./arial.ttf", scoreOnePos, 60, 0, 255, 255, 255)
global Text scoreTextOne = ZS.Graphics.Text("0", "./arial.ttf", scoreOnePos, 60, 0, 255, 255, 255)
float rightOffset = SCREENW - (SCREENW / 4)
Vec2 scoreTwoPos = NVec2(rightOffset, 30)
global Text scoreTextTwo = SLB.Graphics.Text("0", "./arial.ttf", scoreTwoPos, 60, 0, 255, 255, 255)
global Text scoreTextTwo = ZS.Graphics.Text("0", "./arial.ttf", scoreTwoPos, 60, 0, 255, 255, 255)
Vec2 instructionsPos = NVec2(centerOfScreen.x, SCREENH - 60)
global Text instructionsText = ZS.Graphics.Text("Use 'W' and 'S' or 'UP' and 'DOWN' arrows to control or press 'ENTER' to toggle AI", "./arial.ttf", instructionsPos, 20, 0, 255, 255, 255)
global Vec2 ballVelocity = NVec2(ballSpeed, ballSpeed)
}
func Update(deltaTime)
{
float FPS = 1 / deltaTime
print "FPS: " + FPS
//float FPS = 1 / deltaTime
//Printl("FPS: " + FPS)
// Handles Left Paddle Movement
//
if GetKey("W") == true
{
float newX = lPaddle.position.x
// Subtract from Y to move up, because vertical coordinates are reversed
float newY = lPaddleTargetPosition.y - paddleMoveSpeed
float newY = lPaddleTargetPosition.y - paddleMoveSpeed * deltaTime
newY = Clamp(newY, 0 + lPaddle.scale.y / 2, SCREENH - lPaddle.scale.y / 2)
lPaddleTargetPosition = NVec2(newX, newY)
lPaddleTargetPosition.y = newY
}
if GetKey("S") == true
{
float newX = lPaddle.position.x
// Add to Y to move down, because vertical coordinates are reversed
float newY = lPaddleTargetPosition.y + paddleMoveSpeed
float newY = lPaddleTargetPosition.y + paddleMoveSpeed * deltaTime
newY = Clamp(newY, 0 + lPaddle.scale.y / 2, SCREENH - lPaddle.scale.y / 2)
lPaddleTargetPosition = NVec2(newX, newY)
lPaddleTargetPosition.y = newY
}
// Lerps from old position to destination smoothly
float oldY = lPaddle.position.y
float stopSpeed = deltaTime * 6
float stopSpeed = deltaTime * lerpSpeed
float newY = lPaddleTargetPosition.y
float lerpedY = Lerp(oldY, newY, stopSpeed)
lPaddle.position = NVec2(newX, lerpedY)
lPaddle.position = NVec2(lPaddle.position.x, lerpedY)
// Handles Right Paddle Movement
//
if GetKey("UP") == true
if aiOn == false
{
float newX = rPaddle.position.x
// Subtract from Y to move up, because vertical coordinates are reversed
float newY = rPaddleTargetPosition.y - paddleMoveSpeed
newY = Clamp(newY, 0 + rPaddle.scale.y / 2, SCREENH - rPaddle.scale.y / 2)
rPaddleTargetPosition = NVec2(newX, newY)
if GetKey("UP") == true
{
// Subtract from Y to move up, because vertical coordinates are reversed
float newY = rPaddleTargetPosition.y - paddleMoveSpeed * deltaTime
newY = Clamp(newY, 0 + rPaddle.scale.y / 2, SCREENH - rPaddle.scale.y / 2)
rPaddleTargetPosition.y = newY
}
if GetKey("DOWN") == true
{
// Add to Y to move down, because vertical coordinates are reversed
float newY = rPaddleTargetPosition.y + paddleMoveSpeed * deltaTime
newY = Clamp(newY, 0 + rPaddle.scale.y / 2, SCREENH - rPaddle.scale.y / 2)
rPaddleTargetPosition.y = newY
}
}
if GetKey("DOWN") == true
if aiOn == true
{
float newX = rPaddle.position.x
// Add to Y to move down, because vertical coordinates are reversed
float newY = rPaddleTargetPosition.y + paddleMoveSpeed
newY = Clamp(newY, 0 + rPaddle.scale.y / 2, SCREENH - rPaddle.scale.y / 2)
rPaddleTargetPosition = NVec2(newX, newY)
if rPaddle.position.y < ballSpr.position.y
{
// Add to Y to move down, because vertical coordinates are reversed
float newY = rPaddleTargetPosition.y + paddleMoveSpeed * deltaTime
newY = Clamp(newY, 0 + rPaddle.scale.y / 2, SCREENH - rPaddle.scale.y / 2)
rPaddleTargetPosition.y = newY
}
if rPaddle.position.y > ballSpr.position.y
{
// Subtract from Y to move up, because vertical coordinates are reversed
float newY = rPaddleTargetPosition.y - paddleMoveSpeed * deltaTime
newY = Clamp(newY, 0 + rPaddle.scale.y / 2, SCREENH - rPaddle.scale.y / 2)
rPaddleTargetPosition.y = newY
}
}
// Lerps from old position to destination smoothly
float oldY = rPaddle.position.y
float stopSpeed = deltaTime * 6
float stopSpeed = deltaTime * lerpSpeed
float newY = rPaddleTargetPosition.y
float lerpedY = Lerp(oldY, newY, stopSpeed)
rPaddle.position = NVec2(newX, lerpedY)
rPaddle.position = NVec2(rPaddle.position.x, lerpedY)
ballSpr.position += ballVelocity
if GetKey("ENTER") == true
{
bool changeTo = false
if aiOn == true
{
changeTo = false
}
if aiOn == false
{
changeTo = true
}
aiOn = changeTo
}
Vec2 scaledVelocity = ballVelocity
scaledVelocity *= deltaTime
ballSpr.position += scaledVelocity
// Finally draws all of the sprites
SLB.Graphics.Draw(ballSpr)
SLB.Graphics.Draw(lPaddle)
SLB.Graphics.Draw(rPaddle)
ZS.Graphics.Draw(ballSpr)
ZS.Graphics.Draw(lPaddle)
ZS.Graphics.Draw(rPaddle)
SLB.Graphics.Draw(net)
ZS.Graphics.Draw(net)
SLB.Graphics.DrawText(scoreTextOne)
SLB.Graphics.DrawText(scoreTextTwo)
ZS.Graphics.DrawText(scoreTextOne)
ZS.Graphics.DrawText(scoreTextTwo)
ZS.Graphics.DrawText(instructionsText)
HandleBallBounce()
}
@ -198,7 +239,7 @@ func HandleBallBounce()
difference -= ballY
float paddleHeight = rPaddle.scale.y
float normalizedRelativeIntersectionY = difference / (paddleHeight / 2)
float bounceAngle = normalizedRelativeIntersectionY * 0.523599
float bounceAngle = normalizedRelativeIntersectionY * -0.523599
float ballVx = ballSpeed
ballVx *= Cos(bounceAngle)
ballVx *= -1
@ -210,6 +251,6 @@ func HandleBallBounce()
func Colliding(a, b)
{
bool b = SLB.Physics.AxisAlignedCollision(a, b)
bool b = ZS.Physics.AxisAlignedCollision(a, b)
return b
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B

View File

@ -0,0 +1,5 @@
func Main()
{
Printl("this is a test:")
ZS.System.Command("cls")
}