xot 0.2 → 0.2.1
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.
- checksums.yaml +4 -4
- data/.github/workflows/release-gem.yml +1 -1
- data/.github/workflows/tag.yml +1 -1
- data/.github/workflows/test.yml +7 -1
- data/ChangeLog.md +11 -0
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/include/xot/exception.h +3 -1
- data/include/xot/ref.h +7 -0
- data/lib/xot/extconf.rb +3 -1
- data/lib/xot/rake/util.rb +3 -40
- data/lib/xot/rake.rb +26 -13
- data/lib/xot/test.rb +5 -0
- data/lib/xot/util.rb +52 -0
- data/lib/xot.rb +1 -0
- data/src/exception.cpp +34 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3699d7ae604c3bc0d96a0ebacf3c3a22115e1ba338c9178ebaaf064ad93ca282
|
4
|
+
data.tar.gz: 810dc619b0d9bf7c0bae8ab97118a3f6170bd864b9872c0efbbce0973a4ea8e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fc79411d29fe6a9a26c08e6aeb0979db6a8806c4c1a1361028f0aa402a30612ffa3ca1483bb7b78ae007e9b4d6f7a92139d95dcc57b9e5e290df1a93762c34e
|
7
|
+
data.tar.gz: 261e370e9c80c9606c44bfd621677381f3c528d9387419c418a18a54ec5dbb53ecf43ce16f3b5f027010ea6e4f39974abf42ddd535d13a40ffc7d4a1e8f8653d
|
data/.github/workflows/tag.yml
CHANGED
data/.github/workflows/test.yml
CHANGED
@@ -16,7 +16,7 @@ jobs:
|
|
16
16
|
ruby-version: 3.2
|
17
17
|
|
18
18
|
- name: checkout
|
19
|
-
uses: actions/checkout@
|
19
|
+
uses: actions/checkout@v4
|
20
20
|
|
21
21
|
- name: setup gems
|
22
22
|
run: bundle install
|
@@ -24,5 +24,11 @@ jobs:
|
|
24
24
|
- name: setup dependencies
|
25
25
|
run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
|
26
26
|
|
27
|
+
- name: lib
|
28
|
+
run: bundle exec rake lib
|
29
|
+
|
30
|
+
- name: ext
|
31
|
+
run: bundle exec rake ext
|
32
|
+
|
27
33
|
- name: test
|
28
34
|
run: bundle exec rake test
|
data/ChangeLog.md
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
# xot ChangeLog
|
2
2
|
|
3
3
|
|
4
|
+
## [v0.2.1] - 2024-07-05
|
5
|
+
|
6
|
+
- Add xot/util.rb
|
7
|
+
- Add system_error_text()
|
8
|
+
- Add get_refc_count() for debugging
|
9
|
+
- Add 'packages' task
|
10
|
+
- Update workflows for test
|
11
|
+
- Update to actions/checkout@v4
|
12
|
+
- Fix 'github_actions?'
|
13
|
+
|
14
|
+
|
4
15
|
## [v0.2] - 2024-03-14
|
5
16
|
|
6
17
|
- v0.2
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2
|
1
|
+
0.2.1
|
data/include/xot/exception.h
CHANGED
@@ -40,7 +40,9 @@ namespace Xot
|
|
40
40
|
};
|
41
41
|
|
42
42
|
|
43
|
-
String error_text
|
43
|
+
String error_text (const char* file, int line, const char* str);
|
44
|
+
|
45
|
+
String system_error_text (const char* file, int line, const char* str);
|
44
46
|
|
45
47
|
|
46
48
|
namespace ErrorFunctions
|
data/include/xot/ref.h
CHANGED
data/lib/xot/extconf.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
require 'xot/rake/util'
|
2
1
|
require 'xot/block_util'
|
2
|
+
require 'xot/util'
|
3
|
+
require 'xot/rake/util'
|
3
4
|
|
4
5
|
|
5
6
|
module Xot
|
@@ -8,6 +9,7 @@ module Xot
|
|
8
9
|
class ExtConf
|
9
10
|
|
10
11
|
include Xot::Rake
|
12
|
+
include Xot::Util
|
11
13
|
|
12
14
|
attr_reader :extensions, :defs, :inc_dirs, :lib_dirs, :headers, :libs, :local_libs, :frameworks
|
13
15
|
|
data/lib/xot/rake/util.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'erb'
|
2
2
|
require 'rbconfig'
|
3
|
+
require 'xot/util'
|
3
4
|
|
4
5
|
|
5
6
|
module Xot
|
@@ -7,6 +8,8 @@ module Xot
|
|
7
8
|
|
8
9
|
module Rake
|
9
10
|
|
11
|
+
include Xot::Util
|
12
|
+
|
10
13
|
def extensions()
|
11
14
|
env(:EXTENSIONS, []).map {|m| m::Extension}
|
12
15
|
end
|
@@ -224,46 +227,6 @@ module Xot
|
|
224
227
|
env :DEBUG, false
|
225
228
|
end
|
226
229
|
|
227
|
-
def ci?()
|
228
|
-
github_actions?
|
229
|
-
end
|
230
|
-
|
231
|
-
def github_actions?()
|
232
|
-
env :GITHUB_ACTIONS, false
|
233
|
-
end
|
234
|
-
|
235
|
-
def win32?()
|
236
|
-
RUBY_PLATFORM =~ /mswin|ming|cygwin/
|
237
|
-
end
|
238
|
-
|
239
|
-
def mswin?()
|
240
|
-
RUBY_PLATFORM =~ /mswin/
|
241
|
-
end
|
242
|
-
|
243
|
-
def ming?()
|
244
|
-
RUBY_PLATFORM =~ /ming/
|
245
|
-
end
|
246
|
-
|
247
|
-
def cygwin?()
|
248
|
-
RUBY_PLATFORM =~ /cygwin/
|
249
|
-
end
|
250
|
-
|
251
|
-
def osx?()
|
252
|
-
RUBY_PLATFORM =~ /darwin/
|
253
|
-
end
|
254
|
-
|
255
|
-
def ios?()
|
256
|
-
false
|
257
|
-
end
|
258
|
-
|
259
|
-
def gcc?()
|
260
|
-
RbConfig::CONFIG['CXX'] =~ /(^|\s)g\+\+/i
|
261
|
-
end
|
262
|
-
|
263
|
-
def clang?()
|
264
|
-
RbConfig::CONFIG['CXX'] =~ /(^|\s)clang/i
|
265
|
-
end
|
266
|
-
|
267
230
|
def cxx()
|
268
231
|
env :CXX, RbConfig::CONFIG['CXX'] || 'g++'
|
269
232
|
end
|
data/lib/xot/rake.rb
CHANGED
@@ -12,7 +12,6 @@ module Xot
|
|
12
12
|
|
13
13
|
module Rake
|
14
14
|
|
15
|
-
|
16
15
|
def srcs_map()
|
17
16
|
paths = glob("#{src_dir}/**/*.{#{src_exts.join ','}}") +
|
18
17
|
erbs_map.values.grep(/\.(#{src_exts.join '|'})$/)
|
@@ -273,6 +272,20 @@ module Xot
|
|
273
272
|
end
|
274
273
|
end
|
275
274
|
|
275
|
+
def install_packages(osx: [], win32: [])
|
276
|
+
desc "install packages"
|
277
|
+
task :packages do
|
278
|
+
case
|
279
|
+
when osx? && osx.size > 0
|
280
|
+
sh %( brew install #{osx.join ' '} )
|
281
|
+
when win32? && win32.size > 0
|
282
|
+
prefix = 'MINGW_PACKAGE_PREFIX'
|
283
|
+
packages = win32.map {|package| package.sub prefix, ENV[prefix]}
|
284
|
+
sh %( pacman -S --noconfirm #{packages.join ' '} )
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
276
289
|
def use_external_library(
|
277
290
|
repos, branch: nil, tag: nil, commit: nil,
|
278
291
|
incdirs: nil, srcdirs: nil, excludes: [],
|
@@ -346,11 +359,11 @@ module Xot
|
|
346
359
|
end
|
347
360
|
|
348
361
|
def define_placeholder_tasks()
|
349
|
-
desc "
|
350
|
-
alias_task :
|
362
|
+
desc "setup all external libraries"
|
363
|
+
alias_task :vendor
|
351
364
|
|
352
|
-
desc "
|
353
|
-
alias_task :
|
365
|
+
desc "convert erb files"
|
366
|
+
alias_task :erb
|
354
367
|
|
355
368
|
desc "build native library"
|
356
369
|
alias_task :lib
|
@@ -358,20 +371,20 @@ module Xot
|
|
358
371
|
desc "build ruby extension"
|
359
372
|
alias_task :ext
|
360
373
|
|
361
|
-
desc "
|
362
|
-
alias_task :
|
374
|
+
desc "run all tests"
|
375
|
+
alias_task :test
|
363
376
|
|
364
377
|
desc "generate documentations"
|
365
378
|
alias_task :doc
|
366
379
|
|
367
|
-
desc "
|
368
|
-
alias_task :
|
380
|
+
desc "build ruby gem"
|
381
|
+
alias_task :gem
|
369
382
|
|
370
|
-
desc "
|
371
|
-
alias_task :
|
383
|
+
desc "delete temporary files"
|
384
|
+
alias_task :clean
|
372
385
|
|
373
|
-
desc "
|
374
|
-
alias_task :
|
386
|
+
desc "delete all generated files"
|
387
|
+
alias_task :clobber => :clean
|
375
388
|
end
|
376
389
|
|
377
390
|
|
data/lib/xot/test.rb
CHANGED
data/lib/xot/util.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
|
4
|
+
module Xot
|
5
|
+
|
6
|
+
|
7
|
+
extend module Util
|
8
|
+
|
9
|
+
def osx?()
|
10
|
+
/darwin/.match? RUBY_PLATFORM
|
11
|
+
end
|
12
|
+
|
13
|
+
def ios?()
|
14
|
+
false
|
15
|
+
end
|
16
|
+
|
17
|
+
def win32?()
|
18
|
+
/mswin|ming|cygwin/.match? RUBY_PLATFORM
|
19
|
+
end
|
20
|
+
|
21
|
+
def mswin?()
|
22
|
+
/mswin/.match? RUBY_PLATFORM
|
23
|
+
end
|
24
|
+
|
25
|
+
def mingw?()
|
26
|
+
/ming/.match? RUBY_PLATFORM
|
27
|
+
end
|
28
|
+
|
29
|
+
def cygwin?()
|
30
|
+
/cygwin/.match? RUBY_PLATFORM
|
31
|
+
end
|
32
|
+
|
33
|
+
def gcc?()
|
34
|
+
/(^|\s)g\+\+/i.match? RbConfig::CONFIG['CXX']
|
35
|
+
end
|
36
|
+
|
37
|
+
def clang?()
|
38
|
+
/(^|\s)clang/i.match? RbConfig::CONFIG['CXX']
|
39
|
+
end
|
40
|
+
|
41
|
+
def github_actions?()
|
42
|
+
ENV['GITHUB_ACTIONS'] == 'true'
|
43
|
+
end
|
44
|
+
|
45
|
+
alias ci? github_actions?
|
46
|
+
|
47
|
+
self
|
48
|
+
|
49
|
+
end# Util
|
50
|
+
|
51
|
+
|
52
|
+
end# Xot
|
data/lib/xot.rb
CHANGED
data/src/exception.cpp
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
#include "xot/exception.h"
|
2
2
|
|
3
3
|
|
4
|
+
#ifdef WIN32
|
5
|
+
#include <windows.h>
|
6
|
+
#endif
|
7
|
+
|
8
|
+
|
4
9
|
namespace Xot
|
5
10
|
{
|
6
11
|
|
@@ -37,6 +42,34 @@ namespace Xot
|
|
37
42
|
return s;
|
38
43
|
}
|
39
44
|
|
45
|
+
String
|
46
|
+
system_error_text (const char* file, int line, const char* str)
|
47
|
+
{
|
48
|
+
String s = str;
|
49
|
+
|
50
|
+
#ifdef WIN32
|
51
|
+
DWORD lasterror = GetLastError();
|
52
|
+
if (lasterror != 0)
|
53
|
+
{
|
54
|
+
LPVOID msg = NULL;
|
55
|
+
DWORD flags =
|
56
|
+
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
57
|
+
FORMAT_MESSAGE_FROM_SYSTEM |
|
58
|
+
FORMAT_MESSAGE_IGNORE_INSERTS;
|
59
|
+
if (FormatMessageA(
|
60
|
+
flags, NULL, lasterror, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
61
|
+
(LPSTR) &msg, 0, NULL))
|
62
|
+
{
|
63
|
+
String m = (LPCSTR) msg;
|
64
|
+
if (!m.empty()) s += ": " + m;
|
65
|
+
}
|
66
|
+
LocalFree(msg);
|
67
|
+
}
|
68
|
+
#endif
|
69
|
+
|
70
|
+
return error_text(file, line, s);
|
71
|
+
}
|
72
|
+
|
40
73
|
|
41
74
|
namespace ErrorFunctions
|
42
75
|
{
|
@@ -73,7 +106,7 @@ namespace Xot
|
|
73
106
|
system_error (const char* file, int line, const char* format, ...)
|
74
107
|
{
|
75
108
|
XOT_STRINGF(format, s);
|
76
|
-
throw SystemError(
|
109
|
+
throw SystemError(system_error_text(file, line, s));
|
77
110
|
}
|
78
111
|
|
79
112
|
void
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xordog
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This library include some useful utility classes and functions for development
|
14
14
|
with C++.
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- lib/xot/setter.rb
|
60
60
|
- lib/xot/test.rb
|
61
61
|
- lib/xot/universal_accessor.rb
|
62
|
+
- lib/xot/util.rb
|
62
63
|
- src/debug.cpp
|
63
64
|
- src/exception.cpp
|
64
65
|
- src/string.cpp
|