xrb 0.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +1 -0
  3. data/bake/xrb/entities.rb +60 -0
  4. data/bake/xrb/parsers.rb +66 -0
  5. data/ext/Makefile +270 -0
  6. data/ext/XRB_Extension.bundle +0 -0
  7. data/ext/escape.o +0 -0
  8. data/ext/extconf.h +5 -0
  9. data/ext/extconf.rb +21 -0
  10. data/ext/markup.o +0 -0
  11. data/ext/mkmf.log +122 -0
  12. data/ext/query.o +0 -0
  13. data/ext/tag.o +0 -0
  14. data/ext/template.o +0 -0
  15. data/ext/xrb/escape.c +152 -0
  16. data/ext/xrb/escape.h +15 -0
  17. data/ext/xrb/markup.c +1949 -0
  18. data/ext/xrb/markup.h +6 -0
  19. data/ext/xrb/markup.rl +226 -0
  20. data/ext/xrb/query.c +619 -0
  21. data/ext/xrb/query.h +6 -0
  22. data/ext/xrb/query.rl +82 -0
  23. data/ext/xrb/tag.c +204 -0
  24. data/ext/xrb/tag.h +21 -0
  25. data/ext/xrb/template.c +1114 -0
  26. data/ext/xrb/template.h +6 -0
  27. data/ext/xrb/template.rl +77 -0
  28. data/ext/xrb/xrb.c +72 -0
  29. data/ext/xrb/xrb.h +132 -0
  30. data/ext/xrb.o +0 -0
  31. data/lib/xrb/buffer.rb +103 -0
  32. data/lib/xrb/builder.rb +229 -0
  33. data/lib/xrb/entities.rb +2137 -0
  34. data/lib/xrb/entities.xrb +15 -0
  35. data/lib/xrb/error.rb +81 -0
  36. data/lib/xrb/fallback/markup.rb +1657 -0
  37. data/lib/xrb/fallback/markup.rl +227 -0
  38. data/lib/xrb/fallback/query.rb +548 -0
  39. data/lib/xrb/fallback/query.rl +88 -0
  40. data/lib/xrb/fallback/template.rb +829 -0
  41. data/lib/xrb/fallback/template.rl +80 -0
  42. data/lib/xrb/markup.rb +56 -0
  43. data/lib/xrb/native.rb +15 -0
  44. data/lib/xrb/parsers.rb +16 -0
  45. data/lib/xrb/query.rb +80 -0
  46. data/lib/xrb/reference.rb +108 -0
  47. data/lib/xrb/strings.rb +47 -0
  48. data/lib/xrb/tag.rb +115 -0
  49. data/lib/xrb/template.rb +128 -0
  50. data/lib/xrb/uri.rb +100 -0
  51. data/lib/xrb/version.rb +8 -0
  52. data/lib/xrb.rb +11 -0
  53. data/license.md +23 -0
  54. data/readme.md +34 -0
  55. data.tar.gz.sig +0 -0
  56. metadata +118 -58
  57. metadata.gz.sig +2 -0
  58. data/README +0 -60
  59. data/app/helpers/ui_helper.rb +0 -80
  60. data/app/models/xrb/element.rb +0 -9
  61. data/lib/xrb/engine.rb +0 -4
  62. data/rails/init.rb +0 -1
  63. data/xrb.gemspec +0 -12
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 474ad7c9ebec6fba7e79782a390ca3adc53846778c44114653f8dfec1d9343d6
4
+ data.tar.gz: 5be0e794884ef893ccdb2a5f6fc8117d797381401ff11b9d494feb9f063524f2
5
+ SHA512:
6
+ metadata.gz: 132854e0a26f998ed20640e764dacae455f5e4f210fe69e5d2c9e9dc517a4fb4bd79a8e38997754ca475c60433bb4c0074f5215e5a36082e1eb9dd65b2823fe6
7
+ data.tar.gz: d8229a75ce4b215d413495f807cb27eedcc9f434bf401ae590aa37945a4e59b94d7477d0d038b5b860f20fe91fb28496ca5abb7e0577b2b6298d185c12366619
checksums.yaml.gz.sig ADDED
@@ -0,0 +1 @@
1
+ c�w��j48j�%�iߟc�3lO �16��\�TݪK�ɲ���L�9rz��wKO�������"��D�N��eѮ�k%>�D�H[�0���.��axh3�L%ZkU�"�tW&�Ҟ���YN��LD��1�>���1��@�=���KJ�����v��sʗAi�1���J9�P�Y��l��<$�m ��s�S*��57+���\d#k/�/u��>�p��d&�e�&/�߲��nc!C� �Ĉ���s$�b6O���u�w=ѥt���w���
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2017-2024, by Samuel Williams.
5
+
6
+ # Fetch the HTML5 entities from w3.org and update the local cache.
7
+ # @parameter force [Boolean] Whether to force regenerate the local cache.
8
+ def fetch_entities(force: false)
9
+ require 'json'
10
+ require 'async'
11
+ require 'async/http/internet'
12
+
13
+ internet = Async::HTTP::Internet.new
14
+ entites_json_path = self.entites_json_path
15
+
16
+ if force || !File.exist?(entites_json_path)
17
+ url = "https://www.w3.org/TR/html5/entities.json"
18
+
19
+ Sync do
20
+ File.write(entites_json_path, internet.get(url).read)
21
+ end
22
+ end
23
+
24
+ return JSON.parse(File.read(entites_json_path)).delete_if{|string, _| !string.end_with? ';'}
25
+ end
26
+
27
+ # Consume the HTML5 entites and generate parsers to escape them.
28
+ # @parameter wet [Boolean] Whether to write updated files.
29
+ def update_entities(wet: false)
30
+ require 'xrb/template'
31
+
32
+ paths = {
33
+ # 'ext/xrb/entities.rl' => 'ext/xrb/entities.xrb',
34
+ 'lib/xrb/entities.rb' => 'lib/xrb/entities.xrb',
35
+ }
36
+
37
+ entities = self.fetch_entities
38
+
39
+ paths.each do |output_path, template_path|
40
+ template_path = File.expand_path(template_path, context.root)
41
+ output_path = File.expand_path(output_path, context.root)
42
+
43
+ template = XRB::Template.load_file(template_path)
44
+
45
+ output = template.to_string(entities)
46
+
47
+ if wet
48
+ File.write(output_path, output)
49
+ else
50
+ puts "*** #{output_path} ***"
51
+ puts output
52
+ end
53
+ end
54
+ end
55
+
56
+ private
57
+
58
+ def entites_json_path
59
+ File.expand_path("entities.json", context.root)
60
+ end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2017-2024, by Samuel Williams.
5
+
6
+ # Generate the pure Ruby parsers.
7
+ def generate_fallback
8
+ pattern = File.join(fallback_directory, "*.rl")
9
+
10
+ Dir.glob(pattern, base: context.root).each do |parser_path|
11
+ system("ragel", "-I", parsers_directory, "-R", parser_path, "-F1", chdir: context.root)
12
+ end
13
+ end
14
+
15
+ # Generate the native C parsers.
16
+ def generate_native
17
+ pattern = File.join(native_directory, "*.rl")
18
+
19
+ Dir.glob(pattern, base: context.root).each do |parser_path|
20
+ system("ragel", "-I", parsers_directory, "-C", parser_path, "-G2", chdir: context.root)
21
+ end
22
+ end
23
+
24
+ # Generate the parsers and compile them as required.
25
+ def generate
26
+ self.generate_native
27
+ self.generate_fallback
28
+ end
29
+
30
+ # Generate a visualisation of the parsers.
31
+ def visualize_parsers
32
+ Dir.chdir(fallback_directory) do
33
+ Dir.glob("*.rl").each do |parser_path|
34
+ dot_path = parser_path + ".dot"
35
+ system("ragel", "-I", parsers_directory, "-Vp", parser_path, "-o", dot_path)
36
+
37
+ pdf_path = parser_path + ".pdf"
38
+ system("dot", "-Tpdf", "-o", pdf_path, dot_path)
39
+
40
+ system("open", pdf_path) rescue nil
41
+ end
42
+ end
43
+ end
44
+
45
+ private
46
+
47
+ def parsers_directory
48
+ "parsers"
49
+ end
50
+
51
+ def fallback_directory
52
+ "lib/xrb/fallback"
53
+ end
54
+
55
+ def extensions_directory
56
+ "ext"
57
+ end
58
+
59
+ def native_directory
60
+ "ext/xrb"
61
+ end
62
+
63
+ def system(*arguments, **options)
64
+ Console.info(self, arguments: arguments, options: options)
65
+ super
66
+ end
data/ext/Makefile ADDED
@@ -0,0 +1,270 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ # V=0 quiet, V=1 verbose. other values don't work.
5
+ V = 0
6
+ V0 = $(V:0=)
7
+ Q1 = $(V:1=)
8
+ Q = $(Q1:0=@)
9
+ ECHO1 = $(V:1=@ :)
10
+ ECHO = $(ECHO1:0=@ echo)
11
+ NULLCMD = :
12
+
13
+ #### Start of system configuration section. ####
14
+
15
+ srcdir = .
16
+ topdir = /Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0
17
+ hdrdir = $(topdir)
18
+ arch_hdrdir = /Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0/arm64-darwin23
19
+ PATH_SEPARATOR = :
20
+ VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby:$(srcdir)/xrb
21
+ prefix = $(DESTDIR)/Users/samuel/.rubies/ruby-3.3.0
22
+ rubysitearchprefix = $(rubylibprefix)/$(sitearch)
23
+ rubyarchprefix = $(rubylibprefix)/$(arch)
24
+ rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
25
+ exec_prefix = $(prefix)
26
+ vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
27
+ sitearchhdrdir = $(sitehdrdir)/$(sitearch)
28
+ rubyarchhdrdir = $(rubyhdrdir)/$(arch)
29
+ vendorhdrdir = $(rubyhdrdir)/vendor_ruby
30
+ sitehdrdir = $(rubyhdrdir)/site_ruby
31
+ rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
32
+ vendorarchdir = $(vendorlibdir)/$(sitearch)
33
+ vendorlibdir = $(vendordir)/$(ruby_version)
34
+ vendordir = $(rubylibprefix)/vendor_ruby
35
+ sitearchdir = $(sitelibdir)/$(sitearch)
36
+ sitelibdir = $(sitedir)/$(ruby_version)
37
+ sitedir = $(rubylibprefix)/site_ruby
38
+ rubyarchdir = $(rubylibdir)/$(arch)
39
+ rubylibdir = $(rubylibprefix)/$(ruby_version)
40
+ sitearchincludedir = $(includedir)/$(sitearch)
41
+ archincludedir = $(includedir)/$(arch)
42
+ sitearchlibdir = $(libdir)/$(sitearch)
43
+ archlibdir = $(libdir)/$(arch)
44
+ ridir = $(datarootdir)/$(RI_BASE_NAME)
45
+ mandir = $(datarootdir)/man
46
+ localedir = $(datarootdir)/locale
47
+ libdir = $(exec_prefix)/lib
48
+ psdir = $(docdir)
49
+ pdfdir = $(docdir)
50
+ dvidir = $(docdir)
51
+ htmldir = $(docdir)
52
+ infodir = $(datarootdir)/info
53
+ docdir = $(datarootdir)/doc/$(PACKAGE)
54
+ oldincludedir = $(DESTDIR)/usr/include
55
+ includedir = $(SDKROOT)$(prefix)/include
56
+ runstatedir = $(localstatedir)/run
57
+ localstatedir = $(prefix)/var
58
+ sharedstatedir = $(prefix)/com
59
+ sysconfdir = $(prefix)/etc
60
+ datadir = $(datarootdir)
61
+ datarootdir = $(prefix)/share
62
+ libexecdir = $(exec_prefix)/libexec
63
+ sbindir = $(exec_prefix)/sbin
64
+ bindir = $(exec_prefix)/bin
65
+ archdir = $(rubyarchdir)
66
+
67
+
68
+ CC_WRAPPER =
69
+ CC = clang
70
+ CXX = clang++
71
+ LIBRUBY = $(LIBRUBY_A)
72
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
73
+ LIBRUBYARG_SHARED =
74
+ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework CoreFoundation $(MAINLIBS)
75
+ empty =
76
+ OUTFLAG = -o $(empty)
77
+ COUTFLAG = -o $(empty)
78
+ CSRCFLAG = $(empty)
79
+
80
+ RUBY_EXTCONF_H = extconf.h
81
+ cflags = -fdeclspec $(optflags) $(debugflags) $(warnflags)
82
+ cxxflags =
83
+ optflags = -O3 -fno-fast-math
84
+ debugflags = -ggdb3
85
+ warnflags = -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef
86
+ cppflags =
87
+ CCDLFLAGS = -fno-common
88
+ CFLAGS = $(CCDLFLAGS) $(cflags) -pipe -O3 -Wall -Wno-unknown-pragmas -std=c99 $(ARCH_FLAG)
89
+ INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
90
+ DEFS =
91
+ CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\" -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
92
+ CXXFLAGS = $(CCDLFLAGS) -fdeclspec $(ARCH_FLAG)
93
+ ldflags = -L. -fstack-protector-strong -L/opt/local/lib
94
+ dldflags = -L/opt/local/lib -Wl,-undefined,dynamic_lookup -bundle_loader '$(BUILTRUBY)'
95
+ ARCH_FLAG = -arch arm64
96
+ DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
97
+ LDSHARED = $(CC) -dynamic -bundle
98
+ LDSHAREDXX = $(CXX) -dynamic -bundle
99
+ AR = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar
100
+ EXEEXT =
101
+
102
+ RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
103
+ RUBY_SO_NAME = ruby.3.3
104
+ RUBYW_INSTALL_NAME =
105
+ RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
106
+ RUBYW_BASE_NAME = rubyw
107
+ RUBY_BASE_NAME = ruby
108
+
109
+ arch = arm64-darwin23
110
+ sitearch = $(arch)
111
+ ruby_version = 3.3.0
112
+ ruby = $(bindir)/$(RUBY_BASE_NAME)
113
+ RUBY = $(ruby)
114
+ BUILTRUBY = $(bindir)/$(RUBY_BASE_NAME)
115
+ ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h $(RUBY_EXTCONF_H)
116
+
117
+ RM = rm -f
118
+ RM_RF = rm -fr
119
+ RMDIRS = rmdir -p
120
+ MAKEDIRS = /opt/local/bin/gmkdir -p
121
+ INSTALL = /opt/local/bin/ginstall -c
122
+ INSTALL_PROG = $(INSTALL) -m 0755
123
+ INSTALL_DATA = $(INSTALL) -m 644
124
+ COPY = cp
125
+ TOUCH = exit >
126
+
127
+ #### End of system configuration section. ####
128
+
129
+ preload =
130
+ libpath = . $(libdir) /opt/local/lib
131
+ LIBPATH = -L. -L$(libdir) -L/opt/local/lib
132
+ DEFFILE =
133
+
134
+ CLEANFILES = mkmf.log
135
+ DISTCLEANFILES =
136
+ DISTCLEANDIRS =
137
+
138
+ extout =
139
+ extout_prefix =
140
+ target_prefix =
141
+ LOCAL_LIBS =
142
+ LIBS = -lpthread
143
+ ORIG_SRCS =
144
+ SRCS = $(ORIG_SRCS) escape.c markup.c query.c tag.c template.c xrb.c
145
+ OBJS = escape.o markup.o query.o tag.o template.o xrb.o
146
+ HDRS = $(srcdir)/extconf.h
147
+ LOCAL_HDRS =
148
+ TARGET = XRB_Extension
149
+ TARGET_NAME = XRB_Extension
150
+ TARGET_ENTRY = Init_$(TARGET_NAME)
151
+ DLLIB = $(TARGET).bundle
152
+ EXTSTATIC =
153
+ STATIC_LIB =
154
+
155
+ TIMESTAMP_DIR = .
156
+ BINDIR = $(bindir)
157
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
158
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
159
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
160
+ HDRDIR = $(sitehdrdir)$(target_prefix)
161
+ ARCHHDRDIR = $(sitearchhdrdir)$(target_prefix)
162
+ TARGET_SO_DIR =
163
+ TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
164
+ CLEANLIBS = $(TARGET_SO) $(TARGET_SO).dSYM
165
+ CLEANOBJS = $(OBJS) *.bak
166
+ TARGET_SO_DIR_TIMESTAMP = $(TIMESTAMP_DIR)/.sitearchdir.time
167
+
168
+ all: $(DLLIB)
169
+ static: $(STATIC_LIB)
170
+ .PHONY: all install static install-so install-rb
171
+ .PHONY: clean clean-so clean-static clean-rb
172
+
173
+ clean-static::
174
+ clean-rb-default::
175
+ clean-rb::
176
+ clean-so::
177
+ clean: clean-so clean-static clean-rb-default clean-rb
178
+ -$(Q)$(RM_RF) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
179
+
180
+ distclean-rb-default::
181
+ distclean-rb::
182
+ distclean-so::
183
+ distclean-static::
184
+ distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
185
+ -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
186
+ -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
187
+ -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
188
+
189
+ realclean: distclean
190
+ install: install-so install-rb
191
+
192
+ install-so: $(DLLIB) $(TARGET_SO_DIR_TIMESTAMP)
193
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
194
+ clean-static::
195
+ -$(Q)$(RM) $(STATIC_LIB)
196
+ install-rb: pre-install-rb do-install-rb install-rb-default
197
+ install-rb-default: pre-install-rb-default do-install-rb-default
198
+ pre-install-rb: Makefile
199
+ pre-install-rb-default: Makefile
200
+ do-install-rb:
201
+ do-install-rb-default:
202
+ pre-install-rb-default:
203
+ @$(NULLCMD)
204
+ $(TARGET_SO_DIR_TIMESTAMP):
205
+ $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
206
+ $(Q) $(TOUCH) $@
207
+
208
+ site-install: site-install-so site-install-rb
209
+ site-install-so: install-so
210
+ site-install-rb: install-rb
211
+
212
+ .SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
213
+
214
+ .cc.o:
215
+ $(ECHO) compiling $(<)
216
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
217
+
218
+ .cc.S:
219
+ $(ECHO) translating $(<)
220
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
221
+
222
+ .mm.o:
223
+ $(ECHO) compiling $(<)
224
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
225
+
226
+ .mm.S:
227
+ $(ECHO) translating $(<)
228
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
229
+
230
+ .cxx.o:
231
+ $(ECHO) compiling $(<)
232
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
233
+
234
+ .cxx.S:
235
+ $(ECHO) translating $(<)
236
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
237
+
238
+ .cpp.o:
239
+ $(ECHO) compiling $(<)
240
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
241
+
242
+ .cpp.S:
243
+ $(ECHO) translating $(<)
244
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
245
+
246
+ .c.o:
247
+ $(ECHO) compiling $(<)
248
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
249
+
250
+ .c.S:
251
+ $(ECHO) translating $(<)
252
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
253
+
254
+ .m.o:
255
+ $(ECHO) compiling $(<)
256
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
257
+
258
+ .m.S:
259
+ $(ECHO) translating $(<)
260
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
261
+
262
+ $(TARGET_SO): $(OBJS) Makefile
263
+ $(ECHO) linking shared-object $(DLLIB)
264
+ -$(Q)$(RM) $(@)
265
+ $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
266
+ $(Q) $(POSTLINK)
267
+
268
+
269
+
270
+ $(OBJS): $(HDRS) $(ruby_headers)
Binary file
data/ext/escape.o ADDED
Binary file
data/ext/extconf.h ADDED
@@ -0,0 +1,5 @@
1
+ #ifndef EXTCONF_H
2
+ #define EXTCONF_H
3
+ #define HAVE_RB_SYM2STR 1
4
+ #define HAVE_RB_STR_CAT_CSTR 1
5
+ #endif
data/ext/extconf.rb ADDED
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2016-2024, by Samuel Williams.
5
+
6
+ return if RUBY_DESCRIPTION =~ /jruby/
7
+
8
+ require 'mkmf'
9
+
10
+ $CFLAGS << " -O3 -Wall -Wno-unknown-pragmas -std=c99"
11
+
12
+ have_func("rb_sym2str")
13
+ have_func("rb_str_cat_cstr")
14
+ have_func("rb_str_reserve")
15
+
16
+ $srcs = Dir.glob("xrb/*.c")
17
+ $VPATH << "$(srcdir)/xrb"
18
+
19
+ create_header
20
+
21
+ create_makefile('XRB_Extension')
data/ext/markup.o ADDED
Binary file
data/ext/mkmf.log ADDED
@@ -0,0 +1,122 @@
1
+ have_func: checking for rb_sym2str()... -------------------- yes
2
+
3
+ DYLD_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-3.3.0/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0/arm64-darwin23 -I/Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe -O3 -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.3.0/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -arch arm64 -lruby.3.3-static -framework CoreFoundation -ldl -lobjc -lpthread -lpthread "
4
+ ld: warning: ignoring duplicate libraries: '-lpthread'
5
+ checked program was:
6
+ /* begin */
7
+ 1: #include "ruby.h"
8
+ 2:
9
+ 3: int main(int argc, char **argv)
10
+ 4: {
11
+ 5: return !!argv[argc];
12
+ 6: }
13
+ /* end */
14
+
15
+ DYLD_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-3.3.0/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0/arm64-darwin23 -I/Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe -O3 -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.3.0/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -arch arm64 -lruby.3.3-static -framework CoreFoundation -ldl -lobjc -lpthread -lpthread "
16
+ ld: warning: ignoring duplicate libraries: '-lpthread'
17
+ checked program was:
18
+ /* begin */
19
+ 1: #include "ruby.h"
20
+ 2:
21
+ 3: /*top*/
22
+ 4: extern int t(void);
23
+ 5: int main(int argc, char **argv)
24
+ 6: {
25
+ 7: if (argc > 1000000) {
26
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
27
+ 9: printf("%d", (*tp)());
28
+ 10: }
29
+ 11:
30
+ 12: return !!argv[argc];
31
+ 13: }
32
+ 14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_sym2str; return !p; }
33
+ /* end */
34
+
35
+ --------------------
36
+
37
+ have_func: checking for rb_str_cat_cstr()... -------------------- yes
38
+
39
+ DYLD_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-3.3.0/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0/arm64-darwin23 -I/Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe -O3 -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.3.0/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -arch arm64 -lruby.3.3-static -framework CoreFoundation -ldl -lobjc -lpthread -lpthread "
40
+ ld: warning: ignoring duplicate libraries: '-lpthread'
41
+ checked program was:
42
+ /* begin */
43
+ 1: #include "ruby.h"
44
+ 2:
45
+ 3: /*top*/
46
+ 4: extern int t(void);
47
+ 5: int main(int argc, char **argv)
48
+ 6: {
49
+ 7: if (argc > 1000000) {
50
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
51
+ 9: printf("%d", (*tp)());
52
+ 10: }
53
+ 11:
54
+ 12: return !!argv[argc];
55
+ 13: }
56
+ 14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_str_cat_cstr; return !p; }
57
+ /* end */
58
+
59
+ --------------------
60
+
61
+ have_func: checking for rb_str_reserve()... -------------------- no
62
+
63
+ DYLD_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-3.3.0/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0/arm64-darwin23 -I/Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe -O3 -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.3.0/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -arch arm64 -lruby.3.3-static -framework CoreFoundation -ldl -lobjc -lpthread -lpthread "
64
+ conftest.c:14:57: error: use of undeclared identifier 'rb_str_reserve'
65
+ int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_str_reserve; return !p; }
66
+ ^
67
+ 1 error generated.
68
+ checked program was:
69
+ /* begin */
70
+ 1: #include "ruby.h"
71
+ 2:
72
+ 3: /*top*/
73
+ 4: extern int t(void);
74
+ 5: int main(int argc, char **argv)
75
+ 6: {
76
+ 7: if (argc > 1000000) {
77
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
78
+ 9: printf("%d", (*tp)());
79
+ 10: }
80
+ 11:
81
+ 12: return !!argv[argc];
82
+ 13: }
83
+ 14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_str_reserve; return !p; }
84
+ /* end */
85
+
86
+ DYLD_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-3.3.0/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0/arm64-darwin23 -I/Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.3.0/include/ruby-3.3.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe -O3 -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.3.0/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -arch arm64 -lruby.3.3-static -framework CoreFoundation -ldl -lobjc -lpthread -lpthread "
87
+ ld: warning: ignoring duplicate libraries: '-lpthread'
88
+ Undefined symbols for architecture arm64:
89
+ "_rb_str_reserve", referenced from:
90
+ _t in conftest-abc093.o
91
+ ld: symbol(s) not found for architecture arm64
92
+ clang: error: linker command failed with exit code 1 (use -v to see invocation)
93
+ checked program was:
94
+ /* begin */
95
+ 1: #include "ruby.h"
96
+ 2:
97
+ 3: /*top*/
98
+ 4: extern int t(void);
99
+ 5: int main(int argc, char **argv)
100
+ 6: {
101
+ 7: if (argc > 1000000) {
102
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
103
+ 9: printf("%d", (*tp)());
104
+ 10: }
105
+ 11:
106
+ 12: return !!argv[argc];
107
+ 13: }
108
+ 14: extern void rb_str_reserve();
109
+ 15: int t(void) { rb_str_reserve(); return 0; }
110
+ /* end */
111
+
112
+ --------------------
113
+
114
+ extconf.h is:
115
+ /* begin */
116
+ 1: #ifndef EXTCONF_H
117
+ 2: #define EXTCONF_H
118
+ 3: #define HAVE_RB_SYM2STR 1
119
+ 4: #define HAVE_RB_STR_CAT_CSTR 1
120
+ 5: #endif
121
+ /* end */
122
+
data/ext/query.o ADDED
Binary file
data/ext/tag.o ADDED
Binary file
data/ext/template.o ADDED
Binary file