diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-27 22:52:44 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-27 22:52:44 -0400 |
| commit | 472719a3be3e7b6f2810aa6bad63550a1327360a (patch) | |
| tree | 25646f18cac2a44707fc9be1dfc7fc54a292af47 | |
| parent | d3727cb8d2ba959a4bf3387c9aa8848f233cfcab (diff) | |
| download | wittle-472719a3be3e7b6f2810aa6bad63550a1327360a.tar.gz wittle-472719a3be3e7b6f2810aa6bad63550a1327360a.tar.bz2 wittle-472719a3be3e7b6f2810aa6bad63550a1327360a.zip | |
gemspec
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | Gemfile | 3 | ||||
| -rw-r--r-- | Gemfile.lock | 13 | ||||
| -rw-r--r-- | ext/wittle_generator/Generate.cpp | 2 | ||||
| -rw-r--r-- | ext/wittle_generator/Generate.h | 1 | ||||
| -rw-r--r-- | ext/wittle_generator/Makefile | 270 | ||||
| -rw-r--r-- | ext/wittle_generator/Test.cpp | 15 | ||||
| -rw-r--r-- | ext/wittle_generator/extconf.rb | 2 | ||||
| -rw-r--r-- | ext/wittle_generator/wittle_generator.cpp | 28 | ||||
| -rw-r--r-- | lib/keep | 0 | ||||
| -rw-r--r-- | lib/wittle_generator.rb | 3 | ||||
| -rw-r--r-- | lib/wittle_generator/version.rb | 3 | ||||
| -rw-r--r-- | wittle_generator.gemspec | 15 |
13 files changed, 353 insertions, 5 deletions
| diff --git a/.gitignore b/.gitignore index caaa972..eff03a5 100644 --- a/.gitignore +++ b/.gitignore | |||
| @@ -1 +1,4 @@ | |||
| 1 | ext/wittle_generator/build | 1 | ext/wittle_generator/build |
| 2 | *.o | ||
| 3 | mkmf.log | ||
| 4 | wittle_generator.bundle | ||
| diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..3b674ae --- /dev/null +++ b/Gemfile | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | source 'https://rubygems.org' | ||
| 2 | |||
| 3 | gem 'rice' | ||
| diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..16be444 --- /dev/null +++ b/Gemfile.lock | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | GEM | ||
| 2 | remote: https://rubygems.org/ | ||
| 3 | specs: | ||
| 4 | rice (4.1.0) | ||
| 5 | |||
| 6 | PLATFORMS | ||
| 7 | x86_64-darwin-22 | ||
| 8 | |||
| 9 | DEPENDENCIES | ||
| 10 | rice | ||
| 11 | |||
| 12 | BUNDLED WITH | ||
| 13 | 2.4.10 | ||
| diff --git a/ext/wittle_generator/Generate.cpp b/ext/wittle_generator/Generate.cpp index 4cc3ce9..5e38ba8 100644 --- a/ext/wittle_generator/Generate.cpp +++ b/ext/wittle_generator/Generate.cpp | |||
| @@ -2109,3 +2109,5 @@ bool Generate::combine_shapes(std::vector<Shape>& shapes) { | |||
| 2109 | } | 2109 | } |
| 2110 | 2110 | ||
| 2111 | bool Generate::hasSymbolOrPath(int x, int y) { return get(x, y) != 0; } | 2111 | bool Generate::hasSymbolOrPath(int x, int y) { return get(x, y) != 0; } |
| 2112 | |||
| 2113 | std::string Generate::AsCode() { return _panel->Write(); } | ||
| diff --git a/ext/wittle_generator/Generate.h b/ext/wittle_generator/Generate.h index 0dc5fc3..cbb870d 100644 --- a/ext/wittle_generator/Generate.h +++ b/ext/wittle_generator/Generate.h | |||
| @@ -86,6 +86,7 @@ class Generate { | |||
| 86 | } | 86 | } |
| 87 | void setGridSize(int width, int height); | 87 | void setGridSize(int width, int height); |
| 88 | void setSymmetry(Panel::Symmetry symmetry); | 88 | void setSymmetry(Panel::Symmetry symmetry); |
| 89 | std::string AsCode(); | ||
| 89 | void write(int id); | 90 | void write(int id); |
| 90 | void setFlag(Config option) { _config |= option; }; | 91 | void setFlag(Config option) { _config |= option; }; |
| 91 | void setFlagOnce(Config option) { | 92 | void setFlagOnce(Config option) { |
| diff --git a/ext/wittle_generator/Makefile b/ext/wittle_generator/Makefile new file mode 100644 index 0000000..2df1195 --- /dev/null +++ b/ext/wittle_generator/Makefile | |||
| @@ -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/hatkirby/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0 | ||
| 17 | hdrdir = $(topdir) | ||
| 18 | arch_hdrdir = /Users/hatkirby/.rvm/rubies/ruby-3.2.2/include/ruby-3.2.0/x86_64-darwin22 | ||
| 19 | PATH_SEPARATOR = : | ||
| 20 | VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby | ||
| 21 | prefix = $(DESTDIR)/Users/hatkirby/.rvm/rubies/ruby-3.2.2 | ||
| 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 = gcc | ||
| 70 | CXX = g++ | ||
| 71 | LIBRUBY = $(LIBRUBY_SO) | ||
| 72 | LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a | ||
| 73 | LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME) | ||
| 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 = | ||
| 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 -Wmisleading-indentation -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 -Wundef | ||
| 86 | cppflags = | ||
| 87 | CCDLFLAGS = -fno-common | ||
| 88 | CFLAGS = $(CCDLFLAGS) -O3 -I/usr/local/opt/libyaml/include -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl@1.1/include $(cflags) -fno-common -pipe $(ARCH_FLAG) | ||
| 89 | INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) -I/Users/hatkirby/.rvm/gems/ruby-3.2.2/gems/rice-4.1.0/include | ||
| 90 | DEFS = | ||
| 91 | CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags) | ||
| 92 | CXXFLAGS = $(CCDLFLAGS) -fdeclspec -std=c++17 $(ARCH_FLAG) | ||
| 93 | ldflags = -L. -L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl@1.1/lib -fstack-protector-strong | ||
| 94 | dldflags = -L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl@1.1/lib -Wl,-multiply_defined,suppress $(LIBRUBYARG_SHARED) | ||
| 95 | ARCH_FLAG = | ||
| 96 | DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG) | ||
| 97 | LDSHARED = $(CC) -dynamic -bundle | ||
| 98 | LDSHAREDXX = $(CXX) -dynamic -bundle | ||
| 99 | AR = ar | ||
| 100 | EXEEXT = | ||
| 101 | |||
| 102 | RUBY_INSTALL_NAME = $(RUBY_BASE_NAME) | ||
| 103 | RUBY_SO_NAME = ruby.3.2 | ||
| 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 = x86_64-darwin22 | ||
| 110 | sitearch = $(arch) | ||
| 111 | ruby_version = 3.2.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 | ||
| 116 | |||
| 117 | RM = rm -f | ||
| 118 | RM_RF = rm -fr | ||
| 119 | RMDIRS = rmdir -p | ||
| 120 | MAKEDIRS = /usr/local/opt/coreutils/bin/gmkdir -p | ||
| 121 | INSTALL = /usr/local/opt/coreutils/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) | ||
| 131 | LIBPATH = -L. -L$(libdir) | ||
| 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 = $(LIBRUBYARG_SHARED) -lc++ -lpthread | ||
| 143 | ORIG_SRCS = Generate.cpp Panel.cpp Random.cpp Serializer.cpp Test.cpp wittle_generator.cpp | ||
| 144 | SRCS = $(ORIG_SRCS) | ||
| 145 | OBJS = Generate.o Panel.o Random.o Serializer.o Test.o wittle_generator.o | ||
| 146 | HDRS = $(srcdir)/Base64.h $(srcdir)/Generate.h $(srcdir)/Panel.h $(srcdir)/PuzzleSymbols.h $(srcdir)/Random.h $(srcdir)/Serializer.h | ||
| 147 | LOCAL_HDRS = | ||
| 148 | TARGET = wittle_generator | ||
| 149 | TARGET_NAME = wittle_generator | ||
| 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) $(LDSHAREDXX) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS) | ||
| 266 | $(Q) $(POSTLINK) | ||
| 267 | |||
| 268 | |||
| 269 | |||
| 270 | $(OBJS): $(HDRS) $(ruby_headers) | ||
| diff --git a/ext/wittle_generator/Test.cpp b/ext/wittle_generator/Test.cpp index ecd2a37..8273da8 100644 --- a/ext/wittle_generator/Test.cpp +++ b/ext/wittle_generator/Test.cpp | |||
| @@ -2,13 +2,18 @@ | |||
| 2 | 2 | ||
| 3 | int main(int, char**) { | 3 | int main(int, char**) { |
| 4 | Generate generator; | 4 | Generate generator; |
| 5 | generator.setFlag(Generate::RegularStartEnd); | 5 | // generator.setFlag(Generate::RegularStartEnd); |
| 6 | /*generator.generate(4 * 2 + 1, 4 * 2 + 1, | 6 | /*generator.generate(4 * 2 + 1, 4 * 2 + 1, |
| 7 | {{{Decoration::Triangle | Decoration::Orange, 6}}});*/ | 7 | {{{Decoration::Triangle | Decoration::Orange, 6}}});*/ |
| 8 | generator.setSymmetry(Panel::Vertical); | 8 | // generator.setSymmetry(Panel::Vertical); |
| 9 | generator.generate( | 9 | generator.setSymbol(Decoration::Exit, 0, 0); |
| 10 | 5 * 2 + 1, 5 * 2 + 1, | 10 | generator.setSymbol(Decoration::Exit, 7 * 2, 0); |
| 11 | {{{Decoration::Triangle | Decoration::Color::Orange, 6}}}); | 11 | generator.setSymbol(Decoration::Exit, 7 * 2, 7 * 2); |
| 12 | generator.generate(7 * 2 + 1, 7 * 2 + 1, | ||
| 13 | {{{Decoration::Stone | Decoration::Color::White, 10}, | ||
| 14 | {Decoration::Stone | Decoration::Color::Black, 10}, | ||
| 15 | {Decoration::Dot, 10}, | ||
| 16 | {Decoration::Start, 2}}}); | ||
| 12 | 17 | ||
| 13 | return 0; | 18 | return 0; |
| 14 | } | 19 | } |
| diff --git a/ext/wittle_generator/extconf.rb b/ext/wittle_generator/extconf.rb new file mode 100644 index 0000000..8d00284 --- /dev/null +++ b/ext/wittle_generator/extconf.rb | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | require 'mkmf-rice' | ||
| 2 | create_makefile('wittle_generator') | ||
| diff --git a/ext/wittle_generator/wittle_generator.cpp b/ext/wittle_generator/wittle_generator.cpp new file mode 100644 index 0000000..e8f2dba --- /dev/null +++ b/ext/wittle_generator/wittle_generator.cpp | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | #include <rice/rice.hpp> | ||
| 2 | |||
| 3 | #include "Generate.h" | ||
| 4 | |||
| 5 | Rice::Object wittle_generator_generate(Rice::Object /* self */) { | ||
| 6 | Generate generator; | ||
| 7 | // generator.setFlag(Generate::RegularStartEnd); | ||
| 8 | /*generator.generate(4 * 2 + 1, 4 * 2 + 1, | ||
| 9 | {{{Decoration::Triangle | Decoration::Orange, 6}}});*/ | ||
| 10 | // generator.setSymmetry(Panel::Vertical); | ||
| 11 | generator.setSymbol(Decoration::Exit, 0, 0); | ||
| 12 | generator.setSymbol(Decoration::Exit, 7 * 2, 0); | ||
| 13 | generator.setSymbol(Decoration::Exit, 7 * 2, 7 * 2); | ||
| 14 | generator.generate(7 * 2 + 1, 7 * 2 + 1, | ||
| 15 | {{{Decoration::Stone | Decoration::Color::White, 10}, | ||
| 16 | {Decoration::Stone | Decoration::Color::Black, 10}, | ||
| 17 | {Decoration::Dot, 10}, | ||
| 18 | {Decoration::Start, 2}}}); | ||
| 19 | |||
| 20 | Rice::String str(generator.AsCode()); | ||
| 21 | return str; | ||
| 22 | } | ||
| 23 | |||
| 24 | extern "C" void Init_wittle_generator() { | ||
| 25 | Rice::Class rb_cWittleGenerator = | ||
| 26 | Rice::define_class("WittleGenerator") | ||
| 27 | .define_method("generate", &wittle_generator_generate); | ||
| 28 | } | ||
| diff --git a/lib/keep b/lib/keep deleted file mode 100644 index e69de29..0000000 --- a/lib/keep +++ /dev/null | |||
| diff --git a/lib/wittle_generator.rb b/lib/wittle_generator.rb new file mode 100644 index 0000000..f2ac675 --- /dev/null +++ b/lib/wittle_generator.rb | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | # Ensure that native extension is loaded | ||
| 2 | require 'wittle_generator/wittle_generator' | ||
| 3 | require 'wittle_generator/version' | ||
| diff --git a/lib/wittle_generator/version.rb b/lib/wittle_generator/version.rb new file mode 100644 index 0000000..475fba7 --- /dev/null +++ b/lib/wittle_generator/version.rb | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | module WittleGenerator | ||
| 2 | VERSION = '0.0.1' | ||
| 3 | end | ||
| diff --git a/wittle_generator.gemspec b/wittle_generator.gemspec new file mode 100644 index 0000000..b4a791b --- /dev/null +++ b/wittle_generator.gemspec | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | require File.expand_path("../lib/wittle_generator/version", __FILE__) | ||
| 2 | |||
| 3 | Gem::Specification.new do |s| | ||
| 4 | s.name = 'wittle_generator' | ||
| 5 | s.version = WittleGenerator::VERSION | ||
| 6 | s.date = '2023-10-27' | ||
| 7 | s.summary = 'Wittle puzzles generator' | ||
| 8 | s.authors = ['hatkirby', 'Sigma144', 'jbzdarkid'] | ||
| 9 | s.email = ['fefferburbia@gmail.com'] | ||
| 10 | s.licenses = ['MIT'] | ||
| 11 | s.homepage = 'https://code.fourisland.com/wittle-generator' | ||
| 12 | s.extensions = ['ext/wittle_generator/extconf.rb'] | ||
| 13 | s.files = Dir['ext/wittle_generator/*.h', 'ext/wittle_generator/*.cpp'] | ||
| 14 | s.require_paths = ['lib'] | ||
| 15 | end | ||
