ranger-compiler 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/README.md +101 -9
- package/dist/Lang.rgr +362 -20
- package/dist/api.d.ts +881 -47
- package/dist/api.js +13986 -961
- package/dist/lib/IsoDate/DateMath.rgr +219 -0
- package/dist/lib/IsoDate/IsoCalendar.rgr +137 -0
- package/dist/lib/IsoDate/IsoDateParse.rgr +57 -0
- package/dist/lib/IsoDateLib.rgr +15 -0
- package/dist/lib/RangerProcess.rgr +47 -0
- package/dist/lib/Regex/RegexMatch.rgr +134 -0
- package/dist/lib/RegexLib.rgr +10 -0
- package/dist/lib/Time.rgr +2 -1
- package/dist/lib/ranger-dir.rgr +25 -5
- package/dist/package.json +1 -1
- package/dist/rgrc.js +13193 -2715
- package/package.json +150 -7
package/dist/lib/ranger-dir.rgr
CHANGED
|
@@ -118,24 +118,35 @@ class DirListReader {
|
|
|
118
118
|
(create_polyfill
|
|
119
119
|
"
|
|
120
120
|
|
|
121
|
-
#ifdef
|
|
121
|
+
#ifdef _WIN32
|
|
122
122
|
#include <windows.h>
|
|
123
123
|
#else
|
|
124
|
+
#include <dirent.h>
|
|
124
125
|
#endif
|
|
125
126
|
|
|
126
127
|
std::vector<std::string> __cpp_list_directory_files(std::string dirName) {
|
|
127
|
-
WIN32_FIND_DATA data;
|
|
128
128
|
std::vector<std::string> fileList;
|
|
129
|
+
#ifdef _WIN32
|
|
130
|
+
WIN32_FIND_DATA data;
|
|
129
131
|
std::string query = (dirName + \"\\\\*\");
|
|
130
|
-
HANDLE hFind = FindFirstFile(query.c_str(), &data);
|
|
131
|
-
|
|
132
|
+
HANDLE hFind = FindFirstFile(query.c_str(), &data);
|
|
132
133
|
if ( hFind != INVALID_HANDLE_VALUE ) {
|
|
133
134
|
do {
|
|
134
135
|
std::string name(data.cFileName);
|
|
135
136
|
fileList.push_back( name );
|
|
136
137
|
} while (FindNextFile(hFind, &data));
|
|
137
138
|
FindClose(hFind);
|
|
138
|
-
}
|
|
139
|
+
}
|
|
140
|
+
#else
|
|
141
|
+
DIR* dir = opendir(dirName.c_str());
|
|
142
|
+
if (dir != nullptr) {
|
|
143
|
+
struct dirent* ent;
|
|
144
|
+
while ((ent = readdir(dir)) != nullptr) {
|
|
145
|
+
fileList.push_back(std::string(ent->d_name));
|
|
146
|
+
}
|
|
147
|
+
closedir(dir);
|
|
148
|
+
}
|
|
149
|
+
#endif
|
|
139
150
|
return fileList;
|
|
140
151
|
}
|
|
141
152
|
"
|
|
@@ -147,6 +158,15 @@ std::vector<std::string> __cpp_list_directory_files(std::string dirName) {
|
|
|
147
158
|
is_directory cmdFiles:boolean (path:string) {
|
|
148
159
|
templates {
|
|
149
160
|
es6 ( "require('fs').statSync(" (e 1) ").isDirectory()" )
|
|
161
|
+
cpp ( "r_cpp_is_directory(" (e 1) ")" (imp "<sys/stat.h>") (imp "<string>"
|
|
162
|
+
(polyfill "
|
|
163
|
+
static int r_cpp_is_directory(const std::string& path) {
|
|
164
|
+
struct stat st;
|
|
165
|
+
if (stat(path.c_str(), &st) != 0) { return 0; }
|
|
166
|
+
return S_ISDIR(st.st_mode) ? 1 : 0;
|
|
167
|
+
}
|
|
168
|
+
")
|
|
169
|
+
)
|
|
150
170
|
}
|
|
151
171
|
}
|
|
152
172
|
is_file cmdFiles:boolean (path:string) {
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ranger-compiler",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Ranger cross-language compiler - compile once, run anywhere. Write code in Ranger and compile to JavaScript, TypeScript, Python, Go, Rust, Swift, C++, Java, Kotlin, C#, PHP, and Scala.",
|
|
5
5
|
"main": "api.js",
|
|
6
6
|
"types": "api.d.ts",
|