rqrencoder 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/Gemfile +0 -1
- data/Rakefile +8 -0
- data/ext/rqrencoder/RQREncoder.i +20 -19
- data/ext/rqrencoder/{RQREncoder_wrap.cxx → RQREncoder_wrap.c} +700 -900
- data/ext/rqrencoder/extconf.rb +7 -1
- data/ext/rqrencoder/qrencode.h +426 -0
- data/lib/rqrencoder/qr_encoder.rb +11 -16
- data/lib/rqrencoder/qrcode.rb +6 -6
- data/lib/rqrencoder/version.rb +1 -1
- data/test/test_rqrencoder.rb +9 -1
- metadata +5 -7
- data/ext/rqrencoder/QR_Encode.cpp +0 -1949
- data/ext/rqrencoder/QR_Encode.h +0 -152
- data/ext/rqrencoder/win2ansi.h +0 -20
data/ext/rqrencoder/QR_Encode.h
DELETED
@@ -1,152 +0,0 @@
|
|
1
|
-
//---(1)��������-------------------------
|
2
|
-
//// QR_Encode.h : CQR_Encode �N���X�錾����уC���^�[�t�F�C�X��`
|
3
|
-
//// Date 2006/05/17 Ver. 1.12 [Class Ver.1.22] Psytec Inc.
|
4
|
-
//
|
5
|
-
//#if !defined(AFX_QR_ENCODE_H__AC886DF7_C0AE_4C9F_AC7A_FCDA8CB1DD37__INCLUDED_)
|
6
|
-
//#define AFX_QR_ENCODE_H__AC886DF7_C0AE_4C9F_AC7A_FCDA8CB1DD37__INCLUDED_
|
7
|
-
//
|
8
|
-
//#if _MSC_VER > 1000
|
9
|
-
//#pragma once
|
10
|
-
//#endif // _MSC_VER > 1000
|
11
|
-
//---(1)�����܂ł��R�����g�A�E�g-----------
|
12
|
-
|
13
|
-
//---(2)��������-----------
|
14
|
-
#ifndef __QR_ENCODER__
|
15
|
-
#define __QR_ENCODER__
|
16
|
-
#include "win2ansi.h"
|
17
|
-
//---(2)�����܂ł�lj�-----------
|
18
|
-
|
19
|
-
/////////////////////////////////////////////////////////////////////////////
|
20
|
-
// �萔
|
21
|
-
|
22
|
-
// ���������x��
|
23
|
-
#define QR_LEVEL_L 0
|
24
|
-
#define QR_LEVEL_M 1
|
25
|
-
#define QR_LEVEL_Q 2
|
26
|
-
#define QR_LEVEL_H 3
|
27
|
-
|
28
|
-
// �f�[�^���[�h
|
29
|
-
#define QR_MODE_NUMERAL 0
|
30
|
-
#define QR_MODE_ALPHABET 1
|
31
|
-
#define QR_MODE_8BIT 2
|
32
|
-
#define QR_MODE_KANJI 3
|
33
|
-
|
34
|
-
// �o�[�W����(�^��)�O���[�v
|
35
|
-
#define QR_VRESION_S 0 // 1 �` 9
|
36
|
-
#define QR_VRESION_M 1 // 10 �` 26
|
37
|
-
#define QR_VRESION_L 2 // 27 �` 40
|
38
|
-
|
39
|
-
#define MAX_ALLCODEWORD 3706 // ���R�[�h���[�h���ő�l
|
40
|
-
#define MAX_DATACODEWORD 2956 // �f�[�^�R�[�h���[�h�ő�l(�o�[�W����40-L)
|
41
|
-
#define MAX_CODEBLOCK 153 // �u���b�N�f�[�^�R�[�h���[�h���ő�l(�q�r�R�[�h���[�h���܂�)
|
42
|
-
#define MAX_MODULESIZE 177 // ��Ӄ��W���[�����ő�l
|
43
|
-
|
44
|
-
// �r�b�g�}�b�v�`�掞�}�[�W��
|
45
|
-
#define QR_MARGIN 4
|
46
|
-
|
47
|
-
|
48
|
-
/////////////////////////////////////////////////////////////////////////////
|
49
|
-
typedef struct tagRS_BLOCKINFO
|
50
|
-
{
|
51
|
-
int ncRSBlock; // �q�r�u���b�N��
|
52
|
-
int ncAllCodeWord; // �u���b�N���R�[�h���[�h��
|
53
|
-
int ncDataCodeWord; // �f�[�^�R�[�h���[�h��(�R�[�h���[�h�� - �q�r�R�[�h���[�h��)
|
54
|
-
|
55
|
-
} RS_BLOCKINFO, *LPRS_BLOCKINFO;
|
56
|
-
|
57
|
-
|
58
|
-
/////////////////////////////////////////////////////////////////////////////
|
59
|
-
// QR�R�[�h�o�[�W����(�^��)�֘A���
|
60
|
-
|
61
|
-
typedef struct tagQR_VERSIONINFO
|
62
|
-
{
|
63
|
-
int nVersionNo; // �o�[�W����(�^��)�ԍ�(1�`40)
|
64
|
-
int ncAllCodeWord; // ���R�[�h���[�h��
|
65
|
-
|
66
|
-
// �ȉ��z��Y���͌�������(0 = L, 1 = M, 2 = Q, 3 = H)
|
67
|
-
int ncDataCodeWord[4]; // �f�[�^�R�[�h���[�h��(���R�[�h���[�h�� - �q�r�R�[�h���[�h��)
|
68
|
-
|
69
|
-
int ncAlignPoint; // �A���C�����g�p�^�[�����W��
|
70
|
-
int nAlignPoint[6]; // �A���C�����g�p�^�[�����S���W
|
71
|
-
|
72
|
-
RS_BLOCKINFO RS_BlockInfo1[4]; // �q�r�u���b�N���(1)
|
73
|
-
RS_BLOCKINFO RS_BlockInfo2[4]; // �q�r�u���b�N���(2)
|
74
|
-
|
75
|
-
} QR_VERSIONINFO, *LPQR_VERSIONINFO;
|
76
|
-
|
77
|
-
|
78
|
-
/////////////////////////////////////////////////////////////////////////////
|
79
|
-
// CQR_Encode �N���X
|
80
|
-
|
81
|
-
class CQR_Encode
|
82
|
-
{
|
83
|
-
// �\�z/����
|
84
|
-
public:
|
85
|
-
CQR_Encode();
|
86
|
-
~CQR_Encode();
|
87
|
-
|
88
|
-
public:
|
89
|
-
int m_nLevel; // ���������x��
|
90
|
-
int m_nVersion; // �o�[�W����(�^��)
|
91
|
-
BOOL m_bAutoExtent; // �o�[�W����(�^��)�����g���w��t���O
|
92
|
-
int m_nMaskingNo; // �}�X�L���O�p�^�[���ԍ�
|
93
|
-
|
94
|
-
public:
|
95
|
-
int m_nSymbleSize;
|
96
|
-
BYTE m_byModuleData[MAX_MODULESIZE][MAX_MODULESIZE]; // [x][y]
|
97
|
-
// bit5:�@�\���W���[���i�}�X�L���O�ΏۊO�j�t���O
|
98
|
-
// bit4:�@�\���W���[���`��f�[�^
|
99
|
-
// bit1:�G���R�[�h�f�[�^
|
100
|
-
// bit0:�}�X�N��G���R�[�h�`��f�[�^
|
101
|
-
// 20h�Ƃ̘_���a�ɂ��@�\���W���[������A11h�Ƃ̘_���a�ɂ��`��i�ŏI�I�ɂ�BOOL�l���j
|
102
|
-
|
103
|
-
private:
|
104
|
-
int m_ncDataCodeWordBit; // �f�[�^�R�[�h���[�h�r�b�g��
|
105
|
-
BYTE m_byDataCodeWord[MAX_DATACODEWORD]; // ���̓f�[�^�G���R�[�h�G���A
|
106
|
-
|
107
|
-
int m_ncDataBlock;
|
108
|
-
BYTE m_byBlockMode[MAX_DATACODEWORD];
|
109
|
-
int m_nBlockLength[MAX_DATACODEWORD];
|
110
|
-
|
111
|
-
int m_ncAllCodeWord; // ���R�[�h���[�h��(�q�r�������f�[�^���܂�)
|
112
|
-
BYTE m_byAllCodeWord[MAX_ALLCODEWORD]; // ���R�[�h���[�h�Z�o�G���A
|
113
|
-
BYTE m_byRSWork[MAX_CODEBLOCK]; // �q�r�R�[�h���[�h�Z�o���[�N
|
114
|
-
|
115
|
-
// �f�[�^�G���R�[�h�֘A�t�@���N�V����
|
116
|
-
public:
|
117
|
-
BOOL EncodeData(int nLevel, int nVersion, BOOL bAutoExtent, int nMaskingNo, LPCSTR lpsSource, int ncSource = 0);
|
118
|
-
|
119
|
-
private:
|
120
|
-
int GetEncodeVersion(int nVersion, LPCSTR lpsSource, int ncLength);
|
121
|
-
BOOL EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup);
|
122
|
-
|
123
|
-
int GetBitLength(BYTE nMode, int ncData, int nVerGroup);
|
124
|
-
|
125
|
-
int SetBitStream(int nIndex, WORD wData, int ncData);
|
126
|
-
|
127
|
-
BOOL IsNumeralData(unsigned char c);
|
128
|
-
BOOL IsAlphabetData(unsigned char c);
|
129
|
-
BOOL IsKanjiData(unsigned char c1, unsigned char c2);
|
130
|
-
|
131
|
-
BYTE AlphabetToBinaly(unsigned char c);
|
132
|
-
WORD KanjiToBinaly(WORD wc);
|
133
|
-
|
134
|
-
void GetRSCodeWord(LPBYTE lpbyRSWork, int ncDataCodeWord, int ncRSCodeWord);
|
135
|
-
|
136
|
-
// ���W���[���z�u�֘A�t�@���N�V����
|
137
|
-
private:
|
138
|
-
void FormatModule();
|
139
|
-
|
140
|
-
void SetFunctionModule();
|
141
|
-
void SetFinderPattern(int x, int y);
|
142
|
-
void SetAlignmentPattern(int x, int y);
|
143
|
-
void SetVersionPattern();
|
144
|
-
void SetCodeWordPattern();
|
145
|
-
void SetMaskingPattern(int nPatternNo);
|
146
|
-
void SetFormatInfoPattern(int nPatternNo);
|
147
|
-
int CountPenalty();
|
148
|
-
};
|
149
|
-
|
150
|
-
/////////////////////////////////////////////////////////////////////////////
|
151
|
-
|
152
|
-
#endif // !defined(AFX_QR_ENCODE_H__AC886DF7_C0AE_4C9F_AC7A_FCDA8CB1DD37__INCLUDED_)
|
data/ext/rqrencoder/win2ansi.h
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
#ifndef __WIN32_TO_ANSI__
|
2
|
-
#define __WIN32_TO_ANSI__
|
3
|
-
|
4
|
-
#include <string.h>
|
5
|
-
#include <stdlib.h>
|
6
|
-
|
7
|
-
typedef bool BOOL;
|
8
|
-
typedef unsigned char BYTE;
|
9
|
-
typedef unsigned short WORD;
|
10
|
-
typedef char* LPCSTR;
|
11
|
-
typedef unsigned char * LPBYTE;
|
12
|
-
|
13
|
-
#define TRUE true
|
14
|
-
#define FALSE false
|
15
|
-
|
16
|
-
#define lstrlen strlen
|
17
|
-
#define ZeroMemory(x, y) memset(x, 0, y)
|
18
|
-
#define min(x, y) x < y ? x : y
|
19
|
-
|
20
|
-
#endif
|