scws4r 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,267 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ # V=0 quiet, V=1 verbose. other values don't work.
5
+ V = 0
6
+ Q1 = $(V:1=)
7
+ Q = $(Q1:0=@)
8
+ ECHO1 = $(V:1=@ :)
9
+ ECHO = $(ECHO1:0=@ echo)
10
+ NULLCMD = :
11
+
12
+ #### Start of system configuration section. ####
13
+
14
+ srcdir = .
15
+ topdir = /Users/xiaohui/.rvm/rubies/ruby-2.7.2/include/ruby-2.7.0
16
+ hdrdir = $(topdir)
17
+ arch_hdrdir = /Users/xiaohui/.rvm/rubies/ruby-2.7.2/include/ruby-2.7.0/x86_64-darwin21
18
+ PATH_SEPARATOR = :
19
+ VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
20
+ prefix = $(DESTDIR)/Users/xiaohui/.rvm/rubies/ruby-2.7.2
21
+ rubysitearchprefix = $(rubylibprefix)/$(sitearch)
22
+ rubyarchprefix = $(rubylibprefix)/$(arch)
23
+ rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
24
+ exec_prefix = $(prefix)
25
+ vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
26
+ sitearchhdrdir = $(sitehdrdir)/$(sitearch)
27
+ rubyarchhdrdir = $(rubyhdrdir)/$(arch)
28
+ vendorhdrdir = $(rubyhdrdir)/vendor_ruby
29
+ sitehdrdir = $(rubyhdrdir)/site_ruby
30
+ rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
31
+ vendorarchdir = $(vendorlibdir)/$(sitearch)
32
+ vendorlibdir = $(vendordir)/$(ruby_version)
33
+ vendordir = $(rubylibprefix)/vendor_ruby
34
+ sitearchdir = $(sitelibdir)/$(sitearch)
35
+ sitelibdir = $(sitedir)/$(ruby_version)
36
+ sitedir = $(rubylibprefix)/site_ruby
37
+ rubyarchdir = $(rubylibdir)/$(arch)
38
+ rubylibdir = $(rubylibprefix)/$(ruby_version)
39
+ sitearchincludedir = $(includedir)/$(sitearch)
40
+ archincludedir = $(includedir)/$(arch)
41
+ sitearchlibdir = $(libdir)/$(sitearch)
42
+ archlibdir = $(libdir)/$(arch)
43
+ ridir = $(datarootdir)/$(RI_BASE_NAME)
44
+ mandir = $(datarootdir)/man
45
+ localedir = $(datarootdir)/locale
46
+ libdir = $(exec_prefix)/lib
47
+ psdir = $(docdir)
48
+ pdfdir = $(docdir)
49
+ dvidir = $(docdir)
50
+ htmldir = $(docdir)
51
+ infodir = $(datarootdir)/info
52
+ docdir = $(datarootdir)/doc/$(PACKAGE)
53
+ oldincludedir = $(SDKROOT)/usr/include
54
+ includedir = $(prefix)/include
55
+ runstatedir = $(localstatedir)/run
56
+ localstatedir = $(prefix)/var
57
+ sharedstatedir = $(prefix)/com
58
+ sysconfdir = $(prefix)/etc
59
+ datadir = $(datarootdir)
60
+ datarootdir = $(prefix)/share
61
+ libexecdir = $(exec_prefix)/libexec
62
+ sbindir = $(exec_prefix)/sbin
63
+ bindir = $(exec_prefix)/bin
64
+ archdir = $(rubyarchdir)
65
+
66
+
67
+ CC_WRAPPER =
68
+ CC = gcc
69
+ CXX = g++
70
+ LIBRUBY = $(LIBRUBY_SO)
71
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
72
+ LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
73
+ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework Security -framework Foundation $(MAINLIBS)
74
+ empty =
75
+ OUTFLAG = -o $(empty)
76
+ COUTFLAG = -o $(empty)
77
+ CSRCFLAG = $(empty)
78
+
79
+ RUBY_EXTCONF_H =
80
+ cflags = $(optflags) $(debugflags) $(warnflags)
81
+ cxxflags =
82
+ optflags = -O3
83
+ debugflags = -ggdb3
84
+ warnflags = -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -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 -Wextra-tokens
85
+ cppflags =
86
+ CCDLFLAGS = -fno-common
87
+ CFLAGS = $(CCDLFLAGS) $(cflags) -fno-common -pipe $(ARCH_FLAG)
88
+ INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
89
+ DEFS =
90
+ CPPFLAGS = -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 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
91
+ CXXFLAGS = $(CCDLFLAGS) -g -O2 $(ARCH_FLAG)
92
+ ldflags = -L. -fstack-protector-strong -L/usr/local/lib -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
93
+ dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -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
94
+ ARCH_FLAG =
95
+ DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
96
+ LDSHARED = $(CC) -dynamic -bundle
97
+ LDSHAREDXX = $(CXX) -dynamic -bundle
98
+ AR = libtool -static
99
+ EXEEXT =
100
+
101
+ RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
102
+ RUBY_SO_NAME = ruby.2.7
103
+ RUBYW_INSTALL_NAME =
104
+ RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
105
+ RUBYW_BASE_NAME = rubyw
106
+ RUBY_BASE_NAME = ruby
107
+
108
+ arch = x86_64-darwin21
109
+ sitearch = $(arch)
110
+ ruby_version = 2.7.0
111
+ ruby = $(bindir)/$(RUBY_BASE_NAME)
112
+ RUBY = $(ruby)
113
+ 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
114
+
115
+ RM = rm -f
116
+ RM_RF = $(RUBY) -run -e rm -- -rf
117
+ RMDIRS = rmdir -p
118
+ MAKEDIRS = /usr/local/opt/coreutils/bin/gmkdir -p
119
+ INSTALL = /usr/local/opt/coreutils/bin/ginstall -c
120
+ INSTALL_PROG = $(INSTALL) -m 0755
121
+ INSTALL_DATA = $(INSTALL) -m 644
122
+ COPY = cp
123
+ TOUCH = exit >
124
+
125
+ #### End of system configuration section. ####
126
+
127
+ preload =
128
+ libpath = . $(libdir) /usr/local/opt/libyaml/lib /usr/local/opt/libksba/lib /usr/local/opt/readline/lib /usr/local/opt/zlib/lib /usr/local/opt/openssl@1.1/lib
129
+ LIBPATH = -L. -L$(libdir) -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
130
+ DEFFILE =
131
+
132
+ CLEANFILES = mkmf.log
133
+ DISTCLEANFILES =
134
+ DISTCLEANDIRS =
135
+
136
+ extout =
137
+ extout_prefix =
138
+ target_prefix = /scws4r
139
+ LOCAL_LIBS =
140
+ LIBS = $(LIBRUBYARG_SHARED)
141
+ ORIG_SRCS = charset.c crc32.c darray.c lock.c pool.c rule.c scws.c scws4r.c xdb.c xdict.c xtree.c
142
+ SRCS = $(ORIG_SRCS)
143
+ OBJS = charset.o crc32.o darray.o lock.o pool.o rule.o scws.o scws4r.o xdb.o xdict.o xtree.o
144
+ HDRS = $(srcdir)/xdb.h $(srcdir)/pool.h $(srcdir)/xdict.h $(srcdir)/lock.h $(srcdir)/scws.h $(srcdir)/charset.h $(srcdir)/darray.h $(srcdir)/scws4r.h $(srcdir)/rule.h $(srcdir)/xtree.h $(srcdir)/crc32.h $(srcdir)/config_win32.h
145
+ LOCAL_HDRS =
146
+ TARGET = scws4r
147
+ TARGET_NAME = scws4r
148
+ TARGET_ENTRY = Init_$(TARGET_NAME)
149
+ DLLIB = $(TARGET).bundle
150
+ EXTSTATIC =
151
+ STATIC_LIB =
152
+
153
+ TIMESTAMP_DIR = .
154
+ BINDIR = $(bindir)
155
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
156
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
157
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
158
+ HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
159
+ ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
160
+ TARGET_SO_DIR =
161
+ TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
162
+ CLEANLIBS = $(TARGET_SO)
163
+ CLEANOBJS = *.o *.bak
164
+
165
+ all: $(DLLIB)
166
+ static: $(STATIC_LIB)
167
+ .PHONY: all install static install-so install-rb
168
+ .PHONY: clean clean-so clean-static clean-rb
169
+
170
+ clean-static::
171
+ clean-rb-default::
172
+ clean-rb::
173
+ clean-so::
174
+ clean: clean-so clean-static clean-rb-default clean-rb
175
+ -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
176
+
177
+ distclean-rb-default::
178
+ distclean-rb::
179
+ distclean-so::
180
+ distclean-static::
181
+ distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
182
+ -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
183
+ -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
184
+ -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
185
+
186
+ realclean: distclean
187
+ install: install-so install-rb
188
+
189
+ install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.-.scws4r.time
190
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
191
+ clean-static::
192
+ -$(Q)$(RM) $(STATIC_LIB)
193
+ install-rb: pre-install-rb do-install-rb install-rb-default
194
+ install-rb-default: pre-install-rb-default do-install-rb-default
195
+ pre-install-rb: Makefile
196
+ pre-install-rb-default: Makefile
197
+ do-install-rb:
198
+ do-install-rb-default:
199
+ pre-install-rb-default:
200
+ @$(NULLCMD)
201
+ $(TIMESTAMP_DIR)/.sitearchdir.-.scws4r.time:
202
+ $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
203
+ $(Q) $(TOUCH) $@
204
+
205
+ site-install: site-install-so site-install-rb
206
+ site-install-so: install-so
207
+ site-install-rb: install-rb
208
+
209
+ .SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
210
+
211
+ .cc.o:
212
+ $(ECHO) compiling $(<)
213
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
214
+
215
+ .cc.S:
216
+ $(ECHO) translating $(<)
217
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
218
+
219
+ .mm.o:
220
+ $(ECHO) compiling $(<)
221
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
222
+
223
+ .mm.S:
224
+ $(ECHO) translating $(<)
225
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
226
+
227
+ .cxx.o:
228
+ $(ECHO) compiling $(<)
229
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
230
+
231
+ .cxx.S:
232
+ $(ECHO) translating $(<)
233
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
234
+
235
+ .cpp.o:
236
+ $(ECHO) compiling $(<)
237
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
238
+
239
+ .cpp.S:
240
+ $(ECHO) translating $(<)
241
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
242
+
243
+ .c.o:
244
+ $(ECHO) compiling $(<)
245
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
246
+
247
+ .c.S:
248
+ $(ECHO) translating $(<)
249
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
250
+
251
+ .m.o:
252
+ $(ECHO) compiling $(<)
253
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
254
+
255
+ .m.S:
256
+ $(ECHO) translating $(<)
257
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
258
+
259
+ $(TARGET_SO): $(OBJS) Makefile
260
+ $(ECHO) linking shared-object scws4r/$(DLLIB)
261
+ -$(Q)$(RM) $(@)
262
+ $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
263
+ $(Q) $(POSTLINK)
264
+
265
+
266
+
267
+ $(OBJS): $(HDRS) $(ruby_headers)
@@ -0,0 +1,15 @@
1
+ # $Id$
2
+
3
+ LIBTOOL = @LIBTOOL@ $(QUIET:y=--quiet)
4
+
5
+ libscwsincludedir = @prefix@/include/scws
6
+
7
+ libscwsinclude_HEADERS = charset.h crc32.h pool.h scws.h xdict.h darray.h rule.h xdb.h xtree.h version.h
8
+
9
+ lib_LTLIBRARIES = libscws.la
10
+
11
+ libscws_la_SOURCES = charset.c crc32.c pool.c scws.c xdict.c darray.c rule.c lock.c xdb.c xtree.c
12
+
13
+ libscws_la_LDFLAGS = @LDFLAGS@ -no-undefined -version-info @SHARED_LIB_VERSION@
14
+
15
+ EXTRA_DIST = lock.h config_win32.h
@@ -0,0 +1,90 @@
1
+ /**
2
+ * @file mblen.c
3
+ * @author Hightman Mar
4
+ * @editor set number ; syntax on ; set autoindent ; set tabstop=4 (vim)
5
+ * $Id$
6
+ */
7
+
8
+ #ifdef WIN32
9
+ # include "config_win32.h"
10
+ #endif
11
+
12
+ #include <stdio.h>
13
+ #include <string.h>
14
+ #include "charset.h"
15
+
16
+ /* utf-8: 0xc0, 0xe0, 0xf0, 0xf8, 0xfc */
17
+ static unsigned char _mblen_table_utf8[] =
18
+ {
19
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
20
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
21
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
22
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
23
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
24
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
25
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
26
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
27
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
28
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
29
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
30
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
31
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
32
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
33
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
34
+ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1
35
+ };
36
+
37
+ /* gbk(gb2312|big5): 0x81 ~ 0xfe */
38
+ static unsigned char _mblen_table_gbk[] =
39
+ {
40
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
41
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
42
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
43
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
44
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
45
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
46
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
47
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
48
+ 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
49
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
50
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
51
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
52
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
53
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
54
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
55
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1
56
+ };
57
+
58
+ /* load & cs table */
59
+ struct mblen_tab
60
+ {
61
+ char *name;
62
+ unsigned char *table;
63
+ };
64
+
65
+ static struct mblen_tab mblen_tab_list[] =
66
+ {
67
+ { "utf8", _mblen_table_utf8 },
68
+ { "utf-8", _mblen_table_utf8 },
69
+ { "gb2312", _mblen_table_gbk },
70
+ { "gbk", _mblen_table_gbk },
71
+ { "big5", _mblen_table_gbk },
72
+ { "big-5", _mblen_table_gbk },
73
+ { NULL, NULL }
74
+ };
75
+
76
+ unsigned char *charset_table_get(const char *cs)
77
+ {
78
+ struct mblen_tab *mt;
79
+
80
+ if (cs == NULL)
81
+ return _mblen_table_gbk;
82
+
83
+ for (mt = mblen_tab_list; mt->name != NULL; mt++)
84
+ {
85
+ if (!strcasecmp(mt->name, cs))
86
+ return mt->table;
87
+ }
88
+
89
+ return _mblen_table_gbk;
90
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @file charset.h
3
+ * @author Hightman Mar
4
+ * @editor set number ; syntax on ; set autoindent ; set tabstop=4 (vim)
5
+ * $Id$
6
+ */
7
+
8
+ #ifndef _SCWS_CHARSET_20070528_H_
9
+ #define _SCWS_CHARSET_20070528_H_
10
+
11
+ /* api used to change the charset assocted */
12
+ unsigned char *charset_table_get(const char *cs);
13
+
14
+ #endif
@@ -0,0 +1,22 @@
1
+ #ifndef CONFIG_W32_H
2
+ #define CONFIG_W32_H
3
+
4
+ #include <windows.h>
5
+ #include <io.h>
6
+
7
+ #ifndef inline
8
+ # define inline __inline
9
+ #endif
10
+
11
+ #define strcasecmp(s1, s2) _stricmp(s1, s2)
12
+ #define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
13
+
14
+ #ifndef S_ISREG
15
+ #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
16
+ #endif
17
+
18
+ #ifndef logf
19
+ #define logf(x) ((float)log((double)(x)))
20
+ #endif
21
+
22
+ #endif
@@ -0,0 +1,103 @@
1
+ /**
2
+ * @file crc32.c
3
+ * @author Hightman Mar
4
+ * @editor set number ; syntax on ; set autoindent ; set tabstop=4 (vim)
5
+ * $Id$
6
+ */
7
+
8
+ #include "crc32.h"
9
+
10
+ /*
11
+ * This code implements the AUTODIN II polynomial
12
+ * The variable corresponding to the macro argument "crc" should
13
+ * be an unsigned long.
14
+ * Oroginal code by Spencer Garrett <srg@quick.com>
15
+ */
16
+
17
+ #define CRC32(crc, ch) (crc = (crc >> 8) ^ crc32tab[(crc ^ (ch)) & 0xff])
18
+
19
+ /* generated using the AUTODIN II polynomial
20
+ * x^32 + x^26 + x^23 + x^22 + x^16 +
21
+ * x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + 1
22
+ */
23
+
24
+ static const unsigned int crc32tab[256] = {
25
+ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
26
+ 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
27
+ 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
28
+ 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
29
+ 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
30
+ 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
31
+ 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
32
+ 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
33
+ 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
34
+ 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
35
+ 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
36
+ 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
37
+ 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
38
+ 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
39
+ 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
40
+ 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
41
+ 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
42
+ 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
43
+ 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
44
+ 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
45
+ 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
46
+ 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
47
+ 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
48
+ 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
49
+ 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
50
+ 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
51
+ 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
52
+ 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
53
+ 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
54
+ 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
55
+ 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
56
+ 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
57
+ 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
58
+ 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
59
+ 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
60
+ 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
61
+ 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
62
+ 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
63
+ 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
64
+ 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
65
+ 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
66
+ 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
67
+ 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
68
+ 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
69
+ 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
70
+ 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
71
+ 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
72
+ 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
73
+ 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
74
+ 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
75
+ 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
76
+ 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
77
+ 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
78
+ 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
79
+ 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
80
+ 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
81
+ 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
82
+ 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
83
+ 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
84
+ 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
85
+ 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
86
+ 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
87
+ 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
88
+ 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
89
+ };
90
+
91
+
92
+ unsigned int scws_crc32(const char *str)
93
+ {
94
+ unsigned int crc = ~0;
95
+ unsigned char *p = (unsigned char *) str;
96
+
97
+ while (*p != '\0')
98
+ {
99
+ CRC32(crc, *p);
100
+ p++;
101
+ }
102
+ return ~crc;
103
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @file crc32.h
3
+ * @author Hightman Mar
4
+ * @editor set number ; syntax on ; set autoindent ; set tabstop=4 (vim)
5
+ * $Id$
6
+ */
7
+
8
+ #ifndef _SCWS_CRC32_20100128_H_
9
+ #define _SCWS_CRC32_20100128_H_
10
+
11
+ unsigned int scws_crc32(const char *str);
12
+
13
+ #endif
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @file xdict.c (dictionary query)
3
+ * @author Hightman Mar
4
+ * @editor set number ; syntax on ; set autoindent ; set tabstop=4 (vim)
5
+ * $Id$
6
+ */
7
+
8
+ #include "darray.h"
9
+ #include <stdio.h>
10
+ #include <stdlib.h>
11
+ #include <string.h>
12
+
13
+ void **darray_new(int row, int col, int size)
14
+ {
15
+ void **arr;
16
+
17
+ arr = (void **) malloc(sizeof(void *) * row + size * row * col);
18
+ if (arr != NULL)
19
+ {
20
+ void *head;
21
+
22
+ head = (void *) ((char *)arr + sizeof(void *) * row);
23
+ memset(arr, 0, sizeof(void *) * row + size * row * col);
24
+ while (row--)
25
+ arr[row] = (void *)((char *)head + size * row * col);
26
+ }
27
+ return arr;
28
+ }
29
+
30
+ void darray_free(void **arr)
31
+ {
32
+ if (arr != NULL)
33
+ free(arr);
34
+ }
35
+
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @file darray.h (double array)
3
+ * @author Hightman Mar
4
+ * @editor set number ; syntax on ; set autoindent ; set tabstop=4 (vim)
5
+ * $Id$
6
+ */
7
+
8
+ #ifndef _SCWS_DARRAY_20070525_H_
9
+ #define _SCWS_DARRAY_20070525_H_
10
+
11
+ #ifdef __cplusplus
12
+ extern "C" {
13
+ #endif
14
+
15
+ void **darray_new(int row, int col, int size);
16
+ void darray_free(void **arr);
17
+
18
+ #ifdef __cplusplus
19
+ }
20
+ #endif
21
+
22
+ #endif
@@ -0,0 +1,3 @@
1
+ require "mkmf"
2
+
3
+ create_makefile "scws4r/scws4r"