barby-pdf417 0.1.0-java
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 +7 -0
- data/.gemtest +0 -0
- data/CHANGELOG.rdoc +3 -0
- data/Gemfile +19 -0
- data/Gemfile.lock +37 -0
- data/README.rdoc +8 -0
- data/Rakefile +91 -0
- data/ext/java/pdf417/Pdf417lib.java +1471 -0
- data/ext/pdf417/Makefile +220 -0
- data/ext/pdf417/extconf.rb +4 -0
- data/ext/pdf417/pdf417.c +281 -0
- data/ext/pdf417/pdf417.h +23 -0
- data/ext/pdf417/pdf417lib.c +829 -0
- data/ext/pdf417/pdf417lib.h +91 -0
- data/ext/pdf417/pdf417libimp.h +514 -0
- data/lib/barby/barby-pdf417.jar +0 -0
- data/lib/barby/barcode/pdf_417.rb +88 -0
- metadata +192 -0
data/ext/pdf417/Makefile
ADDED
@@ -0,0 +1,220 @@
|
|
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
|
+
n=$(NULLCMD)
|
9
|
+
ECHO1 = $(V:1=@$n)
|
10
|
+
ECHO = $(ECHO1:0=@echo)
|
11
|
+
|
12
|
+
#### Start of system configuration section. ####
|
13
|
+
|
14
|
+
srcdir = .
|
15
|
+
topdir = /Users/felixbellanger/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1
|
16
|
+
hdrdir = /Users/felixbellanger/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1
|
17
|
+
arch_hdrdir = /Users/felixbellanger/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/$(arch)
|
18
|
+
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
19
|
+
prefix = $(DESTDIR)/Users/felixbellanger/.rvm/rubies/ruby-1.9.3-p448
|
20
|
+
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
21
|
+
exec_prefix = $(prefix)
|
22
|
+
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
23
|
+
sitehdrdir = $(rubyhdrdir)/site_ruby
|
24
|
+
rubyhdrdir = $(includedir)/$(RUBY_BASE_NAME)-$(ruby_version)
|
25
|
+
vendordir = $(rubylibprefix)/vendor_ruby
|
26
|
+
sitedir = $(rubylibprefix)/site_ruby
|
27
|
+
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
28
|
+
mandir = $(datarootdir)/man
|
29
|
+
localedir = $(datarootdir)/locale
|
30
|
+
libdir = $(exec_prefix)/lib
|
31
|
+
psdir = $(docdir)
|
32
|
+
pdfdir = $(docdir)
|
33
|
+
dvidir = $(docdir)
|
34
|
+
htmldir = $(docdir)
|
35
|
+
infodir = $(datarootdir)/info
|
36
|
+
docdir = $(datarootdir)/doc/$(PACKAGE)
|
37
|
+
oldincludedir = $(DESTDIR)/usr/include
|
38
|
+
includedir = $(prefix)/include
|
39
|
+
localstatedir = $(prefix)/var
|
40
|
+
sharedstatedir = $(prefix)/com
|
41
|
+
sysconfdir = $(prefix)/etc
|
42
|
+
datadir = $(datarootdir)
|
43
|
+
datarootdir = $(prefix)/share
|
44
|
+
libexecdir = $(exec_prefix)/libexec
|
45
|
+
sbindir = $(exec_prefix)/sbin
|
46
|
+
bindir = $(exec_prefix)/bin
|
47
|
+
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
48
|
+
archdir = $(rubylibdir)/$(arch)
|
49
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
50
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
51
|
+
vendorlibdir = $(vendordir)/$(ruby_version)
|
52
|
+
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
53
|
+
|
54
|
+
NULLCMD = :
|
55
|
+
|
56
|
+
CC = /usr/local/bin/gcc-4.2
|
57
|
+
CXX = g++
|
58
|
+
LIBRUBY = $(LIBRUBY_SO)
|
59
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
60
|
+
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
61
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
62
|
+
empty =
|
63
|
+
OUTFLAG = -o $(empty)
|
64
|
+
COUTFLAG = -o $(empty)
|
65
|
+
|
66
|
+
RUBY_EXTCONF_H =
|
67
|
+
cflags = $(optflags) $(debugflags) $(warnflags)
|
68
|
+
optflags = -O3
|
69
|
+
debugflags = -ggdb
|
70
|
+
warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration
|
71
|
+
CFLAGS = -fno-common $(cflags) -fno-common -pipe $(ARCH_FLAG)
|
72
|
+
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
73
|
+
DEFS =
|
74
|
+
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags) -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libxml2/include -I/usr/local/opt/libxslt/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include
|
75
|
+
CXXFLAGS = $(CFLAGS) $(cxxflags)
|
76
|
+
ldflags = -L. -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libxml2/lib -L/usr/local/opt/libxslt/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib
|
77
|
+
dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libxml2/lib -L/usr/local/opt/libxslt/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib
|
78
|
+
ARCH_FLAG =
|
79
|
+
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
80
|
+
LDSHARED = $(CC) -dynamic -bundle
|
81
|
+
LDSHAREDXX = $(CXX) -dynamic -bundle
|
82
|
+
AR = ar
|
83
|
+
EXEEXT =
|
84
|
+
|
85
|
+
RUBY_BASE_NAME = ruby
|
86
|
+
RUBY_INSTALL_NAME = ruby
|
87
|
+
RUBY_SO_NAME = ruby.1.9.1
|
88
|
+
arch = x86_64-darwin12.4.0
|
89
|
+
sitearch = $(arch)
|
90
|
+
ruby_version = 1.9.1
|
91
|
+
ruby = /Users/felixbellanger/.rvm/rubies/ruby-1.9.3-p448/bin/ruby
|
92
|
+
RUBY = $(ruby)
|
93
|
+
RM = rm -f
|
94
|
+
RM_RF = $(RUBY) -run -e rm -- -rf
|
95
|
+
RMDIRS = rmdir -p
|
96
|
+
MAKEDIRS = mkdir -p
|
97
|
+
INSTALL = /usr/bin/install -c
|
98
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
99
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
100
|
+
COPY = cp
|
101
|
+
TOUCH = exit >
|
102
|
+
|
103
|
+
#### End of system configuration section. ####
|
104
|
+
|
105
|
+
preload =
|
106
|
+
|
107
|
+
libpath = . $(libdir) /usr/local/opt/libyaml/lib /usr/local/opt/readline/lib /usr/local/opt/libxml2/lib /usr/local/opt/libxslt/lib /usr/local/opt/libksba/lib /usr/local/opt/openssl/lib
|
108
|
+
LIBPATH = -L. -L$(libdir) -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libxml2/lib -L/usr/local/opt/libxslt/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib
|
109
|
+
DEFFILE =
|
110
|
+
|
111
|
+
CLEANFILES = mkmf.log
|
112
|
+
DISTCLEANFILES =
|
113
|
+
DISTCLEANDIRS =
|
114
|
+
|
115
|
+
extout =
|
116
|
+
extout_prefix =
|
117
|
+
target_prefix =
|
118
|
+
LOCAL_LIBS =
|
119
|
+
LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lobjc
|
120
|
+
SRCS = pdf417.c pdf417lib.c
|
121
|
+
OBJS = pdf417.o pdf417lib.o
|
122
|
+
TARGET = pdf417
|
123
|
+
TARGET_NAME = pdf417
|
124
|
+
TARGET_ENTRY = Init_$(TARGET_NAME)
|
125
|
+
DLLIB = $(TARGET).bundle
|
126
|
+
EXTSTATIC =
|
127
|
+
STATIC_LIB =
|
128
|
+
|
129
|
+
BINDIR = $(bindir)
|
130
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
131
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
132
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
133
|
+
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
|
134
|
+
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
|
135
|
+
|
136
|
+
TARGET_SO = $(DLLIB)
|
137
|
+
CLEANLIBS = $(TARGET).bundle
|
138
|
+
CLEANOBJS = *.o *.bak
|
139
|
+
|
140
|
+
all: $(DLLIB)
|
141
|
+
static: $(STATIC_LIB)
|
142
|
+
.PHONY: all install static install-so install-rb
|
143
|
+
.PHONY: clean clean-so clean-rb
|
144
|
+
|
145
|
+
clean-static::
|
146
|
+
clean-rb-default::
|
147
|
+
clean-rb::
|
148
|
+
clean-so::
|
149
|
+
clean: clean-so clean-static clean-rb-default clean-rb
|
150
|
+
-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
151
|
+
|
152
|
+
distclean-rb-default::
|
153
|
+
distclean-rb::
|
154
|
+
distclean-so::
|
155
|
+
distclean: clean distclean-so distclean-rb-default distclean-rb
|
156
|
+
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
157
|
+
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
158
|
+
@-$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
159
|
+
|
160
|
+
realclean: distclean
|
161
|
+
install: install-so install-rb
|
162
|
+
|
163
|
+
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
164
|
+
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
165
|
+
-$(Q)$(MAKEDIRS) $(@D)
|
166
|
+
$(INSTALL_PROG) $(DLLIB) $(@D)
|
167
|
+
clean-static::
|
168
|
+
-$(Q)$(RM) $(STATIC_LIB)
|
169
|
+
install-rb: pre-install-rb install-rb-default
|
170
|
+
install-rb-default: pre-install-rb-default
|
171
|
+
pre-install-rb: Makefile
|
172
|
+
pre-install-rb-default: Makefile
|
173
|
+
pre-install-rb-default:
|
174
|
+
$(ECHO) installing default pdf417 libraries
|
175
|
+
./.RUBYARCHDIR.time:
|
176
|
+
$(Q) $(MAKEDIRS) $(RUBYARCHDIR)
|
177
|
+
$(Q) $(TOUCH) $@
|
178
|
+
|
179
|
+
site-install: site-install-so site-install-rb
|
180
|
+
site-install-so: install-so
|
181
|
+
site-install-rb: install-rb
|
182
|
+
|
183
|
+
.SUFFIXES: .c .m .cc .mm .cxx .cpp .C .o
|
184
|
+
|
185
|
+
.cc.o:
|
186
|
+
$(ECHO) compiling $(<)
|
187
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
188
|
+
|
189
|
+
.mm.o:
|
190
|
+
$(ECHO) compiling $(<)
|
191
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
192
|
+
|
193
|
+
.cxx.o:
|
194
|
+
$(ECHO) compiling $(<)
|
195
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
196
|
+
|
197
|
+
.cpp.o:
|
198
|
+
$(ECHO) compiling $(<)
|
199
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
200
|
+
|
201
|
+
.C.o:
|
202
|
+
$(ECHO) compiling $(<)
|
203
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
204
|
+
|
205
|
+
.c.o:
|
206
|
+
$(ECHO) compiling $(<)
|
207
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
|
208
|
+
|
209
|
+
.m.o:
|
210
|
+
$(ECHO) compiling $(<)
|
211
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
|
212
|
+
|
213
|
+
$(DLLIB): $(OBJS) Makefile
|
214
|
+
$(ECHO) linking shared-object $(DLLIB)
|
215
|
+
-$(Q)$(RM) $(@)
|
216
|
+
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
$(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h
|
data/ext/pdf417/pdf417.c
ADDED
@@ -0,0 +1,281 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include "pdf417lib.h"
|
3
|
+
#include "pdf417.h"
|
4
|
+
|
5
|
+
|
6
|
+
VALUE rb_cPdf417;
|
7
|
+
VALUE rb_cPdf417_Lib;
|
8
|
+
|
9
|
+
|
10
|
+
/* :nodoc: */
|
11
|
+
static void rb_pdf417_lib_cleanup(void *p) {
|
12
|
+
pdf417free(p);
|
13
|
+
}
|
14
|
+
|
15
|
+
/*
|
16
|
+
* call-seq:
|
17
|
+
* new
|
18
|
+
*
|
19
|
+
* Makes a new PDF417 object for the given text string
|
20
|
+
*/
|
21
|
+
static VALUE rb_pdf417_lib_new(VALUE klass) {
|
22
|
+
pdf417param *ptr;
|
23
|
+
VALUE tdata = Data_Make_Struct(klass, pdf417param, 0, rb_pdf417_lib_cleanup, ptr);
|
24
|
+
pdf417init(ptr);
|
25
|
+
return tdata;
|
26
|
+
}
|
27
|
+
|
28
|
+
/*
|
29
|
+
* call-seq:
|
30
|
+
* paintCode
|
31
|
+
*
|
32
|
+
* Compute paintCode
|
33
|
+
*/
|
34
|
+
static VALUE rb_pdf417_lib_paintCode(VALUE self) {
|
35
|
+
pdf417param *ptr;
|
36
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
37
|
+
paintCode(ptr);
|
38
|
+
return Qnil;
|
39
|
+
}
|
40
|
+
|
41
|
+
/*
|
42
|
+
* call-seq:
|
43
|
+
* getAspectRatio
|
44
|
+
*
|
45
|
+
* The y/x aspect ratio
|
46
|
+
*/
|
47
|
+
static VALUE rb_pdf417_lib_getAspectRatio(VALUE self) {
|
48
|
+
pdf417param *ptr;
|
49
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
50
|
+
return rb_float_new(ptr->aspectRatio);
|
51
|
+
}
|
52
|
+
|
53
|
+
/*
|
54
|
+
* call-seq:
|
55
|
+
* setAspectRatio(aspectRatio)
|
56
|
+
*
|
57
|
+
* The y/x aspect ratio
|
58
|
+
*/
|
59
|
+
static VALUE rb_pdf417_lib_setAspectRatio(VALUE self, VALUE aspectRatio) {
|
60
|
+
pdf417param *ptr;
|
61
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
62
|
+
ptr->aspectRatio = NUM2DBL(aspectRatio);
|
63
|
+
return rb_float_new(ptr->aspectRatio);
|
64
|
+
}
|
65
|
+
|
66
|
+
/*
|
67
|
+
* call-seq:
|
68
|
+
* getBitColumns
|
69
|
+
*
|
70
|
+
* The number of code columns
|
71
|
+
*/
|
72
|
+
static VALUE rb_pdf417_lib_getBitColumns(VALUE self) {
|
73
|
+
pdf417param *ptr;
|
74
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
75
|
+
return INT2NUM(ptr->bitColumns);
|
76
|
+
}
|
77
|
+
|
78
|
+
/*
|
79
|
+
* call-seq:
|
80
|
+
* getCodeColumns
|
81
|
+
*
|
82
|
+
* The number of code columns
|
83
|
+
*/
|
84
|
+
static VALUE rb_pdf417_lib_getCodeColumns(VALUE self) {
|
85
|
+
pdf417param *ptr;
|
86
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
87
|
+
return INT2NUM(ptr->codeColumns);
|
88
|
+
}
|
89
|
+
|
90
|
+
/*
|
91
|
+
* call-seq:
|
92
|
+
* setCodeColumns(codeColumns)
|
93
|
+
*
|
94
|
+
* The number of code columns
|
95
|
+
*/
|
96
|
+
static VALUE rb_pdf417_lib_setCodeColumns(VALUE self, VALUE codeColumns) {
|
97
|
+
pdf417param *ptr;
|
98
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
99
|
+
ptr->codeColumns = NUM2INT(codeColumns);
|
100
|
+
return INT2NUM(ptr->codeColumns);
|
101
|
+
}
|
102
|
+
|
103
|
+
/*
|
104
|
+
* call-seq:
|
105
|
+
* getCodeRows
|
106
|
+
*
|
107
|
+
* The number of code rows and bitmap lines
|
108
|
+
*/
|
109
|
+
static VALUE rb_pdf417_lib_getCodeRows(VALUE self) {
|
110
|
+
pdf417param *ptr;
|
111
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
112
|
+
return INT2NUM(ptr->codeRows);
|
113
|
+
}
|
114
|
+
|
115
|
+
/*
|
116
|
+
* call-seq:
|
117
|
+
* setCodeRows(codeRows)
|
118
|
+
*
|
119
|
+
* The number of code rows and bitmap lines
|
120
|
+
*/
|
121
|
+
static VALUE rb_pdf417_lib_setCodeRows(VALUE self, VALUE codeRows) {
|
122
|
+
pdf417param *ptr;
|
123
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
124
|
+
ptr->codeRows = NUM2INT(codeRows);
|
125
|
+
return INT2NUM(ptr->codeRows);
|
126
|
+
}
|
127
|
+
|
128
|
+
/*
|
129
|
+
* call-seq:
|
130
|
+
* getErrorLevel
|
131
|
+
*
|
132
|
+
* The error level required 0-8
|
133
|
+
*/
|
134
|
+
static VALUE rb_pdf417_lib_getErrorLevel(VALUE self) {
|
135
|
+
pdf417param *ptr;
|
136
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
137
|
+
return INT2NUM(ptr->errorLevel);
|
138
|
+
}
|
139
|
+
|
140
|
+
/*
|
141
|
+
* call-seq:
|
142
|
+
* setErrorLevel(errorLevel)
|
143
|
+
*
|
144
|
+
* The error level required 0-8
|
145
|
+
*/
|
146
|
+
static VALUE rb_pdf417_lib_setErrorLevel(VALUE self, VALUE errorLevel) {
|
147
|
+
pdf417param *ptr;
|
148
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
149
|
+
ptr->errorLevel = NUM2INT(errorLevel);
|
150
|
+
return INT2NUM(ptr->errorLevel);
|
151
|
+
}
|
152
|
+
|
153
|
+
/*
|
154
|
+
* call-seq:
|
155
|
+
* getLenCodewords
|
156
|
+
*
|
157
|
+
* The size of the code words, including error correction codes
|
158
|
+
*/
|
159
|
+
static VALUE rb_pdf417_lib_getLenCodewords(VALUE self) {
|
160
|
+
pdf417param *ptr;
|
161
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
162
|
+
return INT2NUM(ptr->lenCodewords);
|
163
|
+
}
|
164
|
+
|
165
|
+
/*
|
166
|
+
* call-seq:
|
167
|
+
* setLenCodewords(lenCodewords)
|
168
|
+
*
|
169
|
+
* The size of the code words, including error correction codes
|
170
|
+
*/
|
171
|
+
static VALUE rb_pdf417_lib_setLenCodewords(VALUE self, VALUE lenCodewords) {
|
172
|
+
pdf417param *ptr;
|
173
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
174
|
+
ptr->lenCodewords = NUM2INT(lenCodewords);
|
175
|
+
return INT2NUM(ptr->lenCodewords);
|
176
|
+
}
|
177
|
+
|
178
|
+
/*
|
179
|
+
* call-seq:
|
180
|
+
* getOutBits
|
181
|
+
*
|
182
|
+
* Sets the text to convert into a barcode
|
183
|
+
*/
|
184
|
+
static VALUE rb_pdf417_lib_getOutBits(VALUE self) {
|
185
|
+
//VALUE list;
|
186
|
+
//int lenOutBits, k;
|
187
|
+
pdf417param *ptr;
|
188
|
+
|
189
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
190
|
+
//lenOutBits = strlen(ptr->outBits);
|
191
|
+
|
192
|
+
//list = rb_ary_new2(lenOutBits);
|
193
|
+
|
194
|
+
//for (k = 0; k < lenOutBits; k++) {
|
195
|
+
// rb_ary_push(list, INT2NUM(ptr->outBits[k]));
|
196
|
+
//}
|
197
|
+
|
198
|
+
//return list;
|
199
|
+
return rb_str_new2(ptr->outBits);
|
200
|
+
}
|
201
|
+
|
202
|
+
/*
|
203
|
+
* call-seq:
|
204
|
+
* getText
|
205
|
+
*
|
206
|
+
* Sets the text to convert into a barcode
|
207
|
+
*/
|
208
|
+
static VALUE rb_pdf417_lib_getText(VALUE self) {
|
209
|
+
pdf417param *ptr;
|
210
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
211
|
+
return rb_str_new2(ptr->text);
|
212
|
+
}
|
213
|
+
|
214
|
+
/*
|
215
|
+
* call-seq:
|
216
|
+
* setText(text)
|
217
|
+
*
|
218
|
+
* Sets the text to convert into a barcode
|
219
|
+
*/
|
220
|
+
static VALUE rb_pdf417_lib_setText(VALUE self, VALUE text) {
|
221
|
+
pdf417param *ptr;
|
222
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
223
|
+
ptr->text = StringValuePtr(text);
|
224
|
+
return rb_str_new2(ptr->text);
|
225
|
+
}
|
226
|
+
|
227
|
+
/*
|
228
|
+
* call-seq:
|
229
|
+
* getYHeight
|
230
|
+
*
|
231
|
+
* The y/x dot ratio
|
232
|
+
*/
|
233
|
+
static VALUE rb_pdf417_lib_getYHeight(VALUE self) {
|
234
|
+
pdf417param *ptr;
|
235
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
236
|
+
return rb_float_new(ptr->yHeight);
|
237
|
+
}
|
238
|
+
|
239
|
+
/*
|
240
|
+
* call-seq:
|
241
|
+
* setYHeight(yHeight)
|
242
|
+
*
|
243
|
+
* The y/x dot ratio
|
244
|
+
*/
|
245
|
+
static VALUE rb_pdf417_lib_setYHeight(VALUE self, VALUE yHeight) {
|
246
|
+
pdf417param *ptr;
|
247
|
+
Data_Get_Struct(self, pdf417param, ptr);
|
248
|
+
ptr->yHeight = NUM2DBL(yHeight);
|
249
|
+
return rb_float_new(ptr->yHeight);
|
250
|
+
}
|
251
|
+
|
252
|
+
|
253
|
+
// The initialization method for this module
|
254
|
+
void Init_pdf417() {
|
255
|
+
rb_cPdf417 = rb_define_class("Pdf417", rb_cObject); // Our Pdf417 object
|
256
|
+
rb_cPdf417_Lib = rb_define_class_under(rb_cPdf417, "Lib", rb_cObject); // Our Pdf417::Lib object, to represent the C file
|
257
|
+
rb_define_singleton_method(rb_cPdf417_Lib, "new", rb_pdf417_lib_new, 0);
|
258
|
+
|
259
|
+
// Instance methods
|
260
|
+
rb_define_method(rb_cPdf417_Lib, "paintCode", rb_pdf417_lib_paintCode, 0);
|
261
|
+
|
262
|
+
// Getters
|
263
|
+
rb_define_method(rb_cPdf417_Lib, "getAspectRatio", rb_pdf417_lib_getAspectRatio, 0);
|
264
|
+
rb_define_method(rb_cPdf417_Lib, "getBitColumns", rb_pdf417_lib_getBitColumns, 0);
|
265
|
+
rb_define_method(rb_cPdf417_Lib, "getCodeColumns", rb_pdf417_lib_getCodeColumns, 0);
|
266
|
+
rb_define_method(rb_cPdf417_Lib, "getCodeRows", rb_pdf417_lib_getCodeRows, 0);
|
267
|
+
rb_define_method(rb_cPdf417_Lib, "getErrorLevel", rb_pdf417_lib_getErrorLevel, 0);
|
268
|
+
rb_define_method(rb_cPdf417_Lib, "getLenCodewords", rb_pdf417_lib_getLenCodewords, 0);
|
269
|
+
rb_define_method(rb_cPdf417_Lib, "getOutBits", rb_pdf417_lib_getOutBits, 0);
|
270
|
+
rb_define_method(rb_cPdf417_Lib, "getText", rb_pdf417_lib_getText, 0);
|
271
|
+
rb_define_method(rb_cPdf417_Lib, "getYHeight", rb_pdf417_lib_getYHeight, 0);
|
272
|
+
|
273
|
+
// Setters
|
274
|
+
rb_define_method(rb_cPdf417_Lib, "setAspectRatio", rb_pdf417_lib_setAspectRatio, 1);
|
275
|
+
rb_define_method(rb_cPdf417_Lib, "setCodeColumns", rb_pdf417_lib_setCodeColumns, 1);
|
276
|
+
rb_define_method(rb_cPdf417_Lib, "setCodeRows", rb_pdf417_lib_setCodeRows, 1);
|
277
|
+
rb_define_method(rb_cPdf417_Lib, "setErrorLevel", rb_pdf417_lib_setErrorLevel, 1);
|
278
|
+
rb_define_method(rb_cPdf417_Lib, "setLenCodewords", rb_pdf417_lib_setLenCodewords, 1);
|
279
|
+
rb_define_method(rb_cPdf417_Lib, "setText", rb_pdf417_lib_setText, 1);
|
280
|
+
rb_define_method(rb_cPdf417_Lib, "setYHeight", rb_pdf417_lib_setYHeight, 1);
|
281
|
+
}
|
data/ext/pdf417/pdf417.h
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
VALUE rb_cPdf417;
|
2
|
+
VALUE rb_cPdf417_Lib;
|
3
|
+
|
4
|
+
static void rb_pdf417_lib_cleanup(void *p);
|
5
|
+
static VALUE rb_pdf417_lib_new(VALUE klass);
|
6
|
+
static VALUE rb_pdf417_lib_paintCode(VALUE self);
|
7
|
+
static VALUE rb_pdf417_lib_getAspectRatio(VALUE self);
|
8
|
+
static VALUE rb_pdf417_lib_setAspectRatio(VALUE self, VALUE aspectRatio);
|
9
|
+
static VALUE rb_pdf417_lib_getBitColumns(VALUE self);
|
10
|
+
static VALUE rb_pdf417_lib_getCodeColumns(VALUE self);
|
11
|
+
static VALUE rb_pdf417_lib_setCodeColumns(VALUE self, VALUE codeColumns);
|
12
|
+
static VALUE rb_pdf417_lib_getCodeRows(VALUE self);
|
13
|
+
static VALUE rb_pdf417_lib_setCodeRows(VALUE self, VALUE codeRows);
|
14
|
+
static VALUE rb_pdf417_lib_getErrorLevel(VALUE self);
|
15
|
+
static VALUE rb_pdf417_lib_setErrorLevel(VALUE self, VALUE errorLevel);
|
16
|
+
static VALUE rb_pdf417_lib_getLenCodewords(VALUE self);
|
17
|
+
static VALUE rb_pdf417_lib_setLenCodewords(VALUE self, VALUE lenCodewords);
|
18
|
+
static VALUE rb_pdf417_lib_getOutBits(VALUE self);
|
19
|
+
static VALUE rb_pdf417_lib_getText(VALUE self);
|
20
|
+
static VALUE rb_pdf417_lib_setText(VALUE self, VALUE text);
|
21
|
+
static VALUE rb_pdf417_lib_getYHeight(VALUE self);
|
22
|
+
static VALUE rb_pdf417_lib_setYHeight(VALUE self, VALUE yHeight);
|
23
|
+
void Init_pdf417();
|