notcurses 0.0.1 → 0.0.2

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.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +54 -0
  3. data/Gemfile +2 -0
  4. data/Gemfile.lock +9 -1
  5. data/Rakefile +11 -0
  6. data/Rakefile.new +28 -0
  7. data/TODO +19 -0
  8. data/checksums/notcurses-0.0.1.gem.sha512 +1 -0
  9. data/data/PurpleDrank.jpg +0 -0
  10. data/data/Windows10Logo.png +0 -0
  11. data/data/aidsrobots.jpeg +0 -0
  12. data/data/atma.png +0 -0
  13. data/data/changes.jpg +0 -0
  14. data/data/changes.xcf +0 -0
  15. data/data/chunli01.png +0 -0
  16. data/data/chunli02.png +0 -0
  17. data/data/chunli03.png +0 -0
  18. data/data/chunli04.png +0 -0
  19. data/data/chunli05.png +0 -0
  20. data/data/chunli06.png +0 -0
  21. data/data/chunli07.png +0 -0
  22. data/data/chunli08.png +0 -0
  23. data/data/chunli09.png +0 -0
  24. data/data/chunli1.bmp +0 -0
  25. data/data/chunli10.png +0 -0
  26. data/data/chunli11.png +0 -0
  27. data/data/chunli12.png +0 -0
  28. data/data/chunli13.png +0 -0
  29. data/data/chunli14.png +0 -0
  30. data/data/chunli15.png +0 -0
  31. data/data/chunli16.png +0 -0
  32. data/data/chunli17.png +0 -0
  33. data/data/chunli18.png +0 -0
  34. data/data/chunli19.png +0 -0
  35. data/data/chunli2.bmp +0 -0
  36. data/data/chunli20.png +0 -0
  37. data/data/chunli21.png +0 -0
  38. data/data/chunli22.png +0 -0
  39. data/data/chunli23.png +0 -0
  40. data/data/chunli24.png +0 -0
  41. data/data/chunli25.png +0 -0
  42. data/data/chunli26.png +0 -0
  43. data/data/chunli27.png +0 -0
  44. data/data/chunli28.png +0 -0
  45. data/data/chunli29.png +0 -0
  46. data/data/chunli3.bmp +0 -0
  47. data/data/chunli30.png +0 -0
  48. data/data/chunli31.png +0 -0
  49. data/data/chunli32.png +1 -0
  50. data/data/chunli33.png +1 -0
  51. data/data/chunli34.png +1 -0
  52. data/data/chunli35.png +1 -0
  53. data/data/chunli36.png +1 -0
  54. data/data/chunli37.png +1 -0
  55. data/data/chunli38.png +0 -0
  56. data/data/chunli39.png +1 -0
  57. data/data/chunli4.bmp +0 -0
  58. data/data/chunli40.png +0 -0
  59. data/data/chunli41.png +1 -0
  60. data/data/chunli42.png +1 -0
  61. data/data/chunli43.png +1 -0
  62. data/data/chunli44.png +1 -0
  63. data/data/chunli45.png +0 -0
  64. data/data/chunli5.bmp +0 -0
  65. data/data/chunli6.bmp +0 -0
  66. data/data/chunli7.bmp +0 -0
  67. data/data/chunli8.bmp +0 -0
  68. data/data/covid19.jpg +0 -0
  69. data/data/dsscaw-purp.png +0 -0
  70. data/data/eagles.png +0 -0
  71. data/data/fm6.mov +0 -0
  72. data/data/fonts.jpg +0 -0
  73. data/data/freebsd.png +0 -0
  74. data/data/lamepatents.jpg +0 -0
  75. data/data/megaman2.bmp +0 -0
  76. data/data/natasha-blur.png +0 -0
  77. data/data/natasha-blur.xcf +0 -0
  78. data/data/normal.png +0 -0
  79. data/data/normal.xcf +0 -0
  80. data/data/notcurses.png +0 -0
  81. data/data/notcursesIII.mov +0 -0
  82. data/data/onedot.png +0 -0
  83. data/data/samoa.avi +0 -0
  84. data/data/samoa.osp +296 -0
  85. data/data/spaceship.png +0 -0
  86. data/data/tetris-background.jpg +0 -0
  87. data/data/tetris-background.xcf +0 -0
  88. data/data/warmech.bmp +0 -0
  89. data/data/worldmap.png +0 -0
  90. data/exe/notcurses-ruby-testscript +57 -0
  91. data/ext/notcurses/extconf.rb +56 -17
  92. data/ext/notcurses/{notcurses_wrap.c → src/notcurses_wrap.c} +55459 -18930
  93. data/ext/notcurses/swig/notcurses.i +552 -0
  94. data/lib/notcurses/swig_mixins/struct_initializer.rb +25 -0
  95. data/lib/notcurses/swig_mixins/to_h.rb +22 -0
  96. data/lib/notcurses/version.rb +1 -1
  97. data/lib/notcurses.rb +34 -1
  98. metadata +98 -11
  99. data/ext/notcurses/Makefile +0 -269
  100. data/ext/notcurses/notcurses.i +0 -282
  101. data/ext/notcurses/notcurses_wrapper.h +0 -20
  102. /data/ext/notcurses/{ncplane_vprintf_aligned.c → src/ruby_ncplane_vprintf_aligned.c} +0 -0
  103. /data/ext/notcurses/{ncplane_vprintf_stained.c → src/ruby_ncplane_vprintf_stained.c} +0 -0
  104. /data/ext/notcurses/{ncplane_vprintf_yx.c → src/ruby_ncplane_vprintf_yx.c} +0 -0
  105. /data/ext/notcurses/{modified_ruby_std_wstring.i → swig/modified_ruby_std_wstring.i} +0 -0
data/data/samoa.osp ADDED
@@ -0,0 +1,296 @@
1
+ {
2
+ "id": "XMTS54606Y",
3
+ "fps": {
4
+ "num": 60,
5
+ "den": 1
6
+ },
7
+ "display_ratio": {
8
+ "num": 16,
9
+ "den": 9
10
+ },
11
+ "pixel_ratio": {
12
+ "num": 1,
13
+ "den": 1
14
+ },
15
+ "width": 1920,
16
+ "height": 1080,
17
+ "sample_rate": 44100,
18
+ "channels": 2,
19
+ "channel_layout": 3,
20
+ "settings": {},
21
+ "clips": [],
22
+ "effects": [],
23
+ "export_path": "",
24
+ "import_path": "",
25
+ "files": [
26
+ {
27
+ "acodec": "",
28
+ "audio_bit_rate": 0,
29
+ "audio_stream_index": -1,
30
+ "audio_timebase": {
31
+ "den": 1,
32
+ "num": 1
33
+ },
34
+ "channel_layout": 4,
35
+ "channels": 0,
36
+ "display_ratio": {
37
+ "den": 9,
38
+ "num": 16
39
+ },
40
+ "duration": 4,
41
+ "file_size": "-1",
42
+ "fps": {
43
+ "den": 1,
44
+ "num": 25
45
+ },
46
+ "has_audio": false,
47
+ "has_single_image": false,
48
+ "has_video": true,
49
+ "height": 1080,
50
+ "interlaced_frame": false,
51
+ "metadata": {},
52
+ "path": "@assets/blender/1C4P66L0XX/samoa%04d.png",
53
+ "pixel_format": 26,
54
+ "pixel_ratio": {
55
+ "den": 2835,
56
+ "num": 2835
57
+ },
58
+ "sample_rate": 0,
59
+ "top_field_first": true,
60
+ "type": "FFmpegReader",
61
+ "vcodec": "png",
62
+ "video_bit_rate": 0,
63
+ "video_length": "100",
64
+ "video_stream_index": 0,
65
+ "video_timebase": {
66
+ "den": 25,
67
+ "num": 1
68
+ },
69
+ "width": 1920,
70
+ "media_type": "video",
71
+ "id": "SIXE6FENU7",
72
+ "image": "@assets/thumbnail/SIXE6FENU7.png"
73
+ }
74
+ ],
75
+ "duration": 300,
76
+ "scale": 15,
77
+ "tick_pixels": 100,
78
+ "playhead_position": 0,
79
+ "profile": "HD 1080p 60 fps",
80
+ "layers": [
81
+ {
82
+ "id": "L1",
83
+ "label": "",
84
+ "number": 1000000,
85
+ "y": 0,
86
+ "lock": false
87
+ },
88
+ {
89
+ "id": "L2",
90
+ "label": "",
91
+ "number": 2000000,
92
+ "y": 0,
93
+ "lock": false
94
+ },
95
+ {
96
+ "id": "L3",
97
+ "label": "",
98
+ "number": 3000000,
99
+ "y": 0,
100
+ "lock": false
101
+ },
102
+ {
103
+ "id": "L4",
104
+ "label": "",
105
+ "number": 4000000,
106
+ "y": 0,
107
+ "lock": false
108
+ },
109
+ {
110
+ "id": "L5",
111
+ "label": "",
112
+ "number": 5000000,
113
+ "y": 0,
114
+ "lock": false
115
+ }
116
+ ],
117
+ "markers": [],
118
+ "progress": [],
119
+ "history": {
120
+ "undo": [
121
+ {
122
+ "type": "insert",
123
+ "key": [
124
+ "files"
125
+ ],
126
+ "value": {
127
+ "acodec": "",
128
+ "audio_bit_rate": 0,
129
+ "audio_stream_index": -1,
130
+ "audio_timebase": {
131
+ "den": 1,
132
+ "num": 1
133
+ },
134
+ "channel_layout": 4,
135
+ "channels": 0,
136
+ "display_ratio": {
137
+ "den": 9,
138
+ "num": 16
139
+ },
140
+ "duration": 4,
141
+ "file_size": "-1",
142
+ "fps": {
143
+ "den": 1,
144
+ "num": 25
145
+ },
146
+ "has_audio": false,
147
+ "has_single_image": false,
148
+ "has_video": true,
149
+ "height": 1080,
150
+ "interlaced_frame": false,
151
+ "metadata": {},
152
+ "path": ".openshot_qt/blender/UJAG8TBMSM/samoa%04d.png",
153
+ "pixel_format": 26,
154
+ "pixel_ratio": {
155
+ "den": 2835,
156
+ "num": 2835
157
+ },
158
+ "sample_rate": 0,
159
+ "top_field_first": true,
160
+ "type": "FFmpegReader",
161
+ "vcodec": "png",
162
+ "video_bit_rate": 0,
163
+ "video_length": "100",
164
+ "video_stream_index": 0,
165
+ "video_timebase": {
166
+ "den": 25,
167
+ "num": 1
168
+ },
169
+ "width": 1920,
170
+ "media_type": "video",
171
+ "id": "NOHS35RJIJ"
172
+ },
173
+ "partial": false,
174
+ "old_values": []
175
+ },
176
+ {
177
+ "type": "delete",
178
+ "key": [
179
+ "files",
180
+ {
181
+ "id": "NOHS35RJIJ"
182
+ }
183
+ ],
184
+ "value": null,
185
+ "partial": false,
186
+ "old_values": {
187
+ "acodec": "",
188
+ "audio_bit_rate": 0,
189
+ "audio_stream_index": -1,
190
+ "audio_timebase": {
191
+ "den": 1,
192
+ "num": 1
193
+ },
194
+ "channel_layout": 4,
195
+ "channels": 0,
196
+ "display_ratio": {
197
+ "den": 9,
198
+ "num": 16
199
+ },
200
+ "duration": 4,
201
+ "file_size": "-1",
202
+ "fps": {
203
+ "den": 1,
204
+ "num": 25
205
+ },
206
+ "has_audio": false,
207
+ "has_single_image": false,
208
+ "has_video": true,
209
+ "height": 1080,
210
+ "interlaced_frame": false,
211
+ "metadata": {},
212
+ "path": ".openshot_qt/blender/UJAG8TBMSM/samoa%04d.png",
213
+ "pixel_format": 26,
214
+ "pixel_ratio": {
215
+ "den": 2835,
216
+ "num": 2835
217
+ },
218
+ "sample_rate": 0,
219
+ "top_field_first": true,
220
+ "type": "FFmpegReader",
221
+ "vcodec": "png",
222
+ "video_bit_rate": 0,
223
+ "video_length": "100",
224
+ "video_stream_index": 0,
225
+ "video_timebase": {
226
+ "den": 25,
227
+ "num": 1
228
+ },
229
+ "width": 1920,
230
+ "media_type": "video",
231
+ "id": "NOHS35RJIJ"
232
+ }
233
+ },
234
+ {
235
+ "type": "insert",
236
+ "key": [
237
+ "files"
238
+ ],
239
+ "value": {
240
+ "acodec": "",
241
+ "audio_bit_rate": 0,
242
+ "audio_stream_index": -1,
243
+ "audio_timebase": {
244
+ "den": 1,
245
+ "num": 1
246
+ },
247
+ "channel_layout": 4,
248
+ "channels": 0,
249
+ "display_ratio": {
250
+ "den": 9,
251
+ "num": 16
252
+ },
253
+ "duration": 4,
254
+ "file_size": "-1",
255
+ "fps": {
256
+ "den": 1,
257
+ "num": 25
258
+ },
259
+ "has_audio": false,
260
+ "has_single_image": false,
261
+ "has_video": true,
262
+ "height": 1080,
263
+ "interlaced_frame": false,
264
+ "metadata": {},
265
+ "path": ".openshot_qt/blender/1C4P66L0XX/samoa%04d.png",
266
+ "pixel_format": 26,
267
+ "pixel_ratio": {
268
+ "den": 2835,
269
+ "num": 2835
270
+ },
271
+ "sample_rate": 0,
272
+ "top_field_first": true,
273
+ "type": "FFmpegReader",
274
+ "vcodec": "png",
275
+ "video_bit_rate": 0,
276
+ "video_length": "100",
277
+ "video_stream_index": 0,
278
+ "video_timebase": {
279
+ "den": 25,
280
+ "num": 1
281
+ },
282
+ "width": 1920,
283
+ "media_type": "video",
284
+ "id": "SIXE6FENU7"
285
+ },
286
+ "partial": false,
287
+ "old_values": []
288
+ }
289
+ ],
290
+ "redo": []
291
+ },
292
+ "version": {
293
+ "openshot-qt": "2.5.1-dev2",
294
+ "libopenshot": "0.2.5-dev2"
295
+ }
296
+ }
Binary file
Binary file
Binary file
data/data/warmech.bmp ADDED
Binary file
data/data/worldmap.png ADDED
Binary file
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'notcurses'
4
+ require 'rubygems'
5
+
6
+ def find_gem_directory(gem_name)
7
+ spec = Gem::Specification.find_by_name(gem_name)
8
+ spec.gem_dir
9
+ rescue Gem::LoadError
10
+ puts "Gem '#{gem_name}' is not installed."
11
+ nil
12
+ end
13
+
14
+ include Notcurses
15
+
16
+ data_dir = File.join [
17
+ find_gem_directory('notcurses'),
18
+ 'data',
19
+ ]
20
+
21
+ movfile = File.join [
22
+ data_dir,
23
+ 'notcursesIII.mov',
24
+ ]
25
+
26
+ ncroot_opts = NotcursesOptions.new
27
+ ncroot = notcurses_init(ncroot_opts, STDOUT)[:return]
28
+
29
+ at_exit do
30
+ notcurses_stop(ncroot) if ncroot
31
+
32
+ if $! && !$!.is_a?(SystemExit)
33
+ puts "An uncaught exception occurred: #{$!.inspect}"
34
+ puts "Backtrace:"
35
+ puts $!.backtrace
36
+ end
37
+ end
38
+
39
+ stdp = notcurses_stdplane_const(ncroot)[:return]
40
+
41
+ ncv = ncvisual_from_file(movfile)[:return]
42
+ rows = ncplane_dim_y(stdp)[:return]
43
+ cols = ncplane_dim_x(stdp)[:return]
44
+
45
+ ncv_opts = NcvisualOptions.new(
46
+ n: stdp,
47
+ scaling: NCSCALE_STRETCH,
48
+ flags: NCVISUAL_OPTION_NOINTERPOLATE
49
+ )
50
+
51
+ ncv_plane = ncvisual_blit(ncroot, ncv, ncv_opts)
52
+ ncplane_putwstr_aligned(stdp, rows / 2, NCALIGN_CENTER, "😺 IT WOOORRKKSSS 😺")
53
+ ncplane_putwstr_aligned(stdp, (rows / 2) + 1, NCALIGN_CENTER, "😺 PRESS ANY KEY TO EXIT 😺")
54
+ notcurses_render(ncroot)
55
+
56
+ ch = Ncinput.new
57
+ notcurses_get(ncroot, Time.now, ch)
@@ -1,19 +1,39 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'mkmf'
3
+ def swig_version
4
+ out = `swig -version | grep '^SWIG Version'`
5
+ out.split&.last&.split('.').take(2).join('.')
6
+ end
4
7
 
5
- #dir_config('notcurses')
8
+ abort "compatible with SWIG v4.0 ONLY" if swig_version != "4.0"
9
+
10
+ require 'mkmf'
6
11
 
7
- $srcs = Dir.glob('*.c')
12
+ c_files_dir = 'src'
8
13
 
9
14
  # Specify additional include directories
10
15
  notcurses_include_path = '/usr/include/notcurses'
16
+ defines = Array.new
11
17
 
12
- defines = %w[
13
- __x86_64__
14
- __linux__
15
- _ISbit
16
- ]
18
+ case RUBY_PLATFORM
19
+ when /darwin/ then defines << "__APPLE__"
20
+ when /linux/ then defines << "__linux__"
21
+ when /mingw|mswin/ then defines << "_WIN32"
22
+ else
23
+ abort "unsupported platform #{RUBY_PLATFORM}"
24
+ end
25
+
26
+ case RUBY_PLATFORM
27
+ when /x86_64/ then defines << "__x86_64__"
28
+ when /i386|i686/ then defines << "__i386__"
29
+ when /aarch64|arm64/ then defines << "__ARM64__"
30
+ when /arm/ then defines << "__ARM__"
31
+ else
32
+ warn "might have issues with this architecture"
33
+ end
34
+
35
+ defines << '_ISbit'
36
+ defines << 'SWIG_RUBY_AUTORENAME'
17
37
 
18
38
  include_paths = [
19
39
  "/usr/include",
@@ -22,11 +42,28 @@ include_paths = [
22
42
  "/usr/include/c++/11/tr1",
23
43
  "/usr/include/x86_64-linux-gnu",
24
44
  "/usr/include/x86_64-linux-gnu/c++/11",
45
+ "#{__dir__}/src",
25
46
  notcurses_include_path,
26
47
  ]
27
48
 
28
- append_cflags("-I#{notcurses_include_path}")
29
- swig_cmd = "swig -D#{defines.join(' -D')} -ruby -I#{include_paths.join(' -I')} notcurses.i"
49
+ append_cflags('-Wno-old-style-definition')
50
+
51
+ swig_interface_path = [
52
+ File.dirname(__FILE__),
53
+ 'swig',
54
+ 'notcurses.i'
55
+ ].join(File::SEPARATOR)
56
+
57
+ swig_cmd = [
58
+ 'swig',
59
+ "-D#{defines.join(' -D')}",
60
+ '-ruby',
61
+ "-I#{include_paths.join(' -I')}",
62
+ '-o',
63
+ [ __dir__, c_files_dir, 'notcurses_wrap.c' ].join(File::SEPARATOR),
64
+ swig_interface_path,
65
+ ].join(' ')
66
+
30
67
  puts "SWIG COMMAND IS #{swig_cmd}"
31
68
 
32
69
  `#{swig_cmd}`
@@ -34,12 +71,14 @@ unless $?.success?
34
71
  abort "swig generate command (#{swig_cmd}) failed"
35
72
  end
36
73
 
37
- # You can add multiple directories if needed
38
- # append_cflags("-I/path/to/another/include")
74
+ $srcs = Dir.glob [
75
+ File.dirname(__FILE__),
76
+ c_files_dir,
77
+ '*.c',
78
+ ].join(File::Separator)
79
+
80
+ $objs = $srcs.map { |src| src.gsub(/\.c$/, '.o') }
39
81
 
40
- #include_paths.each do |inc|
41
- # append_cflags("-I #{inc}")
42
- #end
43
82
  %w[
44
83
  direct.h
45
84
  nckeys.h
@@ -55,9 +94,9 @@ end
55
94
 
56
95
  %w[ notcurses notcurses-core ].each do |lib|
57
96
  unless have_library(lib)
58
- abort "notcurses library is missing. Please install notcurses."
97
+ abort "#{lib} library is missing. Please install lib#{lib}."
59
98
  end
60
99
  end
61
100
 
62
101
  # Create Makefile
63
- create_makefile('notcurses')
102
+ create_makefile('notcurses', c_files_dir)