diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a150552 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +*.log +*.swp +*.swo +*.o +*.gem +.config +pkg/ +InstalledFiles +ext/rqr/Makefile +ext/rqr/QR.bundle +ext/rqr/conftest.dSYM/ diff --git a/config/hoe.rb b/config/hoe.rb index 0e3e173..7b54377 100644 --- a/config/hoe.rb +++ b/config/hoe.rb @@ -31,7 +31,7 @@ def rubyforge_username REV = nil # UNCOMMENT IF REQUIRED: # REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil -VERS = Rqr::VERSION::STRING + (REV ? ".#{REV}" : "") +VERS = RQR::VERSION::STRING + (REV ? ".#{REV}" : "") RDOC_OPTS = ['--quiet', '--title', 'rqr documentation', "--opname", "index.html", "--line-numbers", @@ -68,4 +68,4 @@ def extra_deps CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n") PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}" $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc') -$hoe.rsync_args = '-av --delete --ignore-errors' \ No newline at end of file +$hoe.rsync_args = '-av --delete --ignore-errors' diff --git a/ext/rqr/QR_Encode.cpp b/ext/rqr/QR_Encode.cpp index 2e85637..870c527 100644 --- a/ext/rqr/QR_Encode.cpp +++ b/ext/rqr/QR_Encode.cpp @@ -1,4 +1,4 @@ -//// QR_Encode.cpp : CQR_Encode クラス インプリメンテーション ファイル +//// QR_Encode.cpp : CQR_Encode NX Cve[V t@C //// Date 2006/05/17 Ver. 1.12 [Class Ver.1.21] Psytec Inc. // //#include "stdafx.h" @@ -11,8 +11,8 @@ //#endif ///////////////////////////////////////////////////////////////////////////// -// QRコードバージョン(型番)情報 -static QR_VERSIONINFO QR_VersonInfo[] = {{0}, // (ダミー:Ver.0) +// QRR[ho[W(^) +static QR_VERSIONINFO QR_VersonInfo[] = {{0}, // (_~[:Ver.0) { 1, // Ver.1 26, 19, 16, 13, 9, 0, 0, 0, 0, 0, 0, 0, @@ -457,7 +457,7 @@ static QR_VERSIONINFO QR_VersonInfo[] = {{0}, // (ダミー:Ver.0) ///////////////////////////////////////////////////////////////////////////// -// GF(2^8)α指数→整数変換テーブル +// GF(2^8)wϊe[u static BYTE byExpToInt[] = { 1, 2, 4, 8, 16, 32, 64, 128, 29, 58, 116, 232, 205, 135, 19, 38, 76, 152, 45, 90, 180, 117, 234, 201, 143, 3, 6, 12, 24, 48, 96, 192, 157, 39, 78, 156, 37, 74, 148, 53, 106, 212, 181, 119, 238, 193, 159, 35, @@ -477,7 +477,7 @@ static BYTE byExpToInt[] = { 1, 2, 4, 8, 16, 32, 64, 128, 29, 58, 11 ///////////////////////////////////////////////////////////////////////////// -// GF(2^8)α整数→指数変換テーブル +// GF(2^8)wϊe[u static BYTE byIntToExp[] = { 0, 0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75, 4, 100, 224, 14, 52, 141, 239, 129, 28, 193, 105, 248, 200, 8, 76, 113, 5, 138, 101, 47, 225, 36, 15, 33, 53, 147, 142, 218, 240, 18, 130, 69, @@ -497,7 +497,7 @@ static BYTE byIntToExp[] = { 0, 0, 1, 25, 2, 50, 26, 198, 3, 223, 5 ///////////////////////////////////////////////////////////////////////////// -// 誤り訂正生成多項式α係数 +// W static BYTE byRSExp7[] = {87, 229, 146, 149, 238, 102, 21}; static BYTE byRSExp10[] = {251, 67, 46, 61, 118, 70, 64, 94, 32, 45}; static BYTE byRSExp13[] = { 74, 152, 176, 100, 86, 100, 106, 104, 130, 218, 206, 140, 78}; @@ -581,7 +581,7 @@ static LPBYTE byRSExp[] = {NULL, NULL, NULL, NULL, NULL, byRSExp50, NULL, byRSExp52, NULL, byRSExp54, NULL, byRSExp56, NULL, byRSExp58, NULL, byRSExp60, NULL, byRSExp62, NULL, byRSExp64, NULL, byRSExp66, NULL, byRSExp68}; -// 文字数インジケータビット長(バージョングループ別, {S, M, L}) +// CWP[^rbg(o[WO[v, {S, M, L}) static int nIndicatorLenNumeral[] = {10, 12, 14}; static int nIndicatorLenAlphabet[] = { 9, 11, 13}; static int nIndicatorLen8Bit[] = { 8, 16, 16}; @@ -589,7 +589,7 @@ static int nIndicatorLenKanji[] = { 8, 10, 12}; ///////////////////////////////////////////////////////////////////////////// -// QR_Encode クラスの構築/消滅 +// QR_Encode NX̍\z/ CQR_Encode::CQR_Encode() { @@ -602,9 +602,9 @@ CQR_Encode::~CQR_Encode() ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::EncodeData -// 用 途:データエンコード -// 引 数:誤り訂正レベル、型番(0=自動)、型番自動拡張フラグ、マスキング番号(-1=自動)、エンコードデータ、エンコードデータ長 -// 戻り値:エンコード成功時=TRUE、データなし、または容量オーバー時=FALSE +// p rFf[^GR[h +// FxA^(0=)A^ԎgtOA}XLOԍ(-1=)AGR[hf[^AGR[hf[^ +// ߂lFGR[h=TRUEAf[^ȂA܂͗eʃI[o[=FALSE BOOL CQR_Encode::EncodeData(int nLevel, int nVersion, BOOL bAutoExtent, int nMaskingNo, LPCSTR lpsSource, int ncSource) { @@ -613,21 +613,21 @@ BOOL CQR_Encode::EncodeData(int nLevel, int nVersion, BOOL bAutoExtent, int nMas m_nLevel = nLevel; m_nMaskingNo = nMaskingNo; - // データ長が指定されていない場合は lstrlen によって取得 + // f[^w肳ĂȂꍇ lstrlen ɂĎ擾 int ncLength = ncSource > 0 ? ncSource : lstrlen(lpsSource); if (ncLength == 0) - return FALSE; // データなし + return FALSE; // f[^Ȃ - // バージョン(型番)チェック + // o[W(^)`FbN int nEncodeVersion = GetEncodeVersion(nVersion, lpsSource, ncLength); if (nEncodeVersion == 0) - return FALSE; // 容量オーバー + return FALSE; // eʃI[o[ if (nVersion == 0) { - // 型番自動 + // ^Ԏ m_nVersion = nEncodeVersion; } else @@ -639,13 +639,13 @@ BOOL CQR_Encode::EncodeData(int nLevel, int nVersion, BOOL bAutoExtent, int nMas else { if (bAutoExtent) - m_nVersion = nEncodeVersion; // バージョン(型番)自動拡張 + m_nVersion = nEncodeVersion; // o[W(^)g else - return FALSE; // 容量オーバー + return FALSE; // eʃI[o[ } } - // ターミネータコード"0000"付加 + // ^[~l[^R[h"0000"t int ncDataCodeWord = QR_VersonInfo[m_nVersion].ncDataCodeWord[nLevel]; int ncTerminater = min(4, (ncDataCodeWord * 8) - m_ncDataCodeWordBit); @@ -653,7 +653,7 @@ BOOL CQR_Encode::EncodeData(int nLevel, int nVersion, BOOL bAutoExtent, int nMas if (ncTerminater > 0) m_ncDataCodeWordBit = SetBitStream(m_ncDataCodeWordBit, 0, ncTerminater); - // パディングコード"11101100, 00010001"付加 + // pfBOR[h"11101100, 00010001"t BYTE byPaddingCode = 0xec; for (i = (m_ncDataCodeWordBit + 7) / 8; i < ncDataCodeWord; ++i) @@ -663,24 +663,24 @@ BOOL CQR_Encode::EncodeData(int nLevel, int nVersion, BOOL bAutoExtent, int nMas byPaddingCode = (BYTE)(byPaddingCode == 0xec ? 0x11 : 0xec); } - // 総コードワード算出エリアクリア + // R[h[hZoGANA m_ncAllCodeWord = QR_VersonInfo[m_nVersion].ncAllCodeWord; ZeroMemory(m_byAllCodeWord, m_ncAllCodeWord); - int nDataCwIndex = 0; // データコードワード処理位置 + int nDataCwIndex = 0; // f[^R[h[hʒu - // データブロック分割数 + // f[^ubN int ncBlock1 = QR_VersonInfo[m_nVersion].RS_BlockInfo1[nLevel].ncRSBlock; int ncBlock2 = QR_VersonInfo[m_nVersion].RS_BlockInfo2[nLevel].ncRSBlock; int ncBlockSum = ncBlock1 + ncBlock2; - int nBlockNo = 0; // 処理中ブロック番号 + int nBlockNo = 0; // ubNԍ - // ブロック別データコードワード数 + // ubNʃf[^R[h[h int ncDataCw1 = QR_VersonInfo[m_nVersion].RS_BlockInfo1[nLevel].ncDataCodeWord; int ncDataCw2 = QR_VersonInfo[m_nVersion].RS_BlockInfo2[nLevel].ncDataCodeWord; - // データコードワードインターリーブ配置 + // f[^R[h[hC^[[uzu for (i = 0; i < ncBlock1; ++i) { for (j = 0; j < ncDataCw1; ++j) @@ -701,7 +701,7 @@ BOOL CQR_Encode::EncodeData(int nLevel, int nVersion, BOOL bAutoExtent, int nMas } else { - // 2種目ブロック端数分配置 + // QڃubN[zu m_byAllCodeWord[(ncBlockSum * ncDataCw1) + i] = m_byDataCodeWord[nDataCwIndex++]; } } @@ -709,12 +709,12 @@ BOOL CQR_Encode::EncodeData(int nLevel, int nVersion, BOOL bAutoExtent, int nMas ++nBlockNo; } - // ブロック別RSコードワード数(※現状では同数) + // ubNʂqrR[h[h(ł͓) int ncRSCw1 = QR_VersonInfo[m_nVersion].RS_BlockInfo1[nLevel].ncAllCodeWord - ncDataCw1; int ncRSCw2 = QR_VersonInfo[m_nVersion].RS_BlockInfo2[nLevel].ncAllCodeWord - ncDataCw2; ///////////////////////////////////////////////////////////////////////// - // RSコードワード算出 + // qrR[h[hZo nDataCwIndex = 0; nBlockNo = 0; @@ -727,7 +727,7 @@ BOOL CQR_Encode::EncodeData(int nLevel, int nVersion, BOOL bAutoExtent, int nMas GetRSCodeWord(m_byRSWork, ncDataCw1, ncRSCw1); - // RSコードワード配置 + // qrR[h[hzu for (j = 0; j < ncRSCw1; ++j) { m_byAllCodeWord[ncDataCodeWord + (ncBlockSum * j) + nBlockNo] = m_byRSWork[j]; @@ -745,7 +745,7 @@ BOOL CQR_Encode::EncodeData(int nLevel, int nVersion, BOOL bAutoExtent, int nMas GetRSCodeWord(m_byRSWork, ncDataCw2, ncRSCw2); - // RSコードワード配置 + // qrR[h[hzu for (j = 0; j < ncRSCw2; ++j) { m_byAllCodeWord[ncDataCodeWord + (ncBlockSum * j) + nBlockNo] = m_byRSWork[j]; @@ -757,7 +757,7 @@ BOOL CQR_Encode::EncodeData(int nLevel, int nVersion, BOOL bAutoExtent, int nMas m_nSymbleSize = m_nVersion * 4 + 17; - // モジュール配置 + // W[zu FormatModule(); return TRUE; @@ -766,9 +766,9 @@ BOOL CQR_Encode::EncodeData(int nLevel, int nVersion, BOOL bAutoExtent, int nMas ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::GetEncodeVersion -// 用 途:エンコード時バージョン(型番)取得 -// 引 数:調査開始バージョン、エンコードデータ、エンコードデータ長 -// 戻り値:バージョン番号(容量オーバー時=0) +// p rFGR[ho[W(^)擾 +// FJno[WAGR[hf[^AGR[hf[^ +// ߂lFo[WԍieʃI[o[=0j int CQR_Encode::GetEncodeVersion(int nVersion, LPCSTR lpsSource, int ncLength) { @@ -812,9 +812,9 @@ int CQR_Encode::GetEncodeVersion(int nVersion, LPCSTR lpsSource, int ncLength) ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::EncodeSourceData -// 用 途:入力データエンコード -// 引 数:入力データ、入力データ長、バージョン(型番)グループ -// 戻り値:エンコード成功時=TRUE +// p rF̓f[^GR[h +// F̓f[^A̓f[^Ao[W(^)O[v +// ߂lFGR[h=TRUE BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) { @@ -822,7 +822,7 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) int i, j; - // どのモードが何文字(バイト)継続しているかを調査 + // ǂ̃[h(oCg)pĂ邩𒲍 for (m_ncDataBlock = i = 0; i < ncLength; ++i) { BYTE byMode; @@ -846,7 +846,7 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) if (byMode == QR_MODE_KANJI) { - // 漢字は文字数ではなく 数で記録 + // ͕ł͂Ȃ ŋL^ ++m_nBlockLength[m_ncDataBlock]; ++i; } @@ -855,22 +855,22 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) ++m_ncDataBlock; ///////////////////////////////////////////////////////////////////////// - // 隣接する英数字モードブロックと数字モードブロックの並びをを条件により結合 + // אڂp[hubNƐ[hubN̕тɂ茋 - int ncSrcBits, ncDstBits; // 元のビット長と単一の英数字モードブロック化した場合のビット長 + int ncSrcBits, ncDstBits; // ̃rbgƒP̉p[hubNꍇ̃rbg int nBlock = 0; while (nBlock < m_ncDataBlock - 1) { - int ncJoinFront, ncJoinBehind; // 前後8ビットバイトモードブロックと結合した場合のビット長 - int nJoinPosition = 0; // 8ビットバイトモードブロックとの結合:-1=前と結合、0=結合しない、1=後ろと結合 + int ncJoinFront, ncJoinBehind; // OWrbgoCg[hubNƌꍇ̃rbg + int nJoinPosition = 0; // WrbgoCg[hubNƂ̌F-1=OƌA0=ȂA1=ƌ - // 「数字−英数字」または「英数字−数字」の並び + // u|pv܂́up|v̕ if ((m_byBlockMode[nBlock] == QR_MODE_NUMERAL && m_byBlockMode[nBlock + 1] == QR_MODE_ALPHABET) || (m_byBlockMode[nBlock] == QR_MODE_ALPHABET && m_byBlockMode[nBlock + 1] == QR_MODE_NUMERAL)) { - // 元のビット長と単一の英数字モードブロック化した場合のビット長を比較 + // ̃rbgƒP̉p[hubNꍇ̃rbgr ncSrcBits = GetBitLength(m_byBlockMode[nBlock], m_nBlockLength[nBlock], nVerGroup) + GetBitLength(m_byBlockMode[nBlock + 1], m_nBlockLength[nBlock + 1], nVerGroup); @@ -878,34 +878,34 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) if (ncSrcBits > ncDstBits) { - // 前後に8ビットバイトモードブロックがある場合、それらとの結合が有利かどうかをチェック + // OɂWrbgoCg[hubNꍇAƂ̌Lǂ`FbN if (nBlock >= 1 && m_byBlockMode[nBlock - 1] == QR_MODE_8BIT) { - // 前に8ビットバイトモードブロックあり + // OɂWrbgoCg[hubN ncJoinFront = GetBitLength(QR_MODE_8BIT, m_nBlockLength[nBlock - 1] + m_nBlockLength[nBlock], nVerGroup) + GetBitLength(m_byBlockMode[nBlock + 1], m_nBlockLength[nBlock + 1], nVerGroup); if (ncJoinFront > ncDstBits + GetBitLength(QR_MODE_8BIT, m_nBlockLength[nBlock - 1], nVerGroup)) - ncJoinFront = 0; // 8ビットバイトモードブロックとは結合しない + ncJoinFront = 0; // WrbgoCg[hubNƂ͌Ȃ } else ncJoinFront = 0; if (nBlock < m_ncDataBlock - 2 && m_byBlockMode[nBlock + 2] == QR_MODE_8BIT) { - // 後ろに8ビットバイトモードブロックあり + // ɂWrbgoCg[hubN ncJoinBehind = GetBitLength(m_byBlockMode[nBlock], m_nBlockLength[nBlock], nVerGroup) + GetBitLength(QR_MODE_8BIT, m_nBlockLength[nBlock + 1] + m_nBlockLength[nBlock + 2], nVerGroup); if (ncJoinBehind > ncDstBits + GetBitLength(QR_MODE_8BIT, m_nBlockLength[nBlock + 2], nVerGroup)) - ncJoinBehind = 0; // 8ビットバイトモードブロックとは結合しない + ncJoinBehind = 0; // WrbgoCg[hubNƂ͌Ȃ } else ncJoinBehind = 0; if (ncJoinFront != 0 && ncJoinBehind != 0) { - // 前後両方に8ビットバイトモードブロックがある場合はデータ長が短くなる方を優先 + // O㗼ɂWrbgoCg[hubNꍇ̓f[^ZȂD nJoinPosition = (ncJoinFront < ncJoinBehind) ? -1 : 1; } else @@ -915,12 +915,12 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) if (nJoinPosition != 0) { - // 8ビットバイトモードブロックとの結合 + // WrbgoCg[hubNƂ̌ if (nJoinPosition == -1) { m_nBlockLength[nBlock - 1] += m_nBlockLength[nBlock]; - // 後続をシフト + // 㑱Vtg for (i = nBlock; i < m_ncDataBlock - 1; ++i) { m_byBlockMode[i] = m_byBlockMode[i + 1]; @@ -932,7 +932,7 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) m_byBlockMode[nBlock + 1] = QR_MODE_8BIT; m_nBlockLength[nBlock + 1] += m_nBlockLength[nBlock + 2]; - // 後続をシフト + // 㑱Vtg for (i = nBlock + 2; i < m_ncDataBlock - 1; ++i) { m_byBlockMode[i] = m_byBlockMode[i + 1]; @@ -944,14 +944,14 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) } else { - // 英数字と数字の並びを単一の英数字モードブロックに統合 + // pƐ̕тP̉p[hubNɓ if (nBlock < m_ncDataBlock - 2 && m_byBlockMode[nBlock + 2] == QR_MODE_ALPHABET) { - // 結合しようとするブロックの後ろに続く英数字モードブロックを結合 + // 悤ƂubŇɑp[hubN m_nBlockLength[nBlock + 1] += m_nBlockLength[nBlock + 2]; - // 後続をシフト + // 㑱Vtg for (i = nBlock + 2; i < m_ncDataBlock - 1; ++i) { m_byBlockMode[i] = m_byBlockMode[i + 1]; @@ -964,7 +964,7 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) m_byBlockMode[nBlock] = QR_MODE_ALPHABET; m_nBlockLength[nBlock] += m_nBlockLength[nBlock + 1]; - // 後続をシフト + // 㑱Vtg for (i = nBlock + 1; i < m_ncDataBlock - 1; ++i) { m_byBlockMode[i] = m_byBlockMode[i + 1]; @@ -975,10 +975,10 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) if (nBlock >= 1 && m_byBlockMode[nBlock - 1] == QR_MODE_ALPHABET) { - // 結合したブロックの前の英数字モードブロックを結合 + // ubN̑Ỏp[hubN m_nBlockLength[nBlock - 1] += m_nBlockLength[nBlock]; - // 後続をシフト + // 㑱Vtg for (i = nBlock; i < m_ncDataBlock - 1; ++i) { m_byBlockMode[i] = m_byBlockMode[i + 1]; @@ -989,15 +989,15 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) } } - continue; // 現在位置のブロックを再調査 + continue; // ݈ʒũubNĒ } } - ++nBlock; // 次ブロックを調査 + ++nBlock; // ubN𒲍 } ///////////////////////////////////////////////////////////////////////// - // 連続する短いモードブロックを8ビットバイトモードブロック化 + // AZ[hubNWrbgoCg[hubN nBlock = 0; @@ -1008,11 +1008,11 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) ncDstBits = GetBitLength(QR_MODE_8BIT, m_nBlockLength[nBlock] + m_nBlockLength[nBlock + 1], nVerGroup); - // 前に8ビットバイトモードブロックがある場合、重複するインジケータ分を減算 + // OɂWrbgoCg[hubNꍇAdCWP[^Z if (nBlock >= 1 && m_byBlockMode[nBlock - 1] == QR_MODE_8BIT) ncDstBits -= (4 + nIndicatorLen8Bit[nVerGroup]); - // 後ろに8ビットバイトモードブロックがある場合、重複するインジケータ分を減算 + // ɂWrbgoCg[hubNꍇAdCWP[^Z if (nBlock < m_ncDataBlock - 2 && m_byBlockMode[nBlock + 2] == QR_MODE_8BIT) ncDstBits -= (4 + nIndicatorLen8Bit[nVerGroup]); @@ -1020,10 +1020,10 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) { if (nBlock >= 1 && m_byBlockMode[nBlock - 1] == QR_MODE_8BIT) { - // 結合するブロックの前にある8ビットバイトモードブロックを結合 + // ubN̑OɂWrbgoCg[hubN m_nBlockLength[nBlock - 1] += m_nBlockLength[nBlock]; - // 後続をシフト + // 㑱Vtg for (i = nBlock; i < m_ncDataBlock - 1; ++i) { m_byBlockMode[i] = m_byBlockMode[i + 1]; @@ -1036,10 +1036,10 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) if (nBlock < m_ncDataBlock - 2 && m_byBlockMode[nBlock + 2] == QR_MODE_8BIT) { - // 結合するブロックの後ろにある8ビットバイトモードブロックを結合 + // ubŇɂWrbgoCg[hubN m_nBlockLength[nBlock + 1] += m_nBlockLength[nBlock + 2]; - // 後続をシフト + // 㑱Vtg for (i = nBlock + 2; i < m_ncDataBlock - 1; ++i) { m_byBlockMode[i] = m_byBlockMode[i + 1]; @@ -1052,7 +1052,7 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) m_byBlockMode[nBlock] = QR_MODE_8BIT; m_nBlockLength[nBlock] += m_nBlockLength[nBlock + 1]; - // 後続をシフト + // 㑱Vtg for (i = nBlock + 1; i < m_ncDataBlock - 1; ++i) { m_byBlockMode[i] = m_byBlockMode[i + 1]; @@ -1061,22 +1061,22 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) --m_ncDataBlock; - // 結合したブロックの前から再調査 + // ubN̑OĒ if (nBlock >= 1) --nBlock; continue; } - ++nBlock; // 次ブロックを調査 + ++nBlock; // ubN𒲍 } ///////////////////////////////////////////////////////////////////////// - // ビット配列化 - int ncComplete = 0; // 処理済データカウンタ + // rbgz + int ncComplete = 0; // σf[^JE^ WORD wBinCode; - m_ncDataCodeWordBit = 0; // ビット単位処理カウンタ + m_ncDataCodeWordBit = 0; // rbgPʏJE^ ZeroMemory(m_byDataCodeWord, MAX_DATACODEWORD); @@ -1085,15 +1085,15 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) if (m_byBlockMode[i] == QR_MODE_NUMERAL) { ///////////////////////////////////////////////////////////////// - // 数字モード + // [h - // インジケータ(0001b) + // CWP[^(0001b) m_ncDataCodeWordBit = SetBitStream(m_ncDataCodeWordBit, 1, 4); - // 文字数セット + // Zbg m_ncDataCodeWordBit = SetBitStream(m_ncDataCodeWordBit, (WORD)m_nBlockLength[i], nIndicatorLenNumeral[nVerGroup]); - // ビット列保存 + // rbgۑ for (j = 0; j < m_nBlockLength[i]; j += 3) { if (j < m_nBlockLength[i] - 2) @@ -1106,7 +1106,7 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) } else if (j == m_nBlockLength[i] - 2) { - // 端数2バイト + // [QoCg wBinCode = (WORD)(((lpsSource[ncComplete + j] - '0') * 10) + (lpsSource[ncComplete + j + 1] - '0')); @@ -1114,7 +1114,7 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) } else if (j == m_nBlockLength[i] - 1) { - // 端数1バイト + // [PoCg wBinCode = (WORD)(lpsSource[ncComplete + j] - '0'); m_ncDataCodeWordBit = SetBitStream(m_ncDataCodeWordBit, wBinCode, 4); @@ -1127,15 +1127,15 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) else if (m_byBlockMode[i] == QR_MODE_ALPHABET) { ///////////////////////////////////////////////////////////////// - // 英数字モード + // p[h - // モードインジケータ(0010b) + // [hCWP[^(0010b) m_ncDataCodeWordBit = SetBitStream(m_ncDataCodeWordBit, 2, 4); - // 文字数セット + // Zbg m_ncDataCodeWordBit = SetBitStream(m_ncDataCodeWordBit, (WORD)m_nBlockLength[i], nIndicatorLenAlphabet[nVerGroup]); - // ビット列保存 + // rbgۑ for (j = 0; j < m_nBlockLength[i]; j += 2) { if (j < m_nBlockLength[i] - 1) @@ -1147,7 +1147,7 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) } else { - // 端数1バイト + // [PoCg wBinCode = (WORD)AlphabetToBinaly(lpsSource[ncComplete + j]); m_ncDataCodeWordBit = SetBitStream(m_ncDataCodeWordBit, wBinCode, 6); @@ -1160,15 +1160,15 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) else if (m_byBlockMode[i] == QR_MODE_8BIT) { ///////////////////////////////////////////////////////////////// - // 8ビットバイトモード + // WrbgoCg[h - // モードインジケータ(0100b) + // [hCWP[^(0100b) m_ncDataCodeWordBit = SetBitStream(m_ncDataCodeWordBit, 4, 4); - // 文字数セット + // Zbg m_ncDataCodeWordBit = SetBitStream(m_ncDataCodeWordBit, (WORD)m_nBlockLength[i], nIndicatorLen8Bit[nVerGroup]); - // ビット列保存 + // rbgۑ for (j = 0; j < m_nBlockLength[i]; ++j) { m_ncDataCodeWordBit = SetBitStream(m_ncDataCodeWordBit, (WORD)lpsSource[ncComplete + j], 8); @@ -1179,15 +1179,15 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) else // m_byBlockMode[i] == QR_MODE_KANJI { ///////////////////////////////////////////////////////////////// - // 漢字モード + // [h - // モードインジケータ(1000b) + // [hCWP[^(1000b) m_ncDataCodeWordBit = SetBitStream(m_ncDataCodeWordBit, 8, 4); - // 文字数セット + // Zbg m_ncDataCodeWordBit = SetBitStream(m_ncDataCodeWordBit, (WORD)(m_nBlockLength[i] / 2), nIndicatorLenKanji[nVerGroup]); - // 漢字モードでビット列保存 + // [hŃrbgۑ for (j = 0; j < m_nBlockLength[i] / 2; ++j) { WORD wBinCode = KanjiToBinaly((WORD)(((BYTE)lpsSource[ncComplete + (j * 2)] << 8) + (BYTE)lpsSource[ncComplete + (j * 2) + 1])); @@ -1205,10 +1205,10 @@ BOOL CQR_Encode::EncodeSourceData(LPCSTR lpsSource, int ncLength, int nVerGroup) ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::GetBitLength -// 用 途:ビット長取得 -// 引 数:データモード種別、データ長、バージョン(型番)グループ -// 戻り値:データビット長 -// 備 考:漢字モードでのデータ長引数は文字数ではなくバイト数 +// p rFrbg擾 +// Ff[^[hʁAf[^Ao[W(^)O[v +// ߂lFf[^rbg +// lF[hł̃f[^͕ł͂ȂoCg int CQR_Encode::GetBitLength(BYTE nMode, int ncData, int nVerGroup) { @@ -1251,10 +1251,10 @@ int CQR_Encode::GetBitLength(BYTE nMode, int ncData, int nVerGroup) ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::SetBitStream -// 用 途:ビットセット -// 引 数:挿入位置、ビット配列データ、データビット長(最大16) -// 戻り値:次回挿入位置(バッファオーバー時=-1) -// 備 考:m_byDataCodeWord に結果をセット(要ゼロ初期化) +// p rFrbgZbg +// F}ʒuArbgzf[^Af[^rbg(ő16) +// ߂lF}ʒu(obt@I[o[=-1) +// lFm_byDataCodeWord ɌʂZbg(v[) int CQR_Encode::SetBitStream(int nIndex, WORD wData, int ncData) { @@ -1277,9 +1277,9 @@ int CQR_Encode::SetBitStream(int nIndex, WORD wData, int ncData) ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::IsNumeralData -// 用 途:数字モード該当チェック -// 引 数:調査文字 -// 戻り値:該当時=TRUE +// p rF[hY`FbN +// F +// ߂lFY=TRUE BOOL CQR_Encode::IsNumeralData(unsigned char c) { @@ -1292,9 +1292,9 @@ BOOL CQR_Encode::IsNumeralData(unsigned char c) ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::IsAlphabetData -// 用 途:英数字モード該当チェック -// 引 数:調査文字 -// 戻り値:該当時=TRUE +// p rFp[hY`FbN +// F +// ߂lFY=TRUE BOOL CQR_Encode::IsAlphabetData(unsigned char c) { @@ -1313,10 +1313,10 @@ BOOL CQR_Encode::IsAlphabetData(unsigned char c) ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::IsKanjiData -// 用 途:漢字モード該当チェック -// 引 数:調査文字(16ビット文字) -// 戻り値:該当時=TRUE -// 備 考:EBBFh 以降の S-JIS は対象外 +// p rF[hY`FbN +// Fi16rbgj +// ߂lFY=TRUE +// lFEBBFh ȍ~ S-JIS ͑ΏۊO BOOL CQR_Encode::IsKanjiData(unsigned char c1, unsigned char c2) { @@ -1334,9 +1334,9 @@ BOOL CQR_Encode::IsKanjiData(unsigned char c1, unsigned char c2) ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::AlphabetToBinaly -// 用 途:英数字モード文字のバイナリ化 -// 引 数:対象文字 -// 戻り値:バイナリ値 +// p rFp[h̃oCi +// FΏە +// ߂lFoCil BYTE CQR_Encode::AlphabetToBinaly(unsigned char c) { @@ -1366,9 +1366,9 @@ BYTE CQR_Encode::AlphabetToBinaly(unsigned char c) ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::KanjiToBinaly -// 用 途:漢字モード文字のバイナリ化 -// 引 数:対象文字 -// 戻り値:バイナリ値 +// p rF[h̃oCi +// FΏە +// ߂lFoCil WORD CQR_Encode::KanjiToBinaly(WORD wc) { @@ -1383,9 +1383,9 @@ WORD CQR_Encode::KanjiToBinaly(WORD wc) ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::GetRSCodeWord -// 用 途:RS誤り訂正コードワード取得 -// 引 数:データコードワードアドレス、データコードワード長、RSコードワード長 -// 備 考:総コードワード分のエリアを確保してから呼び出し +// p rFqrR[h[h擾 +// Ff[^R[h[hAhXAf[^R[h[hAqrR[h[h +// lFR[h[h̃GAmۂĂĂяo void CQR_Encode::GetRSCodeWord(LPBYTE lpbyRSWork, int ncDataCodeWord, int ncRSCodeWord) { @@ -1395,24 +1395,24 @@ void CQR_Encode::GetRSCodeWord(LPBYTE lpbyRSWork, int ncDataCodeWord, int ncRSCo { if (lpbyRSWork[0] != 0) { - BYTE nExpFirst = byIntToExp[lpbyRSWork[0]]; // 初項係数より乗数算出 + BYTE nExpFirst = byIntToExp[lpbyRSWork[0]]; // W搔Zo for (j = 0; j < ncRSCodeWord; ++j) { - // 各項乗数に初項乗数を加算(% 255 → α^255 = 1) + // e搔ɏ搔Zi% 255 ^255 = 1j BYTE nExpElement = (BYTE)(((int)(byRSExp[ncRSCodeWord][j] + nExpFirst)) % 255); - // 排他論理和による剰余算出 + // r_aɂ]Zo lpbyRSWork[j] = (BYTE)(lpbyRSWork[j + 1] ^ byExpToInt[nExpElement]); } - // 残り桁をシフト + // c茅Vtg for (j = ncRSCodeWord; j < ncDataCodeWord + ncRSCodeWord - 1; ++j) lpbyRSWork[j] = lpbyRSWork[j + 1]; } else { - // 残り桁をシフト + // c茅Vtg for (j = 0; j < ncDataCodeWord + ncRSCodeWord - 1; ++j) lpbyRSWork[j] = lpbyRSWork[j + 1]; } @@ -1422,8 +1422,8 @@ void CQR_Encode::GetRSCodeWord(LPBYTE lpbyRSWork, int ncDataCodeWord, int ncRSCo ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::FormatModule -// 用 途:モジュールへのデータ配置 -// 戻り値:一辺のモジュール数 +// p rFW[ւ̃f[^zu +// ߂lFӂ̃W[ void CQR_Encode::FormatModule() { @@ -1431,26 +1431,26 @@ void CQR_Encode::FormatModule() ZeroMemory(m_byModuleData, sizeof(m_byModuleData)); - // 機能モジュール配置 + // @\W[zu SetFunctionModule(); - // データパターン配置 + // f[^p^[zu SetCodeWordPattern(); if (m_nMaskingNo == -1) { - // 最適マスキングパターン選択 + // œK}XLOp^[I m_nMaskingNo = 0; - SetMaskingPattern(m_nMaskingNo); // マスキング - SetFormatInfoPattern(m_nMaskingNo); // フォーマット情報パターン配置 + SetMaskingPattern(m_nMaskingNo); // }XLO + SetFormatInfoPattern(m_nMaskingNo); // tH[}bgp^[zu int nMinPenalty = CountPenalty(); for (i = 1; i <= 7; ++i) { - SetMaskingPattern(i); // マスキング - SetFormatInfoPattern(i); // フォーマット情報パターン配置 + SetMaskingPattern(i); // }XLO + SetFormatInfoPattern(i); // tH[}bgp^[zu int nPenalty = CountPenalty(); @@ -1462,10 +1462,10 @@ void CQR_Encode::FormatModule() } } - SetMaskingPattern(m_nMaskingNo); // マスキング - SetFormatInfoPattern(m_nMaskingNo); // フォーマット情報パターン配置 + SetMaskingPattern(m_nMaskingNo); // }XLO + SetFormatInfoPattern(m_nMaskingNo); // tH[}bgp^[zu - // モジュールパターンをブール値に変換 + // W[p^[u[lɕϊ for (i = 0; i < m_nSymbleSize; ++i) { for (j = 0; j < m_nSymbleSize; ++j) @@ -1478,19 +1478,19 @@ void CQR_Encode::FormatModule() ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::SetFunctionModule -// 用 途:機能モジュール配置 -// 備 考:フォーマット情報は機能モジュール登録のみ(実データは空白) +// p rF@\W[zu +// lFtH[}bg͋@\W[o^̂(f[^͋) void CQR_Encode::SetFunctionModule() { int i, j; - // 位置検出パターン + // ʒuop^[ SetFinderPattern(0, 0); SetFinderPattern(m_nSymbleSize - 7, 0); SetFinderPattern(0, m_nSymbleSize - 7); - // 位置検出パターンセパレータ + // ʒuop^[Zp[^ for (i = 0; i < 8; ++i) { m_byModuleData[i][7] = m_byModuleData[7][i] = '\x20'; @@ -1498,7 +1498,7 @@ void CQR_Encode::SetFunctionModule() m_byModuleData[i][m_nSymbleSize - 8] = m_byModuleData[7][m_nSymbleSize - 8 + i] = '\x20'; } - // フォーマット情報記述位置を機能モジュール部として登録 + // tH[}bgLqʒu@\W[Ƃēo^ for (i = 0; i < 9; ++i) { m_byModuleData[i][8] = m_byModuleData[8][i] = '\x20'; @@ -1509,10 +1509,10 @@ void CQR_Encode::SetFunctionModule() m_byModuleData[m_nSymbleSize - 8 + i][8] = m_byModuleData[8][m_nSymbleSize - 8 + i] = '\x20'; } - // バージョン情報パターン + // o[Wp^[ SetVersionPattern(); - // 位置合わせパターン + // ʒu킹p^[ for (i = 0; i < QR_VersonInfo[m_nVersion].ncAlignPoint; ++i) { SetAlignmentPattern(QR_VersonInfo[m_nVersion].nAlignPoint[i], 6); @@ -1524,7 +1524,7 @@ void CQR_Encode::SetFunctionModule() } } - // タイミングパターン + // ^C~Op^[ for (i = 8; i <= m_nSymbleSize - 9; ++i) { m_byModuleData[i][6] = (i % 2) == 0 ? '\x30' : '\x20'; @@ -1535,8 +1535,8 @@ void CQR_Encode::SetFunctionModule() ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::SetFinderPattern -// 用 途:位置検出パターン配置 -// 引 数:配置左上座標 +// p rFʒuop^[zu +// FzuW void CQR_Encode::SetFinderPattern(int x, int y) { @@ -1561,8 +1561,8 @@ void CQR_Encode::SetFinderPattern(int x, int y) ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::SetAlignmentPattern -// 用 途:位置合わせパターン配置 -// 引 数:配置中央座標 +// p rFʒu킹p^[zu +// FzuW void CQR_Encode::SetAlignmentPattern(int x, int y) { @@ -1574,9 +1574,9 @@ void CQR_Encode::SetAlignmentPattern(int x, int y) int i, j; if (m_byModuleData[x][y] & 0x20) - return; // 機能モジュールと重複するため除外 + return; // @\W[Əd邽ߏO - x -= 2; y -= 2; // 左上隅座標に変換 + x -= 2; y -= 2; // Wɕϊ for (i = 0; i < 5; ++i) { @@ -1590,8 +1590,8 @@ void CQR_Encode::SetAlignmentPattern(int x, int y) ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::SetVersionPattern -// 用 途:バージョン(型番)情報パターン配置 -// 備 考:拡張BCH(18,6)符号を誤り訂正として使用 +// p rFo[W(^)p^[zu +// lFgabg(18,6)ƂĎgp void CQR_Encode::SetVersionPattern() { @@ -1602,7 +1602,7 @@ void CQR_Encode::SetVersionPattern() int nVerData = m_nVersion << 12; - // 剰余ビット算出 + // ]rbgZo for (i = 0; i < 6; ++i) { if (nVerData & (1 << (17 - i))) @@ -1626,15 +1626,15 @@ void CQR_Encode::SetVersionPattern() ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::SetCodeWordPattern -// 用 途:データパターン配置 +// p rFf[^p^[zu void CQR_Encode::SetCodeWordPattern() { int x = m_nSymbleSize; int y = m_nSymbleSize - 1; - int nCoef_x = 1; // x軸配置向き - int nCoef_y = 1; // y軸配置向き + int nCoef_x = 1; // zu + int nCoef_y = 1; // zu int i, j; @@ -1658,12 +1658,12 @@ void CQR_Encode::SetCodeWordPattern() x -= 2; - if (x == 6) // タイミングパターン + if (x == 6) // ^C~Op^[ --x; } } } - while (m_byModuleData[x][y] & 0x20); // 機能モジュールを除外 + while (m_byModuleData[x][y] & 0x20); // @\W[O m_byModuleData[x][y] = (m_byAllCodeWord[i] & (1 << (7 - j))) ? '\x02' : '\x00'; } @@ -1673,8 +1673,8 @@ void CQR_Encode::SetCodeWordPattern() ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::SetMaskingPattern -// 用 途:マスキングパターン配置 -// 引 数:マスキングパターン番号 +// p rF}XLOp^[zu +// F}XLOp^[ԍ void CQR_Encode::SetMaskingPattern(int nPatternNo) { @@ -1684,7 +1684,7 @@ void CQR_Encode::SetMaskingPattern(int nPatternNo) { for (j = 0; j < m_nSymbleSize; ++j) { - if (! (m_byModuleData[j][i] & 0x20)) // 機能モジュールを除外 + if (! (m_byModuleData[j][i] & 0x20)) // @\W[O { BOOL bMask; @@ -1732,8 +1732,8 @@ void CQR_Encode::SetMaskingPattern(int nPatternNo) ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::SetFormatInfoPattern -// 用 途:フォーマット情報配置 -// 引 数:マスキングパターン番号 +// p rFtH[}bgzu +// F}XLOp^[ԍ void CQR_Encode::SetFormatInfoPattern(int nPatternNo) { @@ -1763,7 +1763,7 @@ void CQR_Encode::SetFormatInfoPattern(int nPatternNo) int nFormatData = nFormatInfo << 10; - // 剰余ビット算出 + // ]rbgZo for (i = 0; i < 5; ++i) { if (nFormatData & (1 << (14 - i))) @@ -1774,10 +1774,10 @@ void CQR_Encode::SetFormatInfoPattern(int nPatternNo) nFormatData += nFormatInfo << 10; - // マスキング + // }XLO nFormatData ^= 0x5412; // 101010000010010b - // 左上位置検出パターン周り配置 + // ʒuop^[zu for (i = 0; i <= 5; ++i) m_byModuleData[8][i] = (nFormatData & (1 << i)) ? '\x30' : '\x20'; @@ -1788,12 +1788,12 @@ void CQR_Encode::SetFormatInfoPattern(int nPatternNo) for (i = 9; i <= 14; ++i) m_byModuleData[14 - i][8] = (nFormatData & (1 << i)) ? '\x30' : '\x20'; - // 右上位置検出パターン下配置 + // Eʒuop^[zu for (i = 0; i <= 7; ++i) m_byModuleData[m_nSymbleSize - 1 - i][8] = (nFormatData & (1 << i)) ? '\x30' : '\x20'; - // 左下位置検出パターン右配置 - m_byModuleData[8][m_nSymbleSize - 8] = '\x30'; // 固定暗モジュール + // ʒuop^[Ezu + m_byModuleData[8][m_nSymbleSize - 8] = '\x30'; // ŒÃW[ for (i = 8; i <= 14; ++i) m_byModuleData[8][m_nSymbleSize - 15 + i] = (nFormatData & (1 << i)) ? '\x30' : '\x20'; @@ -1802,14 +1802,14 @@ void CQR_Encode::SetFormatInfoPattern(int nPatternNo) ///////////////////////////////////////////////////////////////////////////// // CQR_Encode::CountPenalty -// 用 途:マスク後ペナルティスコア算出 +// p rF}XNyieBXRAZo int CQR_Encode::CountPenalty() { int nPenalty = 0; int i, j, k; - // 同色の列の隣接モジュール + // F̗̗אڃW[ for (i = 0; i < m_nSymbleSize; ++i) { for (j = 0; j < m_nSymbleSize - 4; ++j) @@ -1833,7 +1833,7 @@ int CQR_Encode::CountPenalty() } } - // 同色の行の隣接モジュール + // F̍s̗אڃW[ for (i = 0; i < m_nSymbleSize; ++i) { for (j = 0; j < m_nSymbleSize - 4; ++j) @@ -1857,7 +1857,7 @@ int CQR_Encode::CountPenalty() } } - // 同色のモジュールブロック(2×2) + // F̃W[ubNiQ~Qj for (i = 0; i < m_nSymbleSize - 1; ++i) { for (j = 0; j < m_nSymbleSize - 1; ++j) @@ -1871,22 +1871,22 @@ int CQR_Encode::CountPenalty() } } - // 同一列における 1:1:3:1:1 比率(暗:明:暗:明:暗)のパターン + // ɂ 1:1:3:1:1 䗦i::::Áj̃p^[ for (i = 0; i < m_nSymbleSize; ++i) { for (j = 0; j < m_nSymbleSize - 6; ++j) { - if (((j == 0) || (! (m_byModuleData[i][j - 1] & 0x11))) && // 明 または シンボル外 - ( m_byModuleData[i][j] & 0x11) && // 暗 - 1 - (! (m_byModuleData[i][j + 1] & 0x11)) && // 明 - 1 - ( m_byModuleData[i][j + 2] & 0x11) && // 暗 ┐ - ( m_byModuleData[i][j + 3] & 0x11) && // 暗 │3 - ( m_byModuleData[i][j + 4] & 0x11) && // 暗 ┘ - (! (m_byModuleData[i][j + 5] & 0x11)) && // 明 - 1 - ( m_byModuleData[i][j + 6] & 0x11) && // 暗 - 1 - ((j == m_nSymbleSize - 7) || (! (m_byModuleData[i][j + 7] & 0x11)))) // 明 または シンボル外 + if (((j == 0) || (! (m_byModuleData[i][j - 1] & 0x11))) && // ܂ V{O + ( m_byModuleData[i][j] & 0x11) && // - 1 + (! (m_byModuleData[i][j + 1] & 0x11)) && // - 1 + ( m_byModuleData[i][j + 2] & 0x11) && // + ( m_byModuleData[i][j + 3] & 0x11) && // 3 + ( m_byModuleData[i][j + 4] & 0x11) && // + (! (m_byModuleData[i][j + 5] & 0x11)) && // - 1 + ( m_byModuleData[i][j + 6] & 0x11) && // - 1 + ((j == m_nSymbleSize - 7) || (! (m_byModuleData[i][j + 7] & 0x11)))) // ܂ V{O { - // 前または後に4以上の明パターン + // O܂͌4ȏ̖p^[ if (((j < 2 || ! (m_byModuleData[i][j - 2] & 0x11)) && (j < 3 || ! (m_byModuleData[i][j - 3] & 0x11)) && (j < 4 || ! (m_byModuleData[i][j - 4] & 0x11))) || @@ -1900,22 +1900,22 @@ int CQR_Encode::CountPenalty() } } - // 同一行における 1:1:3:1:1 比率(暗:明:暗:明:暗)のパターン + // sɂ 1:1:3:1:1 䗦i::::Áj̃p^[ for (i = 0; i < m_nSymbleSize; ++i) { for (j = 0; j < m_nSymbleSize - 6; ++j) { - if (((j == 0) || (! (m_byModuleData[j - 1][i] & 0x11))) && // 明 または シンボル外 - ( m_byModuleData[j] [i] & 0x11) && // 暗 - 1 - (! (m_byModuleData[j + 1][i] & 0x11)) && // 明 - 1 - ( m_byModuleData[j + 2][i] & 0x11) && // 暗 ┐ - ( m_byModuleData[j + 3][i] & 0x11) && // 暗 │3 - ( m_byModuleData[j + 4][i] & 0x11) && // 暗 ┘ - (! (m_byModuleData[j + 5][i] & 0x11)) && // 明 - 1 - ( m_byModuleData[j + 6][i] & 0x11) && // 暗 - 1 - ((j == m_nSymbleSize - 7) || (! (m_byModuleData[j + 7][i] & 0x11)))) // 明 または シンボル外 + if (((j == 0) || (! (m_byModuleData[j - 1][i] & 0x11))) && // ܂ V{O + ( m_byModuleData[j] [i] & 0x11) && // - 1 + (! (m_byModuleData[j + 1][i] & 0x11)) && // - 1 + ( m_byModuleData[j + 2][i] & 0x11) && // + ( m_byModuleData[j + 3][i] & 0x11) && // 3 + ( m_byModuleData[j + 4][i] & 0x11) && // + (! (m_byModuleData[j + 5][i] & 0x11)) && // - 1 + ( m_byModuleData[j + 6][i] & 0x11) && // - 1 + ((j == m_nSymbleSize - 7) || (! (m_byModuleData[j + 7][i] & 0x11)))) // ܂ V{O { - // 前または後に4以上の明パターン + // O܂͌4ȏ̖p^[ if (((j < 2 || ! (m_byModuleData[j - 2][i] & 0x11)) && (j < 3 || ! (m_byModuleData[j - 3][i] & 0x11)) && (j < 4 || ! (m_byModuleData[j - 4][i] & 0x11))) || @@ -1929,7 +1929,7 @@ int CQR_Encode::CountPenalty() } } - // 全体に対する暗モジュールの占める割合 + // Ŝɑ΂ÃW[̐߂銄 int nCount = 0; for (i = 0; i < m_nSymbleSize; ++i) diff --git a/ext/rqr/QR_Encode.h b/ext/rqr/QR_Encode.h index 047b157..eca2d4e 100644 --- a/ext/rqr/QR_Encode.h +++ b/ext/rqr/QR_Encode.h @@ -1,5 +1,5 @@ -//---(1)ここから------------------------- -//// QR_Encode.h : CQR_Encode クラス宣言およびインターフェイス定義 +//---(1)------------------------- +//// QR_Encode.h : CQR_Encode NX錾уC^[tFCX` //// Date 2006/05/17 Ver. 1.12 [Class Ver.1.22] Psytec Inc. // //#if !defined(AFX_QR_ENCODE_H__AC886DF7_C0AE_4C9F_AC7A_FCDA8CB1DD37__INCLUDED_) @@ -8,111 +8,111 @@ //#if _MSC_VER > 1000 //#pragma once //#endif // _MSC_VER > 1000 -//---(1)ここまでをコメントアウト----------- +//---(1)܂łRgAEg----------- -//---(2)ここから----------- +//---(2)----------- #ifndef __QR_ENCODER__ #define __QR_ENCODER__ #include "win2ansi.h" -//---(2)ここまでを追加----------- +//---(2)܂łlj----------- ///////////////////////////////////////////////////////////////////////////// -// 定数 +// 萔 -// 誤り訂正レベル +// x #define QR_LEVEL_L 0 #define QR_LEVEL_M 1 #define QR_LEVEL_Q 2 #define QR_LEVEL_H 3 -// データモード +// f[^[h #define QR_MODE_NUMERAL 0 #define QR_MODE_ALPHABET 1 #define QR_MODE_8BIT 2 #define QR_MODE_KANJI 3 -// バージョン(型番)グループ -#define QR_VRESION_S 0 // 1 〜 9 -#define QR_VRESION_M 1 // 10 〜 26 -#define QR_VRESION_L 2 // 27 〜 40 +// o[W(^)O[v +#define QR_VRESION_S 0 // 1 ` 9 +#define QR_VRESION_M 1 // 10 ` 26 +#define QR_VRESION_L 2 // 27 ` 40 -#define MAX_ALLCODEWORD 3706 // 総コードワード数最大値 -#define MAX_DATACODEWORD 2956 // データコードワード最大値(バージョン40-L) -#define MAX_CODEBLOCK 153 // ブロックデータコードワード数最大値(RSコードワードを含む) -#define MAX_MODULESIZE 177 // 一辺モジュール数最大値 +#define MAX_ALLCODEWORD 3706 // R[h[hől +#define MAX_DATACODEWORD 2956 // f[^R[h[hől(o[W40-L) +#define MAX_CODEBLOCK 153 // ubNf[^R[h[hől(qrR[h[h܂) +#define MAX_MODULESIZE 177 // ӃW[ől -// ビットマップ描画時マージン +// rbg}bv`掞}[W #define QR_MARGIN 4 ///////////////////////////////////////////////////////////////////////////// typedef struct tagRS_BLOCKINFO { - int ncRSBlock; // RSブロック数 - int ncAllCodeWord; // ブロック内コードワード数 - int ncDataCodeWord; // データコードワード数(コードワード数 - RSコードワード数) + int ncRSBlock; // qrubN + int ncAllCodeWord; // ubNR[h[h + int ncDataCodeWord; // f[^R[h[h(R[h[h - qrR[h[h) } RS_BLOCKINFO, *LPRS_BLOCKINFO; ///////////////////////////////////////////////////////////////////////////// -// QRコードバージョン(型番)関連情報 +// QRR[ho[W(^)֘A typedef struct tagQR_VERSIONINFO { - int nVersionNo; // バージョン(型番)番号(1〜40) - int ncAllCodeWord; // 総コードワード数 + int nVersionNo; // o[W(^)ԍ(1`40) + int ncAllCodeWord; // R[h[h - // 以下配列添字は誤り訂正率(0 = L, 1 = M, 2 = Q, 3 = H) - int ncDataCodeWord[4]; // データコードワード数(総コードワード数 - RSコードワード数) + // ȉzY͌(0 = L, 1 = M, 2 = Q, 3 = H) + int ncDataCodeWord[4]; // f[^R[h[h(R[h[h - qrR[h[h) - int ncAlignPoint; // アライメントパターン座標数 - int nAlignPoint[6]; // アライメントパターン中心座標 + int ncAlignPoint; // ACgp^[W + int nAlignPoint[6]; // ACgp^[SW - RS_BLOCKINFO RS_BlockInfo1[4]; // RSブロック情報(1) - RS_BLOCKINFO RS_BlockInfo2[4]; // RSブロック情報(2) + RS_BLOCKINFO RS_BlockInfo1[4]; // qrubN(1) + RS_BLOCKINFO RS_BlockInfo2[4]; // qrubN(2) } QR_VERSIONINFO, *LPQR_VERSIONINFO; ///////////////////////////////////////////////////////////////////////////// -// CQR_Encode クラス +// CQR_Encode NX class CQR_Encode { -// 構築/消滅 +// \z/ public: CQR_Encode(); ~CQR_Encode(); public: - int m_nLevel; // 誤り訂正レベル - int m_nVersion; // バージョン(型番) - BOOL m_bAutoExtent; // バージョン(型番)自動拡張指定フラグ - int m_nMaskingNo; // マスキングパターン番号 + int m_nLevel; // x + int m_nVersion; // o[W(^) + BOOL m_bAutoExtent; // o[W(^)gwtO + int m_nMaskingNo; // }XLOp^[ԍ public: int m_nSymbleSize; BYTE m_byModuleData[MAX_MODULESIZE][MAX_MODULESIZE]; // [x][y] - // bit5:機能モジュール(マスキング対象外)フラグ - // bit4:機能モジュール描画データ - // bit1:エンコードデータ - // bit0:マスク後エンコード描画データ - // 20hとの論理和により機能モジュール判定、11hとの論理和により描画(最終的にはBOOL値化) + // bit5:@\W[i}XLOΏۊOjtO + // bit4:@\W[`f[^ + // bit1:GR[hf[^ + // bit0:}XNGR[h`f[^ + // 20hƂ̘_aɂ@\W[A11hƂ̘_aɂ`iŏIIɂBOOLlj private: - int m_ncDataCodeWordBit; // データコードワードビット長 - BYTE m_byDataCodeWord[MAX_DATACODEWORD]; // 入力データエンコードエリア + int m_ncDataCodeWordBit; // f[^R[h[hrbg + BYTE m_byDataCodeWord[MAX_DATACODEWORD]; // ̓f[^GR[hGA int m_ncDataBlock; BYTE m_byBlockMode[MAX_DATACODEWORD]; int m_nBlockLength[MAX_DATACODEWORD]; - int m_ncAllCodeWord; // 総コードワード数(RS誤り訂正データを含む) - BYTE m_byAllCodeWord[MAX_ALLCODEWORD]; // 総コードワード算出エリア - BYTE m_byRSWork[MAX_CODEBLOCK]; // RSコードワード算出ワーク + int m_ncAllCodeWord; // R[h[h(qrf[^܂) + BYTE m_byAllCodeWord[MAX_ALLCODEWORD]; // R[h[hZoGA + BYTE m_byRSWork[MAX_CODEBLOCK]; // qrR[h[hZo[N -// データエンコード関連ファンクション +// f[^GR[h֘At@NV public: BOOL EncodeData(int nLevel, int nVersion, BOOL bAutoExtent, int nMaskingNo, LPCSTR lpsSource, int ncSource = 0); @@ -133,7 +133,7 @@ class CQR_Encode void GetRSCodeWord(LPBYTE lpbyRSWork, int ncDataCodeWord, int ncRSCodeWord); -// モジュール配置関連ファンクション +// W[zu֘At@NV private: void FormatModule(); diff --git a/ext/rqr/extconf.rb b/ext/rqr/extconf.rb index c57452d..6548a7e 100644 --- a/ext/rqr/extconf.rb +++ b/ext/rqr/extconf.rb @@ -11,12 +11,21 @@ =end require 'mkmf' require 'rbconfig' -$libs = append_library($libs, "supc++") -if File.exists?('/sw') - DARWIN_PORT_DIR = '/sw' +if have_library("supc++") + $libs = append_library($libs, "supc++") +end + +FINK_DIR = '/sw' +MACPORT_DIR = '/opt/local' +HOMEBREW_DIR = '/usr/local' + +if File.exists?(FINK_DIR) + DARWIN_PORT_DIR = FINK_DIR +elsif File.exists?(MACPORT_DIR) + DARWIN_PORT_DIR = MACPORT_DIR else - DARWIN_PORT_DIR = '/opt/local' + DARWIN_PORT_DIR = HOMEBREW_DIR end if RUBY_PLATFORM =~ /darwin/ diff --git a/ext/rqr/qr_draw.h b/ext/rqr/qr_draw.h index 7f524dc..37b522a 100644 --- a/ext/rqr/qr_draw.h +++ b/ext/rqr/qr_draw.h @@ -1,16 +1,22 @@ #ifndef _QR_DRAW_ #define _QR_DRAW_ -#define MARGIN_SIZE 4 /* マージンサイズ */ -#define MAX_MODULESIZE 177 /* データバイト列の領域サイズ */ +#define MARGIN_SIZE 4 /* }[WTCY */ +#define MAX_MODULESIZE 177 /* f[^oCg̗̈TCY */ //============================================================================= -// QRDraw クラス +// QRDraw NX //============================================================================= class QRDraw { public: - virtual ~QRDraw(){} + QRDraw(){ + this->bit_image=NULL; + } + + virtual ~QRDraw(){ + this->close(); + } void setup(char *filename, int modulesize, int symbolsize){ this->msize = modulesize; @@ -20,15 +26,23 @@ class QRDraw } protected: - unsigned char **bit_image; //ピクセルイメージを格納する - int msize; // 1ドットを表現するピクセル数(=modulesize) - int rsize; // マージンを含めた実際のイメージの一辺 - int ssize; // シンボルサイズ(マージンを含めない、ドットの個数) - char *filename; // 保存するファイル名 + unsigned char **bit_image; //sNZC[Wi[ + int msize; // 1hbg\sNZ(=modulesize) + int rsize; // }[W܂߂ۂ̃C[Ẅ + int ssize; // V{TCY(}[W܂߂ȂAhbǧ) + char *filename; // ۑt@C public: virtual int draw(char *filename, int modulesize, int symbolsize, unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE], void *opt) = 0; + void close(){ + int i; + if(this->bit_image){ + for(i=0; irsize; i++) free(this->bit_image[i]); + free(this->bit_image); + } + this->bit_image=NULL; + } }; #endif diff --git a/ext/rqr/qr_draw_jpeg.cpp b/ext/rqr/qr_draw_jpeg.cpp index 8979794..981ef42 100644 --- a/ext/rqr/qr_draw_jpeg.cpp +++ b/ext/rqr/qr_draw_jpeg.cpp @@ -1,32 +1,5 @@ #include "qr_draw_jpeg.h" -//================================================================================= -// QRDrawJPEG::QRDrawJPEG -//================================================================================= -QRDrawJPEG::QRDrawJPEG() -{ -#ifdef USE_JPG - bit_image = NULL; -#endif -} - -//================================================================================= -// QRDrawJPEG::~QRDrawJPEG -//================================================================================= -QRDrawJPEG::~QRDrawJPEG() -{ -#ifdef USE_JPG - int i; - - if(bit_image){ - for(i=0; irsize; i++){ - free(bit_image[i]); - } - free(bit_image); - } -#endif -} - //============================================================================= // QRDrawJPEG::draw //============================================================================= @@ -36,10 +9,10 @@ int QRDrawJPEG::draw(char *filename, int modulesize, int symbolsize, #ifdef USE_JPG setup(filename, modulesize, symbolsize); - /* グレースケールイメージの構築 */ + /* O[XP[C[W̍\z */ if( this->raster(data) ) return(1); - /* JPEG書き出し */ + /* JPEGo */ if( this->write() ) return(1); return(0); @@ -56,7 +29,7 @@ int QRDrawJPEG::raster(unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE]) #ifdef USE_JPG int i, j, k; - /* 実際にデータを置く領域を確保 */ + /* ۂɃf[^üm */ bit_image = (unsigned char **)malloc(sizeof(unsigned char *) * this->rsize); for(i=0; irsize; i++){ bit_image[i] = (unsigned char *)malloc(this->rsize); @@ -65,12 +38,12 @@ int QRDrawJPEG::raster(unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE]) for(i=0; issize; i++){ for(j=0; jssize; j++){ - /* 1行分生成 */ + /* 1s */ for(k=0; kmsize; k++){ bit_image[(i+MARGIN_SIZE)*this->msize][ (j+MARGIN_SIZE)*this->msize + k ] = data[j][i] ? 0 : 255; } } - /* モジュールサイズ分縦方向に増やす */ + /* W[TCYcɑ₷ */ for(k=1; kmsize; k++){ memcpy(bit_image[(i+MARGIN_SIZE)*this->msize+k], bit_image[(i+MARGIN_SIZE)*this->msize], this->rsize); } @@ -94,7 +67,7 @@ int QRDrawJPEG::write() FILE *stream; int i; - /* 出力先設定 */ + /* o͐ݒ */ if(!this->filename){ stream = stdout; }else{ diff --git a/ext/rqr/qr_draw_jpeg.h b/ext/rqr/qr_draw_jpeg.h index 85d427b..eadebdb 100644 --- a/ext/rqr/qr_draw_jpeg.h +++ b/ext/rqr/qr_draw_jpeg.h @@ -11,7 +11,7 @@ #endif //============================================================================= -// QRDrawJPEG クラス +// QRDrawJPEG NX //============================================================================= class QRDrawJPEG : public QRDraw { @@ -20,8 +20,8 @@ class QRDrawJPEG : public QRDraw int write(); public: - QRDrawJPEG(); - ~QRDrawJPEG(); + QRDrawJPEG(){} + ~QRDrawJPEG(){} int draw(char *filename, int modulesize, int symbolsize, unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE], void *opt); }; diff --git a/ext/rqr/qr_draw_png.cpp b/ext/rqr/qr_draw_png.cpp index 86dc8f4..0d8e4a7 100644 --- a/ext/rqr/qr_draw_png.cpp +++ b/ext/rqr/qr_draw_png.cpp @@ -1,31 +1,6 @@ #include "qr_draw_png.h" - -//================================================================================= -// QRDrawPNG::QRDrawPNG -//================================================================================= -QRDrawPNG::QRDrawPNG() -{ -#ifdef USE_PNG - bit_image = NULL; -#endif -} - -//================================================================================= -// QRDrawPNG::~QRDrawPNG -//================================================================================= -QRDrawPNG::~QRDrawPNG() -{ -#ifdef USE_PNG - int i; - - if(bit_image){ - for(i=0; irsize; i++){ - free(bit_image[i]); - } - free(bit_image); - } -#endif -} +#include +#include //============================================================================= // QRDrawPNG::draw @@ -36,10 +11,10 @@ int QRDrawPNG::draw(char *filename, int modulesize, int symbolsize, #ifdef USE_PNG setup(filename, modulesize, symbolsize); - /* ニ値イメージの構築 */ + /* jlC[W̍\z */ if( this->raster(data) ) return(1); - /* PNG書き出し */ + /* PNGo */ if( this->write() ) return(1); return(0); @@ -56,7 +31,7 @@ int QRDrawPNG::raster(unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE]) #ifdef USE_PNG int bitw = (int)ceil(this->rsize/8) + 1; - /* 実際にデータを置く領域を確保 */ + /* ۂɃf[^üm */ bit_image = (unsigned char **)malloc(sizeof(unsigned char *) * this->rsize); for(int i=0; irsize; i++){ bit_image[i] = (unsigned char *)malloc(bitw); @@ -64,12 +39,12 @@ int QRDrawPNG::raster(unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE]) } for(int i=0; issize; i++){ - int dp = MARGIN_SIZE*this->msize / 8; //横方向のバイト位置 - int sht =(MARGIN_SIZE*this->msize % 8) ? 3 : 7; //ビットシフト - unsigned char c = 0; //1バイトの構成を保存 + int dp = MARGIN_SIZE*this->msize / 8; //̃oCgʒu + int sht =(MARGIN_SIZE*this->msize % 8) ? 3 : 7; //rbgVtg + unsigned char c = 0; //1oCg̍\ۑ for(int j=0; jssize; j++){ - /* 1行分生成 */ + /* 1s */ for(int k=0; kmsize; k++){ c += (data[j][i] << sht); sht--; @@ -83,7 +58,7 @@ int QRDrawPNG::raster(unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE]) } } } - /* モジュールサイズ分縦方向に増やす */ + /* W[TCYcɑ₷ */ for(int k=1; kmsize; k++){ memcpy(bit_image[(i+MARGIN_SIZE)*this->msize+k], bit_image[(i+MARGIN_SIZE)*this->msize], bitw); } @@ -105,7 +80,7 @@ int QRDrawPNG::write() png_infop info_ptr; FILE *stream; - /* 出力先設定 */ + /* o͐ݒ */ if(!this->filename){ stream = stdout; }else{ @@ -118,15 +93,15 @@ int QRDrawPNG::write() png_init_io(png_ptr, stream); png_set_filter(png_ptr, 0, PNG_ALL_FILTERS); png_set_compression_level(png_ptr, Z_BEST_COMPRESSION); - png_set_invert_mono(png_ptr); //白黒反転 + png_set_invert_mono(png_ptr); //] - /* IHDRチャンク情報を設定 */ + /* IHDR`Nݒ */ png_set_IHDR(png_ptr, //png_structp info_ptr, //png_infop this->rsize, //width this->rsize, //height - 1, //bit_depth(ニ値) - PNG_COLOR_TYPE_GRAY, //Colorタイプ(ニ値) + 1, //bit_depth(jl) + PNG_COLOR_TYPE_GRAY, //Color^Cv(jl) PNG_INTERLACE_NONE, //interlace_method PNG_COMPRESSION_TYPE_DEFAULT, //compression_method PNG_FILTER_TYPE_DEFAULT); //filter_method diff --git a/ext/rqr/qr_draw_png.h b/ext/rqr/qr_draw_png.h index 3c4af86..08c45e5 100644 --- a/ext/rqr/qr_draw_png.h +++ b/ext/rqr/qr_draw_png.h @@ -10,7 +10,7 @@ #endif //============================================================================= -// QRDrawPNG クラス +// QRDrawPNG NX //============================================================================= class QRDrawPNG : public QRDraw { @@ -19,8 +19,8 @@ class QRDrawPNG : public QRDraw int write(); public: - QRDrawPNG(); - ~QRDrawPNG(); + QRDrawPNG(){} + ~QRDrawPNG(){} int draw(char *filename, int modulesize, int symbolsize, unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE], void *opt); }; diff --git a/ext/rqr/qr_draw_ps.cpp b/ext/rqr/qr_draw_ps.cpp index 0cf5e5e..36f7763 100644 --- a/ext/rqr/qr_draw_ps.cpp +++ b/ext/rqr/qr_draw_ps.cpp @@ -1,12 +1,5 @@ #include "qr_draw_ps.h" -//================================================================================= -// QRDrawPS::QRDrawPS -//================================================================================= -QRDrawPS::QRDrawPS() -{ -} - //============================================================================= // QRDrawPS::draw //============================================================================= @@ -46,34 +39,34 @@ int QRDrawPS::write2(unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE]) if((stream=fopen(this->filename, "wb")) == NULL) return(1); - /* ダミーヘッダー書き込み */ + /* _~[wb_[ */ this->write_header(stream); - /* TIFF書き込み */ + /* TIFF */ this->write_preview(stream, data); fclose(stream); - /* EPS書き込み */ + /* EPS */ this->write(data, "a"); - /* EPSサイズ算出 */ + /* EPSTCYZo */ stat(this->filename, &st); unsigned int esize = st.st_size - (this->tsize+30); - /* ヘッダー書き換え */ + /* wb_[ */ if((stream=fopen(this->filename, "rb+")) == NULL) return(1); - /* PS開始位置 */ + /* PSJnʒu */ fseek(stream, 4, SEEK_SET); this->littleEndian(30+this->tsize, lt); fprintf(stream, "%c%c%c%c", lt[0], lt[1], lt[2], lt[3]); - /* PS長 */ + /* PS */ fseek(stream, 8, SEEK_SET); this->littleEndian(esize, lt); fprintf(stream, "%c%c%c%c", lt[0], lt[1], lt[2], lt[3]); - /* TIFFプレビュー長 */ + /* TIFFvr[ */ fseek(stream, 24, SEEK_SET); this->littleEndian(this->tsize, lt); fprintf(stream, "%c%c%c%c", lt[0], lt[1], lt[2], lt[3]); @@ -93,27 +86,27 @@ void QRDrawPS::write_header(FILE *stream) { unsigned char lt[4]; - /* ナミモニ */ + /* i~j */ fprintf(stream, "%c%c%c%c", 0xC5, 0xD0, 0xD3, 0xC6); - /* PostScript開始位置 */ + /* PostScriptJnʒu */ fprintf(stream, "%c%c%c%c", 0x00, 0x00, 0x00, 0x00); - /* PostScript長さ */ + /* PostScript */ fprintf(stream, "%c%c%c%c", 0x00, 0x00, 0x00, 0x00); /* MetaFile */ fprintf(stream, "%c%c%c%c", 0x00, 0x00, 0x00, 0x00); fprintf(stream, "%c%c%c%c", 0x00, 0x00, 0x00, 0x00); - /* TIFFプレビュー開始位置 */ + /* TIFFvr[Jnʒu */ littleEndian(30, lt); fprintf(stream, "%c%c%c%c", lt[0], lt[1], lt[2], lt[3]); - /* TIFFプレビュー長 */ + /* TIFFvr[ */ fprintf(stream, "%c%c%c%c", 0x00, 0x00, 0x00, 0x00); - /* チェックサム */ + /* `FbNT */ fprintf(stream, "%c%c", 0xff, 0xff); } @@ -142,7 +135,7 @@ int QRDrawPS::write_preview(FILE *stream, unsigned char data[MAX_MODULESIZE][MAX tmpnam(tmp); if( tif.draw(tmp, this->msize, this->ssize, data, NULL) ) return(1); - /* TIFFをオープンしてファイルサイズを取得する */ + /* TIFFI[văt@CTCY擾 */ if((t=fopen(tmp, "rb")) == NULL){ remove(tmp); return(1); @@ -151,7 +144,7 @@ int QRDrawPS::write_preview(FILE *stream, unsigned char data[MAX_MODULESIZE][MAX this->tsize = ftell(t); fseek(t, 0, SEEK_SET); - /* TIFF本体の書き込み */ + /* TIFF{̂̏ */ p = (unsigned char *)malloc(this->tsize); fread(p, 1, this->tsize, t); fwrite(p, 1, this->tsize, stream); @@ -209,7 +202,7 @@ int QRDrawPS::write(unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE], char *mo fprintf(stream, "1 setgray\n"); fprintf(stream, "fill\n"); - // ドット描画 + // hbg` for(i=0; issize; i++){ for(j=0; jssize; j++) fprintf(stream, "%d ", data[j][i]); fprintf(stream, "\n"); diff --git a/ext/rqr/qr_draw_ps.h b/ext/rqr/qr_draw_ps.h index 501ebaf..5614085 100644 --- a/ext/rqr/qr_draw_ps.h +++ b/ext/rqr/qr_draw_ps.h @@ -13,7 +13,7 @@ #endif //============================================================================= -// QRDrawPS クラス +// QRDrawPS NX //============================================================================= class QRDrawPS : public QRDraw { @@ -28,7 +28,8 @@ class QRDrawPS : public QRDraw void littleEndian(int data, unsigned char *lt); public: - QRDrawPS(); + QRDrawPS(){} + ~QRDrawPS(){} int draw(char *filename, int modulesize, int symbolsize, unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE], void *opt); }; diff --git a/ext/rqr/qr_draw_tiff.cpp b/ext/rqr/qr_draw_tiff.cpp index b4ce5c3..202324a 100644 --- a/ext/rqr/qr_draw_tiff.cpp +++ b/ext/rqr/qr_draw_tiff.cpp @@ -1,32 +1,5 @@ #include "qr_draw_tiff.h" -//================================================================================= -// QRDrawPNG::QRDrawPNG -//================================================================================= -QRDrawTIFF::QRDrawTIFF() -{ -#ifdef USE_TIFF - bit_image = NULL; -#endif -} - -//================================================================================= -// QRDrawTIFF::~QRDrawTIFF -//================================================================================= -QRDrawTIFF::~QRDrawTIFF() -{ -#ifdef USE_TIFF - int i; - - if(bit_image){ - for(i=0; irsize; i++){ - free(bit_image[i]); - } - free(bit_image); - } -#endif -} - //============================================================================= // QRDrawPNG::draw //============================================================================= @@ -53,7 +26,7 @@ int QRDrawTIFF::raster(unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE]) #ifdef USE_TIFF int bitw = (int)ceil(this->rsize/8) + 1; - /* 実際にデータを置く領域を確保 */ + /* ۂɃf[^üm */ bit_image = (unsigned char **)malloc(sizeof(unsigned char *) * this->rsize); for(int i=0; irsize; i++){ bit_image[i] = (unsigned char *)malloc(bitw); @@ -61,12 +34,12 @@ int QRDrawTIFF::raster(unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE]) } for(int i=0; issize; i++){ - int dp = MARGIN_SIZE*this->msize / 8; //横方向のバイト位置 - int sht =(MARGIN_SIZE*this->msize % 8) ? 3 : 7; //ビットシフト - unsigned char c = 0; //1バイトの構成を保存 + int dp = MARGIN_SIZE*this->msize / 8; //̃oCgʒu + int sht =(MARGIN_SIZE*this->msize % 8) ? 3 : 7; //rbgVtg + unsigned char c = 0; //1oCg̍\ۑ for(int j=0; jssize; j++){ - /* 1行分生成 */ + /* 1s */ for(int k=0; kmsize; k++){ c += (data[j][i] << sht); sht--; @@ -80,7 +53,7 @@ int QRDrawTIFF::raster(unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE]) } } } - /* モジュールサイズ分縦方向に増やす */ + /* W[TCYcɑ₷ */ for(int k=1; kmsize; k++){ memcpy(bit_image[(i+MARGIN_SIZE)*this->msize+k], bit_image[(i+MARGIN_SIZE)*this->msize], bitw); } @@ -104,21 +77,21 @@ int QRDrawTIFF::write() /* Open the TIFF file */ if( (tiff=TIFFOpen(this->filename, "w")) == NULL ) return(1); - /* タグ */ - TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, this->rsize); /* 幅(ピクセル数) */ - TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, this->rsize); /* 高(スキャンライン数) */ - TIFFSetField(tiff, TIFFTAG_COMPRESSION, COMPRESSION_NONE); /* 圧縮モード */ - TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 1); /* ピクセルの深さ */ - TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE); /* カラータイプ */ - TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 1); /* カラープレーン数 */ - TIFFSetField(tiff, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); /* スキャン方向 */ + /* ^O */ + TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, this->rsize); /* (sNZ) */ + TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, this->rsize); /* (XLC) */ + TIFFSetField(tiff, TIFFTAG_COMPRESSION, COMPRESSION_NONE); /* k[h */ + TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 1); /* sNZ̐[ */ + TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE); /* J[^Cv */ + TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 1); /* J[v[ */ + TIFFSetField(tiff, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); /* XL */ TIFFSetField(tiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); /* ? */ - TIFFSetField(tiff, TIFFTAG_XRESOLUTION, 72.0); /* 解像度 */ - TIFFSetField(tiff, TIFFTAG_YRESOLUTION, 72.0); /* 解像度 */ - TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); /* 解像度の単位(RESUNIT_INCH:インチ) */ - TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIP, this->rsize); /* 1ストリップに何行格納されるか */ + TIFFSetField(tiff, TIFFTAG_XRESOLUTION, 72.0); /* 𑜓x */ + TIFFSetField(tiff, TIFFTAG_YRESOLUTION, 72.0); /* 𑜓x */ + TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); /* 𑜓x̒P(RESUNIT_INCH:C`) */ + TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIP, this->rsize); /* 1Xgbvɉsi[邩 */ - /* 1行ずつ書き込み */ + /* 1s */ for(i=0 ; irsize ; i++){ if( TIFFWriteScanline(tiff, bit_image[i], i, 0) < 0 ){ TIFFClose(tiff); diff --git a/ext/rqr/qr_draw_tiff.h b/ext/rqr/qr_draw_tiff.h index a430fed..35c45f1 100644 --- a/ext/rqr/qr_draw_tiff.h +++ b/ext/rqr/qr_draw_tiff.h @@ -11,7 +11,7 @@ #endif //============================================================================= -// QRDrawTIFF クラス +// QRDrawTIFF NX //============================================================================= class QRDrawTIFF : public QRDraw { @@ -20,8 +20,8 @@ class QRDrawTIFF : public QRDraw int write(); public: - QRDrawTIFF(); - ~QRDrawTIFF(); + QRDrawTIFF(){} + ~QRDrawTIFF(){} int draw(char *filename, int modulesize, int symbolsize, unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE], void *opt); }; diff --git a/ext/rqr/qr_wrap.cxx b/ext/rqr/qr_wrap.cxx index 27b587e..e3655a3 100644 --- a/ext/rqr/qr_wrap.cxx +++ b/ext/rqr/qr_wrap.cxx @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.31 + * Version 2.0.4 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -10,20 +10,28 @@ #define SWIGRUBY + #ifdef __cplusplus -template class SwigValueWrapper { - T *tt; +/* SwigValueWrapper is described in swig.swg */ +template class SwigValueWrapper { + struct SwigMovePointer { + T *ptr; + SwigMovePointer(T *p) : ptr(p) { } + ~SwigMovePointer() { delete ptr; } + SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + } pointer; + SwigValueWrapper& operator=(const SwigValueWrapper& rhs); + SwigValueWrapper(const SwigValueWrapper& rhs); public: - SwigValueWrapper() : tt(0) { } - SwigValueWrapper(const SwigValueWrapper& rhs) : tt(new T(*rhs.tt)) { } - SwigValueWrapper(const T& t) : tt(new T(t)) { } - ~SwigValueWrapper() { delete tt; } - SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } - operator T&() const { return *tt; } - T *operator&() { return tt; } -private: - SwigValueWrapper& operator=(const SwigValueWrapper& rhs); + SwigValueWrapper() : pointer(0) { } + SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } + operator T&() const { return *pointer.ptr; } + T *operator&() { return pointer.ptr; } }; + +template T SwigValueInit() { + return T(); +} #endif /* ----------------------------------------------------------------------------- @@ -33,14 +41,14 @@ template class SwigValueWrapper { /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) -# if (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# else -# define SWIGTEMPLATEDISAMBIGUATOR -# endif +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template # else -# define SWIGTEMPLATEDISAMBIGUATOR +# define SWIGTEMPLATEDISAMBIGUATOR # endif #endif @@ -68,6 +76,12 @@ template class SwigValueWrapper { # endif #endif +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) @@ -123,6 +137,12 @@ template class SwigValueWrapper { # define _CRT_SECURE_NO_DEPRECATE #endif +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. @@ -130,14 +150,14 @@ template class SwigValueWrapper { /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) -# if (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# else -# define SWIGTEMPLATEDISAMBIGUATOR -# endif +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template # else -# define SWIGTEMPLATEDISAMBIGUATOR +# define SWIGTEMPLATEDISAMBIGUATOR # endif #endif @@ -165,6 +185,12 @@ template class SwigValueWrapper { # endif #endif +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) @@ -220,16 +246,22 @@ template class SwigValueWrapper { # define _CRT_SECURE_NO_DEPRECATE #endif +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + /* ----------------------------------------------------------------------------- * swigrun.swg * - * This file contains generic CAPI SWIG runtime support for pointer + * This file contains generic C API SWIG runtime support for pointer * type checking. * ----------------------------------------------------------------------------- */ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "3" +#define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -242,11 +274,11 @@ template class SwigValueWrapper { /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for - creating a static or dynamic library from the swig runtime code. - In 99.9% of the cases, swig just needs to declare them as 'static'. + creating a static or dynamic library from the SWIG runtime code. + In 99.9% of the cases, SWIG just needs to declare them as 'static'. - But only do this if is strictly necessary, ie, if you have problems - with your compiler or so. + But only do this if strictly necessary, ie, if you have problems + with your compiler or suchlike. */ #ifndef SWIGRUNTIME @@ -264,6 +296,7 @@ template class SwigValueWrapper { /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 @@ -272,14 +305,14 @@ template class SwigValueWrapper { /* Flags/methods for returning states. - The swig conversion methods, as ConvertPtr, return and integer + The SWIG conversion methods, as ConvertPtr, return an integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). Use the following macros/flags to set or process the returning states. - In old swig versions, you usually write code as: + In old versions of SWIG, code such as the following was usually written: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { // success code @@ -287,7 +320,7 @@ template class SwigValueWrapper { //fail code } - Now you can be more explicit as: + Now you can be more explicit: int res = SWIG_ConvertPtr(obj,vptr,ty.flags); if (SWIG_IsOK(res)) { @@ -296,7 +329,7 @@ template class SwigValueWrapper { // fail code } - that seems to be the same, but now you can also do + which is the same really, but now you can also do Type *ptr; int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); @@ -314,7 +347,7 @@ template class SwigValueWrapper { I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that - requires also to SWIG_ConvertPtr to return new result values, as + also requires SWIG_ConvertPtr to return new result values, such as int SWIG_ConvertPtr(obj, ptr,...) { if () { @@ -332,7 +365,7 @@ template class SwigValueWrapper { Of course, returning the plain '0(success)/-1(fail)' still works, but you can be more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the - swig errors code. + SWIG errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code allows to return the 'cast rank', for example, if you have this @@ -346,9 +379,8 @@ template class SwigValueWrapper { fooi(1) // cast rank '0' just use the SWIG_AddCast()/SWIG_CheckState() +*/ - - */ #define SWIG_OK (0) #define SWIG_ERROR (-1) #define SWIG_IsOK(r) (r >= 0) @@ -373,7 +405,6 @@ template class SwigValueWrapper { #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) - /* Cast-Rank Mode */ #if defined(SWIG_CASTRANK_MODE) # ifndef SWIG_TypeRank @@ -396,18 +427,16 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { #endif - - #include #ifdef __cplusplus extern "C" { #endif -typedef void *(*swig_converter_func)(void *); +typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); -/* Structure to store inforomation on one type */ +/* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ @@ -452,7 +481,7 @@ SWIG_TypeNameComp(const char *f1, const char *l1, while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } - return (l1 - f1) - (l2 - f2); + return (int)((l1 - f1) - (l2 - f2)); } /* @@ -494,48 +523,66 @@ SWIG_TypeCompare(const char *nb, const char *tb) { } -/* think of this as a c++ template<> or a scheme macro */ -#define SWIG_TypeCheck_Template(comparison, ty) \ - if (ty) { \ - swig_cast_info *iter = ty->cast; \ - while (iter) { \ - if (comparison) { \ - if (iter == ty->cast) return iter; \ - /* Move iter to the top of the linked list */ \ - iter->prev->next = iter->next; \ - if (iter->next) \ - iter->next->prev = iter->prev; \ - iter->next = ty->cast; \ - iter->prev = 0; \ - if (ty->cast) ty->cast->prev = iter; \ - ty->cast = iter; \ - return iter; \ - } \ - iter = iter->next; \ - } \ - } \ - return 0 - /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { - SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty); + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (strcmp(iter->type->name, c) == 0) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; } -/* Same as previous function, except strcmp is replaced with a pointer comparison */ +/* + Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison +*/ SWIGRUNTIME swig_cast_info * -SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { - SWIG_TypeCheck_Template(iter->type == from, into); +SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (iter->type == from) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; } /* Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* @@ -808,6 +855,33 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #include +/* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which + * breaks using rb_intern as an lvalue, as SWIG does. We work around this + * issue for now by disabling this. + * https://sourceforge.net/tracker/?func=detail&aid=2859614&group_id=1645&atid=101645 + */ +#ifdef rb_intern +# undef rb_intern +#endif + +/* Remove global macros defined in Ruby's win32.h */ +#ifdef write +# undef write +#endif +#ifdef read +# undef read +#endif +#ifdef bind +# undef bind +#endif +#ifdef close +# undef close +#endif +#ifdef connect +# undef connect +#endif + + /* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */ #ifndef NUM2LL #define NUM2LL(x) NUM2LONG((x)) @@ -836,12 +910,44 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #ifndef RSTRING_PTR # define RSTRING_PTR(x) RSTRING(x)->ptr #endif +#ifndef RSTRING_END +# define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x)) +#endif #ifndef RARRAY_LEN # define RARRAY_LEN(x) RARRAY(x)->len #endif #ifndef RARRAY_PTR # define RARRAY_PTR(x) RARRAY(x)->ptr #endif +#ifndef RFLOAT_VALUE +# define RFLOAT_VALUE(x) RFLOAT(x)->value +#endif +#ifndef DOUBLE2NUM +# define DOUBLE2NUM(x) rb_float_new(x) +#endif +#ifndef RHASH_TBL +# define RHASH_TBL(x) (RHASH(x)->tbl) +#endif +#ifndef RHASH_ITER_LEV +# define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev) +#endif +#ifndef RHASH_IFNONE +# define RHASH_IFNONE(x) (RHASH(x)->ifnone) +#endif +#ifndef RHASH_SIZE +# define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries) +#endif +#ifndef RHASH_EMPTY_P +# define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0) +#endif +#ifndef RSTRUCT_LEN +# define RSTRUCT_LEN(x) RSTRUCT(x)->len +#endif +#ifndef RSTRUCT_PTR +# define RSTRUCT_PTR(x) RSTRUCT(x)->ptr +#endif + + /* * Need to be very careful about how these macros are defined, especially @@ -903,6 +1009,7 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new") #endif +static VALUE _mSWIG = Qnil; /* ----------------------------------------------------------------------------- * error manipulation @@ -915,7 +1022,7 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { /* Define custom exceptions for errors that do not map to existing Ruby exceptions. Note this only works for C++ since a global cannot be - initialized by a funtion in C. For C, fallback to rb_eRuntimeError.*/ + initialized by a function in C. For C, fallback to rb_eRuntimeError.*/ SWIGINTERN VALUE getNullReferenceError(void) { @@ -993,12 +1100,73 @@ SWIG_Ruby_ErrorType(int SWIG_code) { } +/* This function is called when a user inputs a wrong argument to + a method. + */ +SWIGINTERN +const char* Ruby_Format_TypeError( const char* msg, + const char* type, + const char* name, + const int argn, + VALUE input ) +{ + char buf[128]; + VALUE str; + VALUE asStr; + if ( msg && *msg ) + { + str = rb_str_new2(msg); + } + else + { + str = rb_str_new(NULL, 0); + } + + str = rb_str_cat2( str, "Expected argument " ); + sprintf( buf, "%d of type ", argn-1 ); + str = rb_str_cat2( str, buf ); + str = rb_str_cat2( str, type ); + str = rb_str_cat2( str, ", but got " ); + str = rb_str_cat2( str, rb_obj_classname(input) ); + str = rb_str_cat2( str, " " ); + asStr = rb_inspect(input); + if ( RSTRING_LEN(asStr) > 30 ) + { + str = rb_str_cat( str, StringValuePtr(asStr), 30 ); + str = rb_str_cat2( str, "..." ); + } + else + { + str = rb_str_append( str, asStr ); + } + + if ( name ) + { + str = rb_str_cat2( str, "\n\tin SWIG method '" ); + str = rb_str_cat2( str, name ); + str = rb_str_cat2( str, "'" ); + } + + return StringValuePtr( str ); +} +/* This function is called when an overloaded method fails */ +SWIGINTERN +void Ruby_Format_OverloadedError( + const int argc, + const int maxargs, + const char* method, + const char* prototypes + ) +{ + const char* msg = "Wrong # of arguments"; + if ( argc <= maxargs ) msg = "Wrong arguments"; + rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n" + "Possible C/C++ prototypes are:\n%s", + msg, method, prototypes); +} /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * rubytracking.swg * * This file contains support for tracking mappings from @@ -1011,26 +1179,54 @@ SWIG_Ruby_ErrorType(int SWIG_code) { extern "C" { #endif +/* Ruby 1.8 actually assumes the first case. */ +#if SIZEOF_VOIDP == SIZEOF_LONG +# define SWIG2NUM(v) LONG2NUM((unsigned long)v) +# define NUM2SWIG(x) (unsigned long)NUM2LONG(x) +#elif SIZEOF_VOIDP == SIZEOF_LONG_LONG +# define SWIG2NUM(v) LL2NUM((unsigned long long)v) +# define NUM2SWIG(x) (unsigned long long)NUM2LL(x) +#else +# error sizeof(void*) is not the same as long or long long +#endif + /* Global Ruby hash table to store Trackings from C/C++ - structs to Ruby Objects. */ -static VALUE swig_ruby_trackings; - -/* Global variable that stores a reference to the ruby - hash table delete function. */ -static ID swig_ruby_hash_delete = 0; + structs to Ruby Objects. +*/ +static VALUE swig_ruby_trackings = Qnil; + +/* Global variable that stores a reference to the ruby + hash table delete function. */ +static ID swig_ruby_hash_delete; /* Setup a Ruby hash table to store Trackings */ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) { /* Create a ruby hash table to store Trackings from C++ - objects to Ruby objects. Also make sure to tell - the garabage collector about the hash table. */ - swig_ruby_trackings = rb_hash_new(); - rb_gc_register_address(&swig_ruby_trackings); - - /* Now store a reference to the hash table delete function - so that we only have to look it up once.*/ - swig_ruby_hash_delete = rb_intern("delete"); + objects to Ruby objects. */ + + /* Try to see if some other .so has already created a + tracking hash table, which we keep hidden in an instance var + in the SWIG module. + This is done to allow multiple DSOs to share the same + tracking table. + */ + ID trackings_id = rb_intern( "@__trackings__" ); + VALUE verbose = rb_gv_get("VERBOSE"); + rb_gv_set("VERBOSE", Qfalse); + swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id ); + rb_gv_set("VERBOSE", verbose); + + /* No, it hasn't. Create one ourselves */ + if ( swig_ruby_trackings == Qnil ) + { + swig_ruby_trackings = rb_hash_new(); + rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings ); + } + + /* Now store a reference to the hash table delete function + so that we only have to look it up once.*/ + swig_ruby_hash_delete = rb_intern("delete"); } /* Get a Ruby number to reference a pointer */ @@ -1040,8 +1236,7 @@ SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) { a Ruby number object. */ /* Convert the pointer to a Ruby number */ - unsigned long value = (unsigned long) ptr; - return LONG2NUM(value); + return SWIG2NUM(ptr); } /* Get a Ruby number to reference an object */ @@ -1051,8 +1246,7 @@ SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) { a Ruby number object. */ /* Convert the Object to a Ruby number */ - unsigned long value = (unsigned long) object; - return LONG2NUM(value); + return SWIG2NUM(object); } /* Get a Ruby object from a previously stored reference */ @@ -1060,9 +1254,8 @@ SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) { /* The provided Ruby number object is a reference to the Ruby object we want.*/ - /* First convert the Ruby number to a C number */ - unsigned long value = NUM2LONG(reference); - return (VALUE) value; + /* Convert the Ruby number to a Ruby object */ + return NUM2SWIG(reference); } /* Add a Tracking from a C/C++ struct to a Ruby object */ @@ -1154,15 +1347,21 @@ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) { return target; } +/* For ruby1.8.4 and earlier. */ +#ifndef RUBY_INIT_STACK + RUBY_EXTERN void Init_stack(VALUE* addr); +# define RUBY_INIT_STACK \ + VALUE variable_in_this_stack_frame; \ + Init_stack(&variable_in_this_stack_frame); +#endif + + #ifdef __cplusplus } #endif /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * rubyrun.swg * * This file contains the runtime support for Ruby modules @@ -1206,7 +1405,7 @@ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) { /* Error manipulation */ #define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code) -#define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), msg) +#define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg) #define SWIG_fail goto fail @@ -1218,6 +1417,7 @@ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) { #define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value) #define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty) +#include "assert.h" /* ----------------------------------------------------------------------------- * pointers/data manipulation @@ -1225,9 +1425,6 @@ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) { #ifdef __cplusplus extern "C" { -#if 0 -} /* cc-mode */ -#endif #endif typedef struct { @@ -1239,10 +1436,44 @@ typedef struct { } swig_class; -static VALUE _mSWIG = Qnil; +/* Global pointer used to keep some internal SWIG stuff */ static VALUE _cSWIG_Pointer = Qnil; static VALUE swig_runtime_data_type_pointer = Qnil; +/* Global IDs used to keep some internal SWIG stuff */ +static ID swig_arity_id = 0; +static ID swig_call_id = 0; + +/* + If your swig extension is to be run within an embedded ruby and has + director callbacks, you should set -DRUBY_EMBEDDED during compilation. + This will reset ruby's stack frame on each entry point from the main + program the first time a virtual director function is invoked (in a + non-recursive way). + If this is not done, you run the risk of Ruby trashing the stack. +*/ + +#ifdef RUBY_EMBEDDED + +# define SWIG_INIT_STACK \ + if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \ + ++swig_virtual_calls; +# define SWIG_RELEASE_STACK --swig_virtual_calls; +# define Ruby_DirectorTypeMismatchException(x) \ + rb_raise( rb_eTypeError, "%s", x ); return c_result; + + static unsigned int swig_virtual_calls = 0; + +#else /* normal non-embedded extension */ + +# define SWIG_INIT_STACK +# define SWIG_RELEASE_STACK +# define Ruby_DirectorTypeMismatchException(x) \ + throw Swig::DirectorTypeMismatchException( x ); + +#endif /* RUBY_EMBEDDED */ + + SWIGRUNTIME VALUE getExceptionClass(void) { static int init = 0; @@ -1274,6 +1505,8 @@ SWIG_Ruby_InitRuntime(void) { if (_mSWIG == Qnil) { _mSWIG = rb_define_module("SWIG"); + swig_call_id = rb_intern("call"); + swig_arity_id = rb_intern("arity"); } } @@ -1297,7 +1530,7 @@ SWIGRUNTIME VALUE SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags) { int own = flags & SWIG_POINTER_OWN; - + int track; char *klass_name; swig_class *sklass; VALUE klass; @@ -1310,14 +1543,15 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags) sklass = (swig_class *) type->clientdata; /* Are we tracking this class and have we already returned this Ruby object? */ - if (sklass->trackObjects) { + track = sklass->trackObjects; + if (track) { obj = SWIG_RubyInstanceFor(ptr); /* Check the object's type and make sure it has the correct type. It might not in cases where methods do things like downcast methods. */ if (obj != Qnil) { - VALUE value = rb_iv_get(obj, "__swigtype__"); + VALUE value = rb_iv_get(obj, "@__swigtype__"); char* type_name = RSTRING_PTR(value); if (strcmp(type->name, type_name) == 0) { @@ -1327,10 +1561,13 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags) } /* Create a new Ruby object */ - obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark), (own ? VOIDFUNC(sklass->destroy) : 0), ptr); + obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark), + ( own ? VOIDFUNC(sklass->destroy) : + (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 ) + ), ptr); /* If tracking is on for this class then track this object. */ - if (sklass->trackObjects) { + if (track) { SWIG_RubyAddTracking(ptr, obj); } } else { @@ -1340,7 +1577,7 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags) free((void *) klass_name); obj = Data_Wrap_Struct(klass, 0, 0, ptr); } - rb_iv_set(obj, "__swigtype__", rb_str_new2(type->name)); + rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name)); return obj; } @@ -1352,7 +1589,7 @@ SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type) VALUE obj; swig_class *sklass = (swig_class *) type->clientdata; obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0); - rb_iv_set(obj, "__swigtype__", rb_str_new2(type->name)); + rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name)); return obj; } @@ -1360,7 +1597,7 @@ SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type) SWIGRUNTIMEINLINE char * SWIG_Ruby_MangleStr(VALUE obj) { - VALUE stype = rb_iv_get(obj, "__swigtype__"); + VALUE stype = rb_iv_get(obj, "@__swigtype__"); return StringValuePtr(stype); } @@ -1442,8 +1679,11 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, tc = SWIG_TypeCheck(c, ty); if (!tc) { return SWIG_ERROR; + } else { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc, vptr, &newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ } - *ptr = SWIG_TypeCast(tc, vptr); } else { *ptr = vptr; } @@ -1524,10 +1764,42 @@ SWIG_Ruby_SetModule(swig_module_info *pointer) rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer); } +/* This function can be used to check whether a proc or method or similarly + callable function has been passed. Usually used in a %typecheck, like: + + %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) { + $result = SWIG_Ruby_isCallable( $input ); + } + */ +SWIGINTERN +int SWIG_Ruby_isCallable( VALUE proc ) +{ + if ( rb_respond_to( proc, swig_call_id ) == Qtrue ) + return 1; + return 0; +} + +/* This function can be used to check the arity (number of arguments) + a proc or method can take. Usually used in a %typecheck. + Valid arities will be that equal to minimal or those < 0 + which indicate a variable number of parameters at the end. + */ +SWIGINTERN +int SWIG_Ruby_arity( VALUE proc, int minimal ) +{ + if ( rb_respond_to( proc, swig_arity_id ) == Qtrue ) + { + VALUE num = rb_funcall( proc, swig_arity_id, 0 ); + int arity = NUM2INT(num); + if ( arity < 0 && (arity+1) < -minimal ) return 1; + if ( arity == minimal ) return 1; + return 1; + } + return 0; +} + + #ifdef __cplusplus -#if 0 -{ /* cc-mode */ -#endif } #endif @@ -1567,7 +1839,11 @@ static swig_module_info swig_module = {swig_types, 14, 0, 0, 0, 0}; static VALUE mQR; -#define SWIGVERSION 0x010331 +#define SWIG_RUBY_THREAD_BEGIN_BLOCK +#define SWIG_RUBY_THREAD_END_BLOCK + + +#define SWIGVERSION 0x020004 #define SWIG_VERSION SWIGVERSION @@ -1587,15 +1863,20 @@ static VALUE mQR; #include "qr_draw_tiff.h" +SWIGINTERNINLINE VALUE +SWIG_From_bool (bool value) +{ + return value ? Qtrue : Qfalse; +} + + #include -#ifndef LLONG_MIN -# define LLONG_MIN LONG_LONG_MIN -#endif -#ifndef LLONG_MAX -# define LLONG_MAX LONG_LONG_MAX -#endif -#ifndef ULLONG_MAX -# define ULLONG_MAX ULONG_LONG_MAX +#if !defined(SWIG_NO_LLONG_MAX) +# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) +# define LLONG_MAX __LONG_LONG_MAX__ +# define LLONG_MIN (-LLONG_MAX - 1LL) +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +# endif #endif @@ -1626,11 +1907,11 @@ SWIGINTERN int SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc) { if (TYPE(obj) == T_STRING) { - - - + #if defined(StringValuePtr) + char *cstr = StringValuePtr(obj); + #else char *cstr = STR2CSTR(obj); - + #endif size_t size = RSTRING_LEN(obj) + 1; if (cptr) { if (alloc) { @@ -1670,7 +1951,7 @@ SWIG_ruby_failed(void) } -/*@SWIG:%ruby_aux_method@*/ +/*@SWIG:/usr/local/Cellar/swig/2.0.4/share/swig/2.0.4/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args) { VALUE obj = args[0]; @@ -1734,14 +2015,7 @@ SWIG_AsVal_bool (VALUE obj, bool *val) return SWIG_TypeError; } - -SWIGINTERNINLINE VALUE -SWIG_From_bool (bool value) -{ - return value ? Qtrue : Qfalse; -} - -swig_class cQRDraw; +swig_class SwigClassQRDraw; SWIGINTERN void free_QRDraw(QRDraw *arg1) { @@ -1769,22 +2043,22 @@ _wrap_QRDraw_setup(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_QRDraw, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setup" "', argument " "1"" of type '" "QRDraw *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QRDraw *","setup", 1, self )); } arg1 = reinterpret_cast< QRDraw * >(argp1); res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "setup" "', argument " "2"" of type '" "char *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","setup", 2, argv[0] )); } arg2 = reinterpret_cast< char * >(buf2); ecode3 = SWIG_AsVal_int(argv[1], &val3); if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "setup" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","setup", 3, argv[1] )); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(argv[2], &val4); if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "setup" "', argument " "4"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","setup", 4, argv[2] )); } arg4 = static_cast< int >(val4); (arg1)->setup(arg2,arg3,arg4); @@ -1804,7 +2078,6 @@ _wrap_QRDraw_draw(int argc, VALUE *argv, VALUE self) { int arg4 ; unsigned char (*arg5)[177] ; void *arg6 = (void *) 0 ; - int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -1817,6 +2090,7 @@ _wrap_QRDraw_draw(int argc, VALUE *argv, VALUE self) { void *argp5 = 0 ; int res5 = 0 ; int res6 ; + int result; VALUE vresult = Qnil; if ((argc < 5) || (argc > 5)) { @@ -1824,32 +2098,32 @@ _wrap_QRDraw_draw(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_QRDraw, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "draw" "', argument " "1"" of type '" "QRDraw *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QRDraw *","draw", 1, self )); } arg1 = reinterpret_cast< QRDraw * >(argp1); res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "draw" "', argument " "2"" of type '" "char *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","draw", 2, argv[0] )); } arg2 = reinterpret_cast< char * >(buf2); ecode3 = SWIG_AsVal_int(argv[1], &val3); if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "draw" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","draw", 3, argv[1] )); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(argv[2], &val4); if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "draw" "', argument " "4"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","draw", 4, argv[2] )); } arg4 = static_cast< int >(val4); res5 = SWIG_ConvertPtr(argv[3], &argp5,SWIGTYPE_p_a_177__unsigned_char, 0 | 0 ); if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "draw" "', argument " "5"" of type '" "unsigned char [177][177]""'"); + SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "unsigned char [177][177]","draw", 5, argv[3] )); } arg5 = reinterpret_cast< unsigned char (*)[177] >(argp5); res6 = SWIG_ConvertPtr(argv[4],SWIG_as_voidptrptr(&arg6), 0, 0); if (!SWIG_IsOK(res6)) { - SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "draw" "', argument " "6"" of type '" "void *""'"); + SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "void *","draw", 6, argv[4] )); } result = (int)(arg1)->draw(arg2,arg3,arg4,(unsigned char (*)[177])arg5,arg6); vresult = SWIG_From_int(static_cast< int >(result)); @@ -1861,7 +2135,28 @@ _wrap_QRDraw_draw(int argc, VALUE *argv, VALUE self) { } -swig_class cQRDrawJPEG; +SWIGINTERN VALUE +_wrap_QRDraw_close(int argc, VALUE *argv, VALUE self) { + QRDraw *arg1 = (QRDraw *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_QRDraw, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QRDraw *","close", 1, self )); + } + arg1 = reinterpret_cast< QRDraw * >(argp1); + (arg1)->close(); + return Qnil; +fail: + return Qnil; +} + + +swig_class SwigClassQRDrawJPEG; #ifdef HAVE_RB_DEFINE_ALLOC_FUNC SWIGINTERN VALUE @@ -1887,8 +2182,8 @@ _wrap_new_QRDrawJPEG(int argc, VALUE *argv, VALUE self) { if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } - result = (QRDrawJPEG *)new QRDrawJPEG();DATA_PTR(self) = result; - + result = (QRDrawJPEG *)new QRDrawJPEG(); + DATA_PTR(self) = result; return self; fail: return Qnil; @@ -1908,7 +2203,6 @@ _wrap_QRDrawJPEG_draw(int argc, VALUE *argv, VALUE self) { int arg4 ; unsigned char (*arg5)[177] ; void *arg6 = (void *) 0 ; - int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -1921,6 +2215,7 @@ _wrap_QRDrawJPEG_draw(int argc, VALUE *argv, VALUE self) { void *argp5 = 0 ; int res5 = 0 ; int res6 ; + int result; VALUE vresult = Qnil; if ((argc < 5) || (argc > 5)) { @@ -1928,32 +2223,32 @@ _wrap_QRDrawJPEG_draw(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_QRDrawJPEG, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "draw" "', argument " "1"" of type '" "QRDrawJPEG *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QRDrawJPEG *","draw", 1, self )); } arg1 = reinterpret_cast< QRDrawJPEG * >(argp1); res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "draw" "', argument " "2"" of type '" "char *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","draw", 2, argv[0] )); } arg2 = reinterpret_cast< char * >(buf2); ecode3 = SWIG_AsVal_int(argv[1], &val3); if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "draw" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","draw", 3, argv[1] )); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(argv[2], &val4); if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "draw" "', argument " "4"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","draw", 4, argv[2] )); } arg4 = static_cast< int >(val4); res5 = SWIG_ConvertPtr(argv[3], &argp5,SWIGTYPE_p_a_177__unsigned_char, 0 | 0 ); if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "draw" "', argument " "5"" of type '" "unsigned char [177][177]""'"); + SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "unsigned char [177][177]","draw", 5, argv[3] )); } arg5 = reinterpret_cast< unsigned char (*)[177] >(argp5); res6 = SWIG_ConvertPtr(argv[4],SWIG_as_voidptrptr(&arg6), 0, 0); if (!SWIG_IsOK(res6)) { - SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "draw" "', argument " "6"" of type '" "void *""'"); + SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "void *","draw", 6, argv[4] )); } result = (int)(arg1)->draw(arg2,arg3,arg4,(unsigned char (*)[177])arg5,arg6); vresult = SWIG_From_int(static_cast< int >(result)); @@ -1965,7 +2260,7 @@ _wrap_QRDrawJPEG_draw(int argc, VALUE *argv, VALUE self) { } -swig_class cQRDrawPNG; +swig_class SwigClassQRDrawPNG; #ifdef HAVE_RB_DEFINE_ALLOC_FUNC SWIGINTERN VALUE @@ -1991,8 +2286,8 @@ _wrap_new_QRDrawPNG(int argc, VALUE *argv, VALUE self) { if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } - result = (QRDrawPNG *)new QRDrawPNG();DATA_PTR(self) = result; - + result = (QRDrawPNG *)new QRDrawPNG(); + DATA_PTR(self) = result; return self; fail: return Qnil; @@ -2012,7 +2307,6 @@ _wrap_QRDrawPNG_draw(int argc, VALUE *argv, VALUE self) { int arg4 ; unsigned char (*arg5)[177] ; void *arg6 = (void *) 0 ; - int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -2025,6 +2319,7 @@ _wrap_QRDrawPNG_draw(int argc, VALUE *argv, VALUE self) { void *argp5 = 0 ; int res5 = 0 ; int res6 ; + int result; VALUE vresult = Qnil; if ((argc < 5) || (argc > 5)) { @@ -2032,32 +2327,32 @@ _wrap_QRDrawPNG_draw(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_QRDrawPNG, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "draw" "', argument " "1"" of type '" "QRDrawPNG *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QRDrawPNG *","draw", 1, self )); } arg1 = reinterpret_cast< QRDrawPNG * >(argp1); res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "draw" "', argument " "2"" of type '" "char *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","draw", 2, argv[0] )); } arg2 = reinterpret_cast< char * >(buf2); ecode3 = SWIG_AsVal_int(argv[1], &val3); if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "draw" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","draw", 3, argv[1] )); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(argv[2], &val4); if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "draw" "', argument " "4"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","draw", 4, argv[2] )); } arg4 = static_cast< int >(val4); res5 = SWIG_ConvertPtr(argv[3], &argp5,SWIGTYPE_p_a_177__unsigned_char, 0 | 0 ); if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "draw" "', argument " "5"" of type '" "unsigned char [177][177]""'"); + SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "unsigned char [177][177]","draw", 5, argv[3] )); } arg5 = reinterpret_cast< unsigned char (*)[177] >(argp5); res6 = SWIG_ConvertPtr(argv[4],SWIG_as_voidptrptr(&arg6), 0, 0); if (!SWIG_IsOK(res6)) { - SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "draw" "', argument " "6"" of type '" "void *""'"); + SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "void *","draw", 6, argv[4] )); } result = (int)(arg1)->draw(arg2,arg3,arg4,(unsigned char (*)[177])arg5,arg6); vresult = SWIG_From_int(static_cast< int >(result)); @@ -2069,7 +2364,7 @@ _wrap_QRDrawPNG_draw(int argc, VALUE *argv, VALUE self) { } -swig_class cQRDrawPS; +swig_class SwigClassQRDrawPS; #ifdef HAVE_RB_DEFINE_ALLOC_FUNC SWIGINTERN VALUE @@ -2095,14 +2390,19 @@ _wrap_new_QRDrawPS(int argc, VALUE *argv, VALUE self) { if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } - result = (QRDrawPS *)new QRDrawPS();DATA_PTR(self) = result; - + result = (QRDrawPS *)new QRDrawPS(); + DATA_PTR(self) = result; return self; fail: return Qnil; } +SWIGINTERN void +free_QRDrawPS(QRDrawPS *arg1) { + delete arg1; +} + SWIGINTERN VALUE _wrap_QRDrawPS_draw(int argc, VALUE *argv, VALUE self) { QRDrawPS *arg1 = (QRDrawPS *) 0 ; @@ -2111,7 +2411,6 @@ _wrap_QRDrawPS_draw(int argc, VALUE *argv, VALUE self) { int arg4 ; unsigned char (*arg5)[177] ; void *arg6 = (void *) 0 ; - int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -2124,6 +2423,7 @@ _wrap_QRDrawPS_draw(int argc, VALUE *argv, VALUE self) { void *argp5 = 0 ; int res5 = 0 ; int res6 ; + int result; VALUE vresult = Qnil; if ((argc < 5) || (argc > 5)) { @@ -2131,32 +2431,32 @@ _wrap_QRDrawPS_draw(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_QRDrawPS, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "draw" "', argument " "1"" of type '" "QRDrawPS *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QRDrawPS *","draw", 1, self )); } arg1 = reinterpret_cast< QRDrawPS * >(argp1); res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "draw" "', argument " "2"" of type '" "char *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","draw", 2, argv[0] )); } arg2 = reinterpret_cast< char * >(buf2); ecode3 = SWIG_AsVal_int(argv[1], &val3); if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "draw" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","draw", 3, argv[1] )); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(argv[2], &val4); if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "draw" "', argument " "4"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","draw", 4, argv[2] )); } arg4 = static_cast< int >(val4); res5 = SWIG_ConvertPtr(argv[3], &argp5,SWIGTYPE_p_a_177__unsigned_char, 0 | 0 ); if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "draw" "', argument " "5"" of type '" "unsigned char [177][177]""'"); + SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "unsigned char [177][177]","draw", 5, argv[3] )); } arg5 = reinterpret_cast< unsigned char (*)[177] >(argp5); res6 = SWIG_ConvertPtr(argv[4],SWIG_as_voidptrptr(&arg6), 0, 0); if (!SWIG_IsOK(res6)) { - SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "draw" "', argument " "6"" of type '" "void *""'"); + SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "void *","draw", 6, argv[4] )); } result = (int)(arg1)->draw(arg2,arg3,arg4,(unsigned char (*)[177])arg5,arg6); vresult = SWIG_From_int(static_cast< int >(result)); @@ -2168,12 +2468,7 @@ _wrap_QRDrawPS_draw(int argc, VALUE *argv, VALUE self) { } -SWIGINTERN void -free_QRDrawPS(QRDrawPS *arg1) { - delete arg1; -} - -swig_class cQRDrawTIFF; +swig_class SwigClassQRDrawTIFF; #ifdef HAVE_RB_DEFINE_ALLOC_FUNC SWIGINTERN VALUE @@ -2199,8 +2494,8 @@ _wrap_new_QRDrawTIFF(int argc, VALUE *argv, VALUE self) { if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } - result = (QRDrawTIFF *)new QRDrawTIFF();DATA_PTR(self) = result; - + result = (QRDrawTIFF *)new QRDrawTIFF(); + DATA_PTR(self) = result; return self; fail: return Qnil; @@ -2220,7 +2515,6 @@ _wrap_QRDrawTIFF_draw(int argc, VALUE *argv, VALUE self) { int arg4 ; unsigned char (*arg5)[177] ; void *arg6 = (void *) 0 ; - int result; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -2233,6 +2527,7 @@ _wrap_QRDrawTIFF_draw(int argc, VALUE *argv, VALUE self) { void *argp5 = 0 ; int res5 = 0 ; int res6 ; + int result; VALUE vresult = Qnil; if ((argc < 5) || (argc > 5)) { @@ -2240,32 +2535,32 @@ _wrap_QRDrawTIFF_draw(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_QRDrawTIFF, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "draw" "', argument " "1"" of type '" "QRDrawTIFF *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QRDrawTIFF *","draw", 1, self )); } arg1 = reinterpret_cast< QRDrawTIFF * >(argp1); res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "draw" "', argument " "2"" of type '" "char *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","draw", 2, argv[0] )); } arg2 = reinterpret_cast< char * >(buf2); ecode3 = SWIG_AsVal_int(argv[1], &val3); if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "draw" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","draw", 3, argv[1] )); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_int(argv[2], &val4); if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "draw" "', argument " "4"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","draw", 4, argv[2] )); } arg4 = static_cast< int >(val4); res5 = SWIG_ConvertPtr(argv[3], &argp5,SWIGTYPE_p_a_177__unsigned_char, 0 | 0 ); if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "draw" "', argument " "5"" of type '" "unsigned char [177][177]""'"); + SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "unsigned char [177][177]","draw", 5, argv[3] )); } arg5 = reinterpret_cast< unsigned char (*)[177] >(argp5); res6 = SWIG_ConvertPtr(argv[4],SWIG_as_voidptrptr(&arg6), 0, 0); if (!SWIG_IsOK(res6)) { - SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "draw" "', argument " "6"" of type '" "void *""'"); + SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "void *","draw", 6, argv[4] )); } result = (int)(arg1)->draw(arg2,arg3,arg4,(unsigned char (*)[177])arg5,arg6); vresult = SWIG_From_int(static_cast< int >(result)); @@ -2277,7 +2572,7 @@ _wrap_QRDrawTIFF_draw(int argc, VALUE *argv, VALUE self) { } -swig_class cRS_BLOCKINFO; +swig_class SwigClassRS_BLOCKINFO; SWIGINTERN VALUE _wrap_RS_BLOCKINFO_ncRSBlock_set(int argc, VALUE *argv, VALUE self) { @@ -2293,16 +2588,15 @@ _wrap_RS_BLOCKINFO_ncRSBlock_set(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagRS_BLOCKINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ncRSBlock" "', argument " "1"" of type '" "RS_BLOCKINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "RS_BLOCKINFO *","ncRSBlock", 1, self )); } arg1 = reinterpret_cast< RS_BLOCKINFO * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ncRSBlock" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ncRSBlock", 2, argv[0] )); } arg2 = static_cast< int >(val2); if (arg1) (arg1)->ncRSBlock = arg2; - return Qnil; fail: return Qnil; @@ -2312,9 +2606,9 @@ _wrap_RS_BLOCKINFO_ncRSBlock_set(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_RS_BLOCKINFO_ncRSBlock_get(int argc, VALUE *argv, VALUE self) { RS_BLOCKINFO *arg1 = (RS_BLOCKINFO *) 0 ; - int result; void *argp1 = 0 ; int res1 = 0 ; + int result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { @@ -2322,7 +2616,7 @@ _wrap_RS_BLOCKINFO_ncRSBlock_get(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagRS_BLOCKINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ncRSBlock" "', argument " "1"" of type '" "RS_BLOCKINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "RS_BLOCKINFO *","ncRSBlock", 1, self )); } arg1 = reinterpret_cast< RS_BLOCKINFO * >(argp1); result = (int) ((arg1)->ncRSBlock); @@ -2347,16 +2641,15 @@ _wrap_RS_BLOCKINFO_ncAllCodeWord_set(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagRS_BLOCKINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ncAllCodeWord" "', argument " "1"" of type '" "RS_BLOCKINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "RS_BLOCKINFO *","ncAllCodeWord", 1, self )); } arg1 = reinterpret_cast< RS_BLOCKINFO * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ncAllCodeWord" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ncAllCodeWord", 2, argv[0] )); } arg2 = static_cast< int >(val2); if (arg1) (arg1)->ncAllCodeWord = arg2; - return Qnil; fail: return Qnil; @@ -2366,9 +2659,9 @@ _wrap_RS_BLOCKINFO_ncAllCodeWord_set(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_RS_BLOCKINFO_ncAllCodeWord_get(int argc, VALUE *argv, VALUE self) { RS_BLOCKINFO *arg1 = (RS_BLOCKINFO *) 0 ; - int result; void *argp1 = 0 ; int res1 = 0 ; + int result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { @@ -2376,7 +2669,7 @@ _wrap_RS_BLOCKINFO_ncAllCodeWord_get(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagRS_BLOCKINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ncAllCodeWord" "', argument " "1"" of type '" "RS_BLOCKINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "RS_BLOCKINFO *","ncAllCodeWord", 1, self )); } arg1 = reinterpret_cast< RS_BLOCKINFO * >(argp1); result = (int) ((arg1)->ncAllCodeWord); @@ -2401,16 +2694,15 @@ _wrap_RS_BLOCKINFO_ncDataCodeWord_set(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagRS_BLOCKINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ncDataCodeWord" "', argument " "1"" of type '" "RS_BLOCKINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "RS_BLOCKINFO *","ncDataCodeWord", 1, self )); } arg1 = reinterpret_cast< RS_BLOCKINFO * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ncDataCodeWord" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ncDataCodeWord", 2, argv[0] )); } arg2 = static_cast< int >(val2); if (arg1) (arg1)->ncDataCodeWord = arg2; - return Qnil; fail: return Qnil; @@ -2420,9 +2712,9 @@ _wrap_RS_BLOCKINFO_ncDataCodeWord_set(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_RS_BLOCKINFO_ncDataCodeWord_get(int argc, VALUE *argv, VALUE self) { RS_BLOCKINFO *arg1 = (RS_BLOCKINFO *) 0 ; - int result; void *argp1 = 0 ; int res1 = 0 ; + int result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { @@ -2430,7 +2722,7 @@ _wrap_RS_BLOCKINFO_ncDataCodeWord_get(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagRS_BLOCKINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ncDataCodeWord" "', argument " "1"" of type '" "RS_BLOCKINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "RS_BLOCKINFO *","ncDataCodeWord", 1, self )); } arg1 = reinterpret_cast< RS_BLOCKINFO * >(argp1); result = (int) ((arg1)->ncDataCodeWord); @@ -2465,8 +2757,8 @@ _wrap_new_RS_BLOCKINFO(int argc, VALUE *argv, VALUE self) { if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } - result = (RS_BLOCKINFO *)new RS_BLOCKINFO();DATA_PTR(self) = result; - + result = (RS_BLOCKINFO *)new RS_BLOCKINFO(); + DATA_PTR(self) = result; return self; fail: return Qnil; @@ -2478,7 +2770,7 @@ free_RS_BLOCKINFO(RS_BLOCKINFO *arg1) { delete arg1; } -swig_class cQR_VERSIONINFO; +swig_class SwigClassQR_VERSIONINFO; SWIGINTERN VALUE _wrap_QR_VERSIONINFO_nVersionNo_set(int argc, VALUE *argv, VALUE self) { @@ -2494,16 +2786,15 @@ _wrap_QR_VERSIONINFO_nVersionNo_set(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagQR_VERSIONINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nVersionNo" "', argument " "1"" of type '" "QR_VERSIONINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QR_VERSIONINFO *","nVersionNo", 1, self )); } arg1 = reinterpret_cast< QR_VERSIONINFO * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nVersionNo" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","nVersionNo", 2, argv[0] )); } arg2 = static_cast< int >(val2); if (arg1) (arg1)->nVersionNo = arg2; - return Qnil; fail: return Qnil; @@ -2513,9 +2804,9 @@ _wrap_QR_VERSIONINFO_nVersionNo_set(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_QR_VERSIONINFO_nVersionNo_get(int argc, VALUE *argv, VALUE self) { QR_VERSIONINFO *arg1 = (QR_VERSIONINFO *) 0 ; - int result; void *argp1 = 0 ; int res1 = 0 ; + int result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { @@ -2523,7 +2814,7 @@ _wrap_QR_VERSIONINFO_nVersionNo_get(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagQR_VERSIONINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nVersionNo" "', argument " "1"" of type '" "QR_VERSIONINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QR_VERSIONINFO *","nVersionNo", 1, self )); } arg1 = reinterpret_cast< QR_VERSIONINFO * >(argp1); result = (int) ((arg1)->nVersionNo); @@ -2548,16 +2839,15 @@ _wrap_QR_VERSIONINFO_ncAllCodeWord_set(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagQR_VERSIONINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ncAllCodeWord" "', argument " "1"" of type '" "QR_VERSIONINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QR_VERSIONINFO *","ncAllCodeWord", 1, self )); } arg1 = reinterpret_cast< QR_VERSIONINFO * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ncAllCodeWord" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ncAllCodeWord", 2, argv[0] )); } arg2 = static_cast< int >(val2); if (arg1) (arg1)->ncAllCodeWord = arg2; - return Qnil; fail: return Qnil; @@ -2567,9 +2857,9 @@ _wrap_QR_VERSIONINFO_ncAllCodeWord_set(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_QR_VERSIONINFO_ncAllCodeWord_get(int argc, VALUE *argv, VALUE self) { QR_VERSIONINFO *arg1 = (QR_VERSIONINFO *) 0 ; - int result; void *argp1 = 0 ; int res1 = 0 ; + int result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { @@ -2577,7 +2867,7 @@ _wrap_QR_VERSIONINFO_ncAllCodeWord_get(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagQR_VERSIONINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ncAllCodeWord" "', argument " "1"" of type '" "QR_VERSIONINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QR_VERSIONINFO *","ncAllCodeWord", 1, self )); } arg1 = reinterpret_cast< QR_VERSIONINFO * >(argp1); result = (int) ((arg1)->ncAllCodeWord); @@ -2602,12 +2892,12 @@ _wrap_QR_VERSIONINFO_ncDataCodeWord_set(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagQR_VERSIONINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ncDataCodeWord" "', argument " "1"" of type '" "QR_VERSIONINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QR_VERSIONINFO *","ncDataCodeWord", 1, self )); } arg1 = reinterpret_cast< QR_VERSIONINFO * >(argp1); res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_int, 0 | 0 ); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ncDataCodeWord" "', argument " "2"" of type '" "int [4]""'"); + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "int [4]","ncDataCodeWord", 2, argv[0] )); } arg2 = reinterpret_cast< int * >(argp2); { @@ -2627,9 +2917,9 @@ _wrap_QR_VERSIONINFO_ncDataCodeWord_set(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_QR_VERSIONINFO_ncDataCodeWord_get(int argc, VALUE *argv, VALUE self) { QR_VERSIONINFO *arg1 = (QR_VERSIONINFO *) 0 ; - int *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; + int *result = 0 ; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { @@ -2637,7 +2927,7 @@ _wrap_QR_VERSIONINFO_ncDataCodeWord_get(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagQR_VERSIONINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ncDataCodeWord" "', argument " "1"" of type '" "QR_VERSIONINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QR_VERSIONINFO *","ncDataCodeWord", 1, self )); } arg1 = reinterpret_cast< QR_VERSIONINFO * >(argp1); result = (int *)(int *) ((arg1)->ncDataCodeWord); @@ -2662,16 +2952,15 @@ _wrap_QR_VERSIONINFO_ncAlignPoint_set(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagQR_VERSIONINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ncAlignPoint" "', argument " "1"" of type '" "QR_VERSIONINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QR_VERSIONINFO *","ncAlignPoint", 1, self )); } arg1 = reinterpret_cast< QR_VERSIONINFO * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ncAlignPoint" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ncAlignPoint", 2, argv[0] )); } arg2 = static_cast< int >(val2); if (arg1) (arg1)->ncAlignPoint = arg2; - return Qnil; fail: return Qnil; @@ -2681,9 +2970,9 @@ _wrap_QR_VERSIONINFO_ncAlignPoint_set(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_QR_VERSIONINFO_ncAlignPoint_get(int argc, VALUE *argv, VALUE self) { QR_VERSIONINFO *arg1 = (QR_VERSIONINFO *) 0 ; - int result; void *argp1 = 0 ; int res1 = 0 ; + int result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { @@ -2691,7 +2980,7 @@ _wrap_QR_VERSIONINFO_ncAlignPoint_get(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagQR_VERSIONINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ncAlignPoint" "', argument " "1"" of type '" "QR_VERSIONINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QR_VERSIONINFO *","ncAlignPoint", 1, self )); } arg1 = reinterpret_cast< QR_VERSIONINFO * >(argp1); result = (int) ((arg1)->ncAlignPoint); @@ -2716,12 +3005,12 @@ _wrap_QR_VERSIONINFO_nAlignPoint_set(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagQR_VERSIONINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nAlignPoint" "', argument " "1"" of type '" "QR_VERSIONINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QR_VERSIONINFO *","nAlignPoint", 1, self )); } arg1 = reinterpret_cast< QR_VERSIONINFO * >(argp1); res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_int, 0 | 0 ); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nAlignPoint" "', argument " "2"" of type '" "int [6]""'"); + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "int [6]","nAlignPoint", 2, argv[0] )); } arg2 = reinterpret_cast< int * >(argp2); { @@ -2741,9 +3030,9 @@ _wrap_QR_VERSIONINFO_nAlignPoint_set(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_QR_VERSIONINFO_nAlignPoint_get(int argc, VALUE *argv, VALUE self) { QR_VERSIONINFO *arg1 = (QR_VERSIONINFO *) 0 ; - int *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; + int *result = 0 ; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { @@ -2751,7 +3040,7 @@ _wrap_QR_VERSIONINFO_nAlignPoint_get(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagQR_VERSIONINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nAlignPoint" "', argument " "1"" of type '" "QR_VERSIONINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QR_VERSIONINFO *","nAlignPoint", 1, self )); } arg1 = reinterpret_cast< QR_VERSIONINFO * >(argp1); result = (int *)(int *) ((arg1)->nAlignPoint); @@ -2776,12 +3065,12 @@ _wrap_QR_VERSIONINFO_RS_BlockInfo1_set(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagQR_VERSIONINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RS_BlockInfo1" "', argument " "1"" of type '" "QR_VERSIONINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QR_VERSIONINFO *","RS_BlockInfo1", 1, self )); } arg1 = reinterpret_cast< QR_VERSIONINFO * >(argp1); res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_tagRS_BLOCKINFO, 0 | 0 ); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "RS_BlockInfo1" "', argument " "2"" of type '" "RS_BLOCKINFO [4]""'"); + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "RS_BLOCKINFO [4]","RS_BlockInfo1", 2, argv[0] )); } arg2 = reinterpret_cast< RS_BLOCKINFO * >(argp2); { @@ -2801,9 +3090,9 @@ _wrap_QR_VERSIONINFO_RS_BlockInfo1_set(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_QR_VERSIONINFO_RS_BlockInfo1_get(int argc, VALUE *argv, VALUE self) { QR_VERSIONINFO *arg1 = (QR_VERSIONINFO *) 0 ; - RS_BLOCKINFO *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; + RS_BLOCKINFO *result = 0 ; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { @@ -2811,7 +3100,7 @@ _wrap_QR_VERSIONINFO_RS_BlockInfo1_get(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagQR_VERSIONINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RS_BlockInfo1" "', argument " "1"" of type '" "QR_VERSIONINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QR_VERSIONINFO *","RS_BlockInfo1", 1, self )); } arg1 = reinterpret_cast< QR_VERSIONINFO * >(argp1); result = (RS_BLOCKINFO *)(RS_BLOCKINFO *) ((arg1)->RS_BlockInfo1); @@ -2836,12 +3125,12 @@ _wrap_QR_VERSIONINFO_RS_BlockInfo2_set(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagQR_VERSIONINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RS_BlockInfo2" "', argument " "1"" of type '" "QR_VERSIONINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QR_VERSIONINFO *","RS_BlockInfo2", 1, self )); } arg1 = reinterpret_cast< QR_VERSIONINFO * >(argp1); res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_tagRS_BLOCKINFO, 0 | 0 ); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "RS_BlockInfo2" "', argument " "2"" of type '" "RS_BLOCKINFO [4]""'"); + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "RS_BLOCKINFO [4]","RS_BlockInfo2", 2, argv[0] )); } arg2 = reinterpret_cast< RS_BLOCKINFO * >(argp2); { @@ -2861,9 +3150,9 @@ _wrap_QR_VERSIONINFO_RS_BlockInfo2_set(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_QR_VERSIONINFO_RS_BlockInfo2_get(int argc, VALUE *argv, VALUE self) { QR_VERSIONINFO *arg1 = (QR_VERSIONINFO *) 0 ; - RS_BLOCKINFO *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; + RS_BLOCKINFO *result = 0 ; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { @@ -2871,7 +3160,7 @@ _wrap_QR_VERSIONINFO_RS_BlockInfo2_get(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_tagQR_VERSIONINFO, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RS_BlockInfo2" "', argument " "1"" of type '" "QR_VERSIONINFO *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QR_VERSIONINFO *","RS_BlockInfo2", 1, self )); } arg1 = reinterpret_cast< QR_VERSIONINFO * >(argp1); result = (RS_BLOCKINFO *)(RS_BLOCKINFO *) ((arg1)->RS_BlockInfo2); @@ -2906,8 +3195,8 @@ _wrap_new_QR_VERSIONINFO(int argc, VALUE *argv, VALUE self) { if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } - result = (QR_VERSIONINFO *)new QR_VERSIONINFO();DATA_PTR(self) = result; - + result = (QR_VERSIONINFO *)new QR_VERSIONINFO(); + DATA_PTR(self) = result; return self; fail: return Qnil; @@ -2919,7 +3208,7 @@ free_QR_VERSIONINFO(QR_VERSIONINFO *arg1) { delete arg1; } -swig_class cCQR_Encode; +swig_class SwigClassCQR_Encode; #ifdef HAVE_RB_DEFINE_ALLOC_FUNC SWIGINTERN VALUE @@ -2945,8 +3234,8 @@ _wrap_new_CQR_Encode(int argc, VALUE *argv, VALUE self) { if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } - result = (CQR_Encode *)new CQR_Encode();DATA_PTR(self) = result; - + result = (CQR_Encode *)new CQR_Encode(); + DATA_PTR(self) = result; return self; fail: return Qnil; @@ -2972,16 +3261,15 @@ _wrap_CQR_Encode_m_nLevel_set(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CQR_Encode, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "m_nLevel" "', argument " "1"" of type '" "CQR_Encode *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CQR_Encode *","m_nLevel", 1, self )); } arg1 = reinterpret_cast< CQR_Encode * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "m_nLevel" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","m_nLevel", 2, argv[0] )); } arg2 = static_cast< int >(val2); if (arg1) (arg1)->m_nLevel = arg2; - return Qnil; fail: return Qnil; @@ -2991,9 +3279,9 @@ _wrap_CQR_Encode_m_nLevel_set(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_CQR_Encode_m_nLevel_get(int argc, VALUE *argv, VALUE self) { CQR_Encode *arg1 = (CQR_Encode *) 0 ; - int result; void *argp1 = 0 ; int res1 = 0 ; + int result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { @@ -3001,7 +3289,7 @@ _wrap_CQR_Encode_m_nLevel_get(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CQR_Encode, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "m_nLevel" "', argument " "1"" of type '" "CQR_Encode *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CQR_Encode *","m_nLevel", 1, self )); } arg1 = reinterpret_cast< CQR_Encode * >(argp1); result = (int) ((arg1)->m_nLevel); @@ -3026,16 +3314,15 @@ _wrap_CQR_Encode_m_nVersion_set(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CQR_Encode, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "m_nVersion" "', argument " "1"" of type '" "CQR_Encode *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CQR_Encode *","m_nVersion", 1, self )); } arg1 = reinterpret_cast< CQR_Encode * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "m_nVersion" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","m_nVersion", 2, argv[0] )); } arg2 = static_cast< int >(val2); if (arg1) (arg1)->m_nVersion = arg2; - return Qnil; fail: return Qnil; @@ -3045,9 +3332,9 @@ _wrap_CQR_Encode_m_nVersion_set(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_CQR_Encode_m_nVersion_get(int argc, VALUE *argv, VALUE self) { CQR_Encode *arg1 = (CQR_Encode *) 0 ; - int result; void *argp1 = 0 ; int res1 = 0 ; + int result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { @@ -3055,7 +3342,7 @@ _wrap_CQR_Encode_m_nVersion_get(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CQR_Encode, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "m_nVersion" "', argument " "1"" of type '" "CQR_Encode *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CQR_Encode *","m_nVersion", 1, self )); } arg1 = reinterpret_cast< CQR_Encode * >(argp1); result = (int) ((arg1)->m_nVersion); @@ -3080,16 +3367,15 @@ _wrap_CQR_Encode_m_bAutoExtent_set(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CQR_Encode, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "m_bAutoExtent" "', argument " "1"" of type '" "CQR_Encode *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CQR_Encode *","m_bAutoExtent", 1, self )); } arg1 = reinterpret_cast< CQR_Encode * >(argp1); ecode2 = SWIG_AsVal_bool(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "m_bAutoExtent" "', argument " "2"" of type '" "BOOL""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "BOOL","m_bAutoExtent", 2, argv[0] )); } arg2 = static_cast< BOOL >(val2); if (arg1) (arg1)->m_bAutoExtent = arg2; - return Qnil; fail: return Qnil; @@ -3099,9 +3385,9 @@ _wrap_CQR_Encode_m_bAutoExtent_set(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_CQR_Encode_m_bAutoExtent_get(int argc, VALUE *argv, VALUE self) { CQR_Encode *arg1 = (CQR_Encode *) 0 ; - BOOL result; void *argp1 = 0 ; int res1 = 0 ; + BOOL result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { @@ -3109,7 +3395,7 @@ _wrap_CQR_Encode_m_bAutoExtent_get(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CQR_Encode, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "m_bAutoExtent" "', argument " "1"" of type '" "CQR_Encode *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CQR_Encode *","m_bAutoExtent", 1, self )); } arg1 = reinterpret_cast< CQR_Encode * >(argp1); result = (BOOL) ((arg1)->m_bAutoExtent); @@ -3134,16 +3420,15 @@ _wrap_CQR_Encode_m_nMaskingNo_set(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CQR_Encode, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "m_nMaskingNo" "', argument " "1"" of type '" "CQR_Encode *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CQR_Encode *","m_nMaskingNo", 1, self )); } arg1 = reinterpret_cast< CQR_Encode * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "m_nMaskingNo" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","m_nMaskingNo", 2, argv[0] )); } arg2 = static_cast< int >(val2); if (arg1) (arg1)->m_nMaskingNo = arg2; - return Qnil; fail: return Qnil; @@ -3153,9 +3438,9 @@ _wrap_CQR_Encode_m_nMaskingNo_set(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_CQR_Encode_m_nMaskingNo_get(int argc, VALUE *argv, VALUE self) { CQR_Encode *arg1 = (CQR_Encode *) 0 ; - int result; void *argp1 = 0 ; int res1 = 0 ; + int result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { @@ -3163,7 +3448,7 @@ _wrap_CQR_Encode_m_nMaskingNo_get(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CQR_Encode, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "m_nMaskingNo" "', argument " "1"" of type '" "CQR_Encode *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CQR_Encode *","m_nMaskingNo", 1, self )); } arg1 = reinterpret_cast< CQR_Encode * >(argp1); result = (int) ((arg1)->m_nMaskingNo); @@ -3188,16 +3473,15 @@ _wrap_CQR_Encode_m_nSymbleSize_set(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CQR_Encode, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "m_nSymbleSize" "', argument " "1"" of type '" "CQR_Encode *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CQR_Encode *","m_nSymbleSize", 1, self )); } arg1 = reinterpret_cast< CQR_Encode * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "m_nSymbleSize" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","m_nSymbleSize", 2, argv[0] )); } arg2 = static_cast< int >(val2); if (arg1) (arg1)->m_nSymbleSize = arg2; - return Qnil; fail: return Qnil; @@ -3207,9 +3491,9 @@ _wrap_CQR_Encode_m_nSymbleSize_set(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_CQR_Encode_m_nSymbleSize_get(int argc, VALUE *argv, VALUE self) { CQR_Encode *arg1 = (CQR_Encode *) 0 ; - int result; void *argp1 = 0 ; int res1 = 0 ; + int result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { @@ -3217,7 +3501,7 @@ _wrap_CQR_Encode_m_nSymbleSize_get(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CQR_Encode, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "m_nSymbleSize" "', argument " "1"" of type '" "CQR_Encode *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CQR_Encode *","m_nSymbleSize", 1, self )); } arg1 = reinterpret_cast< CQR_Encode * >(argp1); result = (int) ((arg1)->m_nSymbleSize); @@ -3242,12 +3526,12 @@ _wrap_CQR_Encode_m_byModuleData_set(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CQR_Encode, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "m_byModuleData" "', argument " "1"" of type '" "CQR_Encode *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CQR_Encode *","m_byModuleData", 1, self )); } arg1 = reinterpret_cast< CQR_Encode * >(argp1); res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_a_177__unsigned_char, 0 | 0 ); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "m_byModuleData" "', argument " "2"" of type '" "BYTE [177][177]""'"); + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "BYTE [177][177]","m_byModuleData", 2, argv[0] )); } arg2 = reinterpret_cast< BYTE (*)[177] >(argp2); { @@ -3274,9 +3558,9 @@ _wrap_CQR_Encode_m_byModuleData_set(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_CQR_Encode_m_byModuleData_get(int argc, VALUE *argv, VALUE self) { CQR_Encode *arg1 = (CQR_Encode *) 0 ; - BYTE (*result)[177] = 0 ; void *argp1 = 0 ; int res1 = 0 ; + BYTE (*result)[177] = 0 ; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { @@ -3284,7 +3568,7 @@ _wrap_CQR_Encode_m_byModuleData_get(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CQR_Encode, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "m_byModuleData" "', argument " "1"" of type '" "CQR_Encode *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CQR_Encode *","m_byModuleData", 1, self )); } arg1 = reinterpret_cast< CQR_Encode * >(argp1); result = (BYTE (*)[177])(BYTE (*)[177]) ((arg1)->m_byModuleData); @@ -3304,7 +3588,6 @@ _wrap_CQR_Encode_EncodeData__SWIG_0(int argc, VALUE *argv, VALUE self) { int arg5 ; LPCSTR arg6 = (LPCSTR) 0 ; int arg7 ; - BOOL result; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -3320,6 +3603,7 @@ _wrap_CQR_Encode_EncodeData__SWIG_0(int argc, VALUE *argv, VALUE self) { int alloc6 = 0 ; int val7 ; int ecode7 = 0 ; + BOOL result; VALUE vresult = Qnil; if ((argc < 6) || (argc > 6)) { @@ -3327,37 +3611,37 @@ _wrap_CQR_Encode_EncodeData__SWIG_0(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CQR_Encode, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EncodeData" "', argument " "1"" of type '" "CQR_Encode *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CQR_Encode *","EncodeData", 1, self )); } arg1 = reinterpret_cast< CQR_Encode * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EncodeData" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","EncodeData", 2, argv[0] )); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(argv[1], &val3); if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EncodeData" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","EncodeData", 3, argv[1] )); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_bool(argv[2], &val4); if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EncodeData" "', argument " "4"" of type '" "BOOL""'"); + SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "BOOL","EncodeData", 4, argv[2] )); } arg4 = static_cast< BOOL >(val4); ecode5 = SWIG_AsVal_int(argv[3], &val5); if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EncodeData" "', argument " "5"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "int","EncodeData", 5, argv[3] )); } arg5 = static_cast< int >(val5); res6 = SWIG_AsCharPtrAndSize(argv[4], &buf6, NULL, &alloc6); if (!SWIG_IsOK(res6)) { - SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "EncodeData" "', argument " "6"" of type '" "LPCSTR""'"); + SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "LPCSTR","EncodeData", 6, argv[4] )); } arg6 = reinterpret_cast< LPCSTR >(buf6); ecode7 = SWIG_AsVal_int(argv[5], &val7); if (!SWIG_IsOK(ecode7)) { - SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "EncodeData" "', argument " "7"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode7), Ruby_Format_TypeError( "", "int","EncodeData", 7, argv[5] )); } arg7 = static_cast< int >(val7); result = (BOOL)(arg1)->EncodeData(arg2,arg3,arg4,arg5,arg6,arg7); @@ -3378,7 +3662,6 @@ _wrap_CQR_Encode_EncodeData__SWIG_1(int argc, VALUE *argv, VALUE self) { BOOL arg4 ; int arg5 ; LPCSTR arg6 = (LPCSTR) 0 ; - BOOL result; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -3392,6 +3675,7 @@ _wrap_CQR_Encode_EncodeData__SWIG_1(int argc, VALUE *argv, VALUE self) { int res6 ; char *buf6 = 0 ; int alloc6 = 0 ; + BOOL result; VALUE vresult = Qnil; if ((argc < 5) || (argc > 5)) { @@ -3399,32 +3683,32 @@ _wrap_CQR_Encode_EncodeData__SWIG_1(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CQR_Encode, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EncodeData" "', argument " "1"" of type '" "CQR_Encode *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "CQR_Encode *","EncodeData", 1, self )); } arg1 = reinterpret_cast< CQR_Encode * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EncodeData" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","EncodeData", 2, argv[0] )); } arg2 = static_cast< int >(val2); ecode3 = SWIG_AsVal_int(argv[1], &val3); if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EncodeData" "', argument " "3"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","EncodeData", 3, argv[1] )); } arg3 = static_cast< int >(val3); ecode4 = SWIG_AsVal_bool(argv[2], &val4); if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "EncodeData" "', argument " "4"" of type '" "BOOL""'"); + SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "BOOL","EncodeData", 4, argv[2] )); } arg4 = static_cast< BOOL >(val4); ecode5 = SWIG_AsVal_int(argv[3], &val5); if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "EncodeData" "', argument " "5"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "int","EncodeData", 5, argv[3] )); } arg5 = static_cast< int >(val5); res6 = SWIG_AsCharPtrAndSize(argv[4], &buf6, NULL, &alloc6); if (!SWIG_IsOK(res6)) { - SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "EncodeData" "', argument " "6"" of type '" "LPCSTR""'"); + SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "LPCSTR","EncodeData", 6, argv[4] )); } arg6 = reinterpret_cast< LPCSTR >(buf6); result = (BOOL)(arg1)->EncodeData(arg2,arg3,arg4,arg5,arg6); @@ -3445,7 +3729,7 @@ SWIGINTERN VALUE _wrap_CQR_Encode_EncodeData(int nargs, VALUE *args, VALUE self) argc = nargs + 1; argv[0] = self; if (argc > 8) SWIG_fail; - for (ii = 1; (ii < argc); ii++) { + for (ii = 1; (ii < argc); ++ii) { argv[ii] = args[ii-1]; } if (argc == 6) { @@ -3530,7 +3814,10 @@ SWIGINTERN VALUE _wrap_CQR_Encode_EncodeData(int nargs, VALUE *args, VALUE self) } fail: - rb_raise(rb_eArgError, "No matching function for overloaded 'CQR_Encode_EncodeData'"); + Ruby_Format_OverloadedError( argc, 8, "CQR_Encode.EncodeData", + " BOOL CQR_Encode.EncodeData(int nLevel, int nVersion, BOOL bAutoExtent, int nMaskingNo, LPCSTR lpsSource, int ncSource)\n" + " BOOL CQR_Encode.EncodeData(int nLevel, int nVersion, BOOL bAutoExtent, int nMaskingNo, LPCSTR lpsSource)\n"); + return Qnil; } @@ -3538,16 +3825,16 @@ SWIGINTERN VALUE _wrap_CQR_Encode_EncodeData(int nargs, VALUE *args, VALUE self) /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ -static void *_p_QRDrawPNGTo_p_QRDraw(void *x) { +static void *_p_QRDrawPNGTo_p_QRDraw(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((QRDraw *) ((QRDrawPNG *) x)); } -static void *_p_QRDrawTIFFTo_p_QRDraw(void *x) { +static void *_p_QRDrawTIFFTo_p_QRDraw(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((QRDraw *) ((QRDrawTIFF *) x)); } -static void *_p_QRDrawJPEGTo_p_QRDraw(void *x) { +static void *_p_QRDrawJPEGTo_p_QRDraw(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((QRDraw *) ((QRDrawJPEG *) x)); } -static void *_p_QRDrawPSTo_p_QRDraw(void *x) { +static void *_p_QRDrawPSTo_p_QRDraw(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((QRDraw *) ((QRDrawPS *) x)); } static swig_type_info _swigt__p_CQR_Encode = {"_p_CQR_Encode", "CQR_Encode *", 0, 0, (void*)0, 0}; @@ -3557,13 +3844,13 @@ static swig_type_info _swigt__p_QRDrawPNG = {"_p_QRDrawPNG", "QRDrawPNG *", 0, 0 static swig_type_info _swigt__p_QRDrawPS = {"_p_QRDrawPS", "QRDrawPS *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_QRDrawTIFF = {"_p_QRDrawTIFF", "QRDrawTIFF *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_a_177__unsigned_char = {"_p_a_177__unsigned_char", "unsigned char (*)[177]|BYTE (*)[177]", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_bool = {"_p_bool", "bool *|BOOL *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_bool = {"_p_bool", "BOOL *|bool *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_tagQR_VERSIONINFO = {"_p_tagQR_VERSIONINFO", "tagQR_VERSIONINFO *|QR_VERSIONINFO *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_tagRS_BLOCKINFO = {"_p_tagRS_BLOCKINFO", "tagRS_BLOCKINFO *|RS_BLOCKINFO *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|BYTE *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|WORD *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "WORD *|unsigned short *", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_CQR_Encode, @@ -3674,7 +3961,7 @@ SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; - int found; + int found, init; clientdata = clientdata; @@ -3684,6 +3971,9 @@ SWIG_InitializeModule(void *clientdata) { swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; + init = 1; + } else { + init = 0; } /* Try and load any already created modules */ @@ -3712,6 +4002,12 @@ SWIG_InitializeModule(void *clientdata) { module_head->next = &swig_module; } + /* When multiple interpeters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); @@ -3845,7 +4141,9 @@ SWIG_PropagateClientData(void) { } #endif +/* +*/ #ifdef __cplusplus extern "C" #endif @@ -3861,53 +4159,56 @@ SWIGEXPORT void Init_QR(void) { } SWIG_RubyInitializeTrackings(); + rb_define_const(mQR, "TRUE", SWIG_From_bool(static_cast< bool >(true))); + rb_define_const(mQR, "FALSE", SWIG_From_bool(static_cast< bool >(false))); rb_define_const(mQR, "MARGIN_SIZE", SWIG_From_int(static_cast< int >(4))); rb_define_const(mQR, "MAX_MODULESIZE", SWIG_From_int(static_cast< int >(177))); - cQRDraw.klass = rb_define_class_under(mQR, "QRDraw", rb_cObject); - SWIG_TypeClientData(SWIGTYPE_p_QRDraw, (void *) &cQRDraw); - rb_undef_alloc_func(cQRDraw.klass); - rb_define_method(cQRDraw.klass, "setup", VALUEFUNC(_wrap_QRDraw_setup), -1); - rb_define_method(cQRDraw.klass, "draw", VALUEFUNC(_wrap_QRDraw_draw), -1); - cQRDraw.mark = 0; - cQRDraw.destroy = (void (*)(void *)) free_QRDraw; - cQRDraw.trackObjects = 0; - - cQRDrawJPEG.klass = rb_define_class_under(mQR, "QRDrawJPEG", ((swig_class *) SWIGTYPE_p_QRDraw->clientdata)->klass); - SWIG_TypeClientData(SWIGTYPE_p_QRDrawJPEG, (void *) &cQRDrawJPEG); - rb_define_alloc_func(cQRDrawJPEG.klass, _wrap_QRDrawJPEG_allocate); - rb_define_method(cQRDrawJPEG.klass, "initialize", VALUEFUNC(_wrap_new_QRDrawJPEG), -1); - rb_define_method(cQRDrawJPEG.klass, "draw", VALUEFUNC(_wrap_QRDrawJPEG_draw), -1); - cQRDrawJPEG.mark = 0; - cQRDrawJPEG.destroy = (void (*)(void *)) free_QRDrawJPEG; - cQRDrawJPEG.trackObjects = 0; - - cQRDrawPNG.klass = rb_define_class_under(mQR, "QRDrawPNG", ((swig_class *) SWIGTYPE_p_QRDraw->clientdata)->klass); - SWIG_TypeClientData(SWIGTYPE_p_QRDrawPNG, (void *) &cQRDrawPNG); - rb_define_alloc_func(cQRDrawPNG.klass, _wrap_QRDrawPNG_allocate); - rb_define_method(cQRDrawPNG.klass, "initialize", VALUEFUNC(_wrap_new_QRDrawPNG), -1); - rb_define_method(cQRDrawPNG.klass, "draw", VALUEFUNC(_wrap_QRDrawPNG_draw), -1); - cQRDrawPNG.mark = 0; - cQRDrawPNG.destroy = (void (*)(void *)) free_QRDrawPNG; - cQRDrawPNG.trackObjects = 0; - - cQRDrawPS.klass = rb_define_class_under(mQR, "QRDrawPS", ((swig_class *) SWIGTYPE_p_QRDraw->clientdata)->klass); - SWIG_TypeClientData(SWIGTYPE_p_QRDrawPS, (void *) &cQRDrawPS); - rb_define_alloc_func(cQRDrawPS.klass, _wrap_QRDrawPS_allocate); - rb_define_method(cQRDrawPS.klass, "initialize", VALUEFUNC(_wrap_new_QRDrawPS), -1); - rb_define_method(cQRDrawPS.klass, "draw", VALUEFUNC(_wrap_QRDrawPS_draw), -1); - cQRDrawPS.mark = 0; - cQRDrawPS.destroy = (void (*)(void *)) free_QRDrawPS; - cQRDrawPS.trackObjects = 0; - - cQRDrawTIFF.klass = rb_define_class_under(mQR, "QRDrawTIFF", ((swig_class *) SWIGTYPE_p_QRDraw->clientdata)->klass); - SWIG_TypeClientData(SWIGTYPE_p_QRDrawTIFF, (void *) &cQRDrawTIFF); - rb_define_alloc_func(cQRDrawTIFF.klass, _wrap_QRDrawTIFF_allocate); - rb_define_method(cQRDrawTIFF.klass, "initialize", VALUEFUNC(_wrap_new_QRDrawTIFF), -1); - rb_define_method(cQRDrawTIFF.klass, "draw", VALUEFUNC(_wrap_QRDrawTIFF_draw), -1); - cQRDrawTIFF.mark = 0; - cQRDrawTIFF.destroy = (void (*)(void *)) free_QRDrawTIFF; - cQRDrawTIFF.trackObjects = 0; + SwigClassQRDraw.klass = rb_define_class_under(mQR, "QRDraw", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_QRDraw, (void *) &SwigClassQRDraw); + rb_undef_alloc_func(SwigClassQRDraw.klass); + rb_define_method(SwigClassQRDraw.klass, "setup", VALUEFUNC(_wrap_QRDraw_setup), -1); + rb_define_method(SwigClassQRDraw.klass, "draw", VALUEFUNC(_wrap_QRDraw_draw), -1); + rb_define_method(SwigClassQRDraw.klass, "close", VALUEFUNC(_wrap_QRDraw_close), -1); + SwigClassQRDraw.mark = 0; + SwigClassQRDraw.destroy = (void (*)(void *)) free_QRDraw; + SwigClassQRDraw.trackObjects = 0; + + SwigClassQRDrawJPEG.klass = rb_define_class_under(mQR, "QRDrawJPEG", ((swig_class *) SWIGTYPE_p_QRDraw->clientdata)->klass); + SWIG_TypeClientData(SWIGTYPE_p_QRDrawJPEG, (void *) &SwigClassQRDrawJPEG); + rb_define_alloc_func(SwigClassQRDrawJPEG.klass, _wrap_QRDrawJPEG_allocate); + rb_define_method(SwigClassQRDrawJPEG.klass, "initialize", VALUEFUNC(_wrap_new_QRDrawJPEG), -1); + rb_define_method(SwigClassQRDrawJPEG.klass, "draw", VALUEFUNC(_wrap_QRDrawJPEG_draw), -1); + SwigClassQRDrawJPEG.mark = 0; + SwigClassQRDrawJPEG.destroy = (void (*)(void *)) free_QRDrawJPEG; + SwigClassQRDrawJPEG.trackObjects = 0; + + SwigClassQRDrawPNG.klass = rb_define_class_under(mQR, "QRDrawPNG", ((swig_class *) SWIGTYPE_p_QRDraw->clientdata)->klass); + SWIG_TypeClientData(SWIGTYPE_p_QRDrawPNG, (void *) &SwigClassQRDrawPNG); + rb_define_alloc_func(SwigClassQRDrawPNG.klass, _wrap_QRDrawPNG_allocate); + rb_define_method(SwigClassQRDrawPNG.klass, "initialize", VALUEFUNC(_wrap_new_QRDrawPNG), -1); + rb_define_method(SwigClassQRDrawPNG.klass, "draw", VALUEFUNC(_wrap_QRDrawPNG_draw), -1); + SwigClassQRDrawPNG.mark = 0; + SwigClassQRDrawPNG.destroy = (void (*)(void *)) free_QRDrawPNG; + SwigClassQRDrawPNG.trackObjects = 0; + + SwigClassQRDrawPS.klass = rb_define_class_under(mQR, "QRDrawPS", ((swig_class *) SWIGTYPE_p_QRDraw->clientdata)->klass); + SWIG_TypeClientData(SWIGTYPE_p_QRDrawPS, (void *) &SwigClassQRDrawPS); + rb_define_alloc_func(SwigClassQRDrawPS.klass, _wrap_QRDrawPS_allocate); + rb_define_method(SwigClassQRDrawPS.klass, "initialize", VALUEFUNC(_wrap_new_QRDrawPS), -1); + rb_define_method(SwigClassQRDrawPS.klass, "draw", VALUEFUNC(_wrap_QRDrawPS_draw), -1); + SwigClassQRDrawPS.mark = 0; + SwigClassQRDrawPS.destroy = (void (*)(void *)) free_QRDrawPS; + SwigClassQRDrawPS.trackObjects = 0; + + SwigClassQRDrawTIFF.klass = rb_define_class_under(mQR, "QRDrawTIFF", ((swig_class *) SWIGTYPE_p_QRDraw->clientdata)->klass); + SWIG_TypeClientData(SWIGTYPE_p_QRDrawTIFF, (void *) &SwigClassQRDrawTIFF); + rb_define_alloc_func(SwigClassQRDrawTIFF.klass, _wrap_QRDrawTIFF_allocate); + rb_define_method(SwigClassQRDrawTIFF.klass, "initialize", VALUEFUNC(_wrap_new_QRDrawTIFF), -1); + rb_define_method(SwigClassQRDrawTIFF.klass, "draw", VALUEFUNC(_wrap_QRDrawTIFF_draw), -1); + SwigClassQRDrawTIFF.mark = 0; + SwigClassQRDrawTIFF.destroy = (void (*)(void *)) free_QRDrawTIFF; + SwigClassQRDrawTIFF.trackObjects = 0; rb_define_const(mQR, "QR_LEVEL_L", SWIG_From_int(static_cast< int >(0))); rb_define_const(mQR, "QR_LEVEL_M", SWIG_From_int(static_cast< int >(1))); rb_define_const(mQR, "QR_LEVEL_Q", SWIG_From_int(static_cast< int >(2))); @@ -3924,61 +4225,61 @@ SWIGEXPORT void Init_QR(void) { rb_define_const(mQR, "MAX_CODEBLOCK", SWIG_From_int(static_cast< int >(153))); rb_define_const(mQR, "QR_MARGIN", SWIG_From_int(static_cast< int >(4))); - cRS_BLOCKINFO.klass = rb_define_class_under(mQR, "RS_BLOCKINFO", rb_cObject); - SWIG_TypeClientData(SWIGTYPE_p_tagRS_BLOCKINFO, (void *) &cRS_BLOCKINFO); - rb_define_alloc_func(cRS_BLOCKINFO.klass, _wrap_RS_BLOCKINFO_allocate); - rb_define_method(cRS_BLOCKINFO.klass, "initialize", VALUEFUNC(_wrap_new_RS_BLOCKINFO), -1); - rb_define_method(cRS_BLOCKINFO.klass, "ncRSBlock=", VALUEFUNC(_wrap_RS_BLOCKINFO_ncRSBlock_set), -1); - rb_define_method(cRS_BLOCKINFO.klass, "ncRSBlock", VALUEFUNC(_wrap_RS_BLOCKINFO_ncRSBlock_get), -1); - rb_define_method(cRS_BLOCKINFO.klass, "ncAllCodeWord=", VALUEFUNC(_wrap_RS_BLOCKINFO_ncAllCodeWord_set), -1); - rb_define_method(cRS_BLOCKINFO.klass, "ncAllCodeWord", VALUEFUNC(_wrap_RS_BLOCKINFO_ncAllCodeWord_get), -1); - rb_define_method(cRS_BLOCKINFO.klass, "ncDataCodeWord=", VALUEFUNC(_wrap_RS_BLOCKINFO_ncDataCodeWord_set), -1); - rb_define_method(cRS_BLOCKINFO.klass, "ncDataCodeWord", VALUEFUNC(_wrap_RS_BLOCKINFO_ncDataCodeWord_get), -1); - cRS_BLOCKINFO.mark = 0; - cRS_BLOCKINFO.destroy = (void (*)(void *)) free_RS_BLOCKINFO; - cRS_BLOCKINFO.trackObjects = 0; - - cQR_VERSIONINFO.klass = rb_define_class_under(mQR, "QR_VERSIONINFO", rb_cObject); - SWIG_TypeClientData(SWIGTYPE_p_tagQR_VERSIONINFO, (void *) &cQR_VERSIONINFO); - rb_define_alloc_func(cQR_VERSIONINFO.klass, _wrap_QR_VERSIONINFO_allocate); - rb_define_method(cQR_VERSIONINFO.klass, "initialize", VALUEFUNC(_wrap_new_QR_VERSIONINFO), -1); - rb_define_method(cQR_VERSIONINFO.klass, "nVersionNo=", VALUEFUNC(_wrap_QR_VERSIONINFO_nVersionNo_set), -1); - rb_define_method(cQR_VERSIONINFO.klass, "nVersionNo", VALUEFUNC(_wrap_QR_VERSIONINFO_nVersionNo_get), -1); - rb_define_method(cQR_VERSIONINFO.klass, "ncAllCodeWord=", VALUEFUNC(_wrap_QR_VERSIONINFO_ncAllCodeWord_set), -1); - rb_define_method(cQR_VERSIONINFO.klass, "ncAllCodeWord", VALUEFUNC(_wrap_QR_VERSIONINFO_ncAllCodeWord_get), -1); - rb_define_method(cQR_VERSIONINFO.klass, "ncDataCodeWord=", VALUEFUNC(_wrap_QR_VERSIONINFO_ncDataCodeWord_set), -1); - rb_define_method(cQR_VERSIONINFO.klass, "ncDataCodeWord", VALUEFUNC(_wrap_QR_VERSIONINFO_ncDataCodeWord_get), -1); - rb_define_method(cQR_VERSIONINFO.klass, "ncAlignPoint=", VALUEFUNC(_wrap_QR_VERSIONINFO_ncAlignPoint_set), -1); - rb_define_method(cQR_VERSIONINFO.klass, "ncAlignPoint", VALUEFUNC(_wrap_QR_VERSIONINFO_ncAlignPoint_get), -1); - rb_define_method(cQR_VERSIONINFO.klass, "nAlignPoint=", VALUEFUNC(_wrap_QR_VERSIONINFO_nAlignPoint_set), -1); - rb_define_method(cQR_VERSIONINFO.klass, "nAlignPoint", VALUEFUNC(_wrap_QR_VERSIONINFO_nAlignPoint_get), -1); - rb_define_method(cQR_VERSIONINFO.klass, "RS_BlockInfo1=", VALUEFUNC(_wrap_QR_VERSIONINFO_RS_BlockInfo1_set), -1); - rb_define_method(cQR_VERSIONINFO.klass, "RS_BlockInfo1", VALUEFUNC(_wrap_QR_VERSIONINFO_RS_BlockInfo1_get), -1); - rb_define_method(cQR_VERSIONINFO.klass, "RS_BlockInfo2=", VALUEFUNC(_wrap_QR_VERSIONINFO_RS_BlockInfo2_set), -1); - rb_define_method(cQR_VERSIONINFO.klass, "RS_BlockInfo2", VALUEFUNC(_wrap_QR_VERSIONINFO_RS_BlockInfo2_get), -1); - cQR_VERSIONINFO.mark = 0; - cQR_VERSIONINFO.destroy = (void (*)(void *)) free_QR_VERSIONINFO; - cQR_VERSIONINFO.trackObjects = 0; - - cCQR_Encode.klass = rb_define_class_under(mQR, "CQR_Encode", rb_cObject); - SWIG_TypeClientData(SWIGTYPE_p_CQR_Encode, (void *) &cCQR_Encode); - rb_define_alloc_func(cCQR_Encode.klass, _wrap_CQR_Encode_allocate); - rb_define_method(cCQR_Encode.klass, "initialize", VALUEFUNC(_wrap_new_CQR_Encode), -1); - rb_define_method(cCQR_Encode.klass, "m_nLevel=", VALUEFUNC(_wrap_CQR_Encode_m_nLevel_set), -1); - rb_define_method(cCQR_Encode.klass, "m_nLevel", VALUEFUNC(_wrap_CQR_Encode_m_nLevel_get), -1); - rb_define_method(cCQR_Encode.klass, "m_nVersion=", VALUEFUNC(_wrap_CQR_Encode_m_nVersion_set), -1); - rb_define_method(cCQR_Encode.klass, "m_nVersion", VALUEFUNC(_wrap_CQR_Encode_m_nVersion_get), -1); - rb_define_method(cCQR_Encode.klass, "m_bAutoExtent=", VALUEFUNC(_wrap_CQR_Encode_m_bAutoExtent_set), -1); - rb_define_method(cCQR_Encode.klass, "m_bAutoExtent", VALUEFUNC(_wrap_CQR_Encode_m_bAutoExtent_get), -1); - rb_define_method(cCQR_Encode.klass, "m_nMaskingNo=", VALUEFUNC(_wrap_CQR_Encode_m_nMaskingNo_set), -1); - rb_define_method(cCQR_Encode.klass, "m_nMaskingNo", VALUEFUNC(_wrap_CQR_Encode_m_nMaskingNo_get), -1); - rb_define_method(cCQR_Encode.klass, "m_nSymbleSize=", VALUEFUNC(_wrap_CQR_Encode_m_nSymbleSize_set), -1); - rb_define_method(cCQR_Encode.klass, "m_nSymbleSize", VALUEFUNC(_wrap_CQR_Encode_m_nSymbleSize_get), -1); - rb_define_method(cCQR_Encode.klass, "m_byModuleData=", VALUEFUNC(_wrap_CQR_Encode_m_byModuleData_set), -1); - rb_define_method(cCQR_Encode.klass, "m_byModuleData", VALUEFUNC(_wrap_CQR_Encode_m_byModuleData_get), -1); - rb_define_method(cCQR_Encode.klass, "EncodeData", VALUEFUNC(_wrap_CQR_Encode_EncodeData), -1); - cCQR_Encode.mark = 0; - cCQR_Encode.destroy = (void (*)(void *)) free_CQR_Encode; - cCQR_Encode.trackObjects = 0; + SwigClassRS_BLOCKINFO.klass = rb_define_class_under(mQR, "RS_BLOCKINFO", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_tagRS_BLOCKINFO, (void *) &SwigClassRS_BLOCKINFO); + rb_define_alloc_func(SwigClassRS_BLOCKINFO.klass, _wrap_RS_BLOCKINFO_allocate); + rb_define_method(SwigClassRS_BLOCKINFO.klass, "initialize", VALUEFUNC(_wrap_new_RS_BLOCKINFO), -1); + rb_define_method(SwigClassRS_BLOCKINFO.klass, "ncRSBlock=", VALUEFUNC(_wrap_RS_BLOCKINFO_ncRSBlock_set), -1); + rb_define_method(SwigClassRS_BLOCKINFO.klass, "ncRSBlock", VALUEFUNC(_wrap_RS_BLOCKINFO_ncRSBlock_get), -1); + rb_define_method(SwigClassRS_BLOCKINFO.klass, "ncAllCodeWord=", VALUEFUNC(_wrap_RS_BLOCKINFO_ncAllCodeWord_set), -1); + rb_define_method(SwigClassRS_BLOCKINFO.klass, "ncAllCodeWord", VALUEFUNC(_wrap_RS_BLOCKINFO_ncAllCodeWord_get), -1); + rb_define_method(SwigClassRS_BLOCKINFO.klass, "ncDataCodeWord=", VALUEFUNC(_wrap_RS_BLOCKINFO_ncDataCodeWord_set), -1); + rb_define_method(SwigClassRS_BLOCKINFO.klass, "ncDataCodeWord", VALUEFUNC(_wrap_RS_BLOCKINFO_ncDataCodeWord_get), -1); + SwigClassRS_BLOCKINFO.mark = 0; + SwigClassRS_BLOCKINFO.destroy = (void (*)(void *)) free_RS_BLOCKINFO; + SwigClassRS_BLOCKINFO.trackObjects = 0; + + SwigClassQR_VERSIONINFO.klass = rb_define_class_under(mQR, "QR_VERSIONINFO", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_tagQR_VERSIONINFO, (void *) &SwigClassQR_VERSIONINFO); + rb_define_alloc_func(SwigClassQR_VERSIONINFO.klass, _wrap_QR_VERSIONINFO_allocate); + rb_define_method(SwigClassQR_VERSIONINFO.klass, "initialize", VALUEFUNC(_wrap_new_QR_VERSIONINFO), -1); + rb_define_method(SwigClassQR_VERSIONINFO.klass, "nVersionNo=", VALUEFUNC(_wrap_QR_VERSIONINFO_nVersionNo_set), -1); + rb_define_method(SwigClassQR_VERSIONINFO.klass, "nVersionNo", VALUEFUNC(_wrap_QR_VERSIONINFO_nVersionNo_get), -1); + rb_define_method(SwigClassQR_VERSIONINFO.klass, "ncAllCodeWord=", VALUEFUNC(_wrap_QR_VERSIONINFO_ncAllCodeWord_set), -1); + rb_define_method(SwigClassQR_VERSIONINFO.klass, "ncAllCodeWord", VALUEFUNC(_wrap_QR_VERSIONINFO_ncAllCodeWord_get), -1); + rb_define_method(SwigClassQR_VERSIONINFO.klass, "ncDataCodeWord=", VALUEFUNC(_wrap_QR_VERSIONINFO_ncDataCodeWord_set), -1); + rb_define_method(SwigClassQR_VERSIONINFO.klass, "ncDataCodeWord", VALUEFUNC(_wrap_QR_VERSIONINFO_ncDataCodeWord_get), -1); + rb_define_method(SwigClassQR_VERSIONINFO.klass, "ncAlignPoint=", VALUEFUNC(_wrap_QR_VERSIONINFO_ncAlignPoint_set), -1); + rb_define_method(SwigClassQR_VERSIONINFO.klass, "ncAlignPoint", VALUEFUNC(_wrap_QR_VERSIONINFO_ncAlignPoint_get), -1); + rb_define_method(SwigClassQR_VERSIONINFO.klass, "nAlignPoint=", VALUEFUNC(_wrap_QR_VERSIONINFO_nAlignPoint_set), -1); + rb_define_method(SwigClassQR_VERSIONINFO.klass, "nAlignPoint", VALUEFUNC(_wrap_QR_VERSIONINFO_nAlignPoint_get), -1); + rb_define_method(SwigClassQR_VERSIONINFO.klass, "RS_BlockInfo1=", VALUEFUNC(_wrap_QR_VERSIONINFO_RS_BlockInfo1_set), -1); + rb_define_method(SwigClassQR_VERSIONINFO.klass, "RS_BlockInfo1", VALUEFUNC(_wrap_QR_VERSIONINFO_RS_BlockInfo1_get), -1); + rb_define_method(SwigClassQR_VERSIONINFO.klass, "RS_BlockInfo2=", VALUEFUNC(_wrap_QR_VERSIONINFO_RS_BlockInfo2_set), -1); + rb_define_method(SwigClassQR_VERSIONINFO.klass, "RS_BlockInfo2", VALUEFUNC(_wrap_QR_VERSIONINFO_RS_BlockInfo2_get), -1); + SwigClassQR_VERSIONINFO.mark = 0; + SwigClassQR_VERSIONINFO.destroy = (void (*)(void *)) free_QR_VERSIONINFO; + SwigClassQR_VERSIONINFO.trackObjects = 0; + + SwigClassCQR_Encode.klass = rb_define_class_under(mQR, "CQR_Encode", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_CQR_Encode, (void *) &SwigClassCQR_Encode); + rb_define_alloc_func(SwigClassCQR_Encode.klass, _wrap_CQR_Encode_allocate); + rb_define_method(SwigClassCQR_Encode.klass, "initialize", VALUEFUNC(_wrap_new_CQR_Encode), -1); + rb_define_method(SwigClassCQR_Encode.klass, "m_nLevel=", VALUEFUNC(_wrap_CQR_Encode_m_nLevel_set), -1); + rb_define_method(SwigClassCQR_Encode.klass, "m_nLevel", VALUEFUNC(_wrap_CQR_Encode_m_nLevel_get), -1); + rb_define_method(SwigClassCQR_Encode.klass, "m_nVersion=", VALUEFUNC(_wrap_CQR_Encode_m_nVersion_set), -1); + rb_define_method(SwigClassCQR_Encode.klass, "m_nVersion", VALUEFUNC(_wrap_CQR_Encode_m_nVersion_get), -1); + rb_define_method(SwigClassCQR_Encode.klass, "m_bAutoExtent=", VALUEFUNC(_wrap_CQR_Encode_m_bAutoExtent_set), -1); + rb_define_method(SwigClassCQR_Encode.klass, "m_bAutoExtent", VALUEFUNC(_wrap_CQR_Encode_m_bAutoExtent_get), -1); + rb_define_method(SwigClassCQR_Encode.klass, "m_nMaskingNo=", VALUEFUNC(_wrap_CQR_Encode_m_nMaskingNo_set), -1); + rb_define_method(SwigClassCQR_Encode.klass, "m_nMaskingNo", VALUEFUNC(_wrap_CQR_Encode_m_nMaskingNo_get), -1); + rb_define_method(SwigClassCQR_Encode.klass, "m_nSymbleSize=", VALUEFUNC(_wrap_CQR_Encode_m_nSymbleSize_set), -1); + rb_define_method(SwigClassCQR_Encode.klass, "m_nSymbleSize", VALUEFUNC(_wrap_CQR_Encode_m_nSymbleSize_get), -1); + rb_define_method(SwigClassCQR_Encode.klass, "m_byModuleData=", VALUEFUNC(_wrap_CQR_Encode_m_byModuleData_set), -1); + rb_define_method(SwigClassCQR_Encode.klass, "m_byModuleData", VALUEFUNC(_wrap_CQR_Encode_m_byModuleData_get), -1); + rb_define_method(SwigClassCQR_Encode.klass, "EncodeData", VALUEFUNC(_wrap_CQR_Encode_EncodeData), -1); + SwigClassCQR_Encode.mark = 0; + SwigClassCQR_Encode.destroy = (void (*)(void *)) free_CQR_Encode; + SwigClassCQR_Encode.trackObjects = 0; } diff --git a/lib/rqr/errors.rb b/lib/rqr/errors.rb index 924101b..b2b0e64 100644 --- a/lib/rqr/errors.rb +++ b/lib/rqr/errors.rb @@ -4,6 +4,8 @@ class EncodeException < Exception; end class FormatNotFoundException < Exception; end + class BlockNotFoundException < Exception; end + class ImageException < Exception; end end \ No newline at end of file diff --git a/lib/rqr/qrcode.rb b/lib/rqr/qrcode.rb index e080b0b..6836392 100644 --- a/lib/rqr/qrcode.rb +++ b/lib/rqr/qrcode.rb @@ -13,8 +13,16 @@ def initialize(options = {}) @options = { :level => 1, :version => 0, :auto_extend => true, :masking => -1, :eps_preview => false, :module_size => 4 } @options.merge!(options) + @imager = nil end + def self.create(options = {}) + raise BlockNotFoundException.new("Block not found!") unless block_given? + qrcode = RQR::QRCode.new(options) + yield qrcode + qrcode.close + end + # data:: data for qrcode # path:: path for qrcode image file # format:: image format. :jpg|:png|:tiff|:eps @@ -45,7 +53,7 @@ def save(data, path, format=nil) def close() @encoder = nil if @encoder - @imager = nil if @imager + (@imager.close; @imager = nil) if @imager end private diff --git a/lib/rqr/version.rb b/lib/rqr/version.rb index c711901..a89b9e6 100644 --- a/lib/rqr/version.rb +++ b/lib/rqr/version.rb @@ -1,8 +1,8 @@ -module Rqr #:nodoc: +module RQR #:nodoc: module VERSION #:nodoc: MAJOR = 0 - MINOR = 1 - TINY = 1 + MINOR = 2 + TINY = 5 STRING = [MAJOR, MINOR, TINY].join('.') end diff --git a/z-rqr.gemspec b/z-rqr.gemspec new file mode 100644 index 0000000..66120c7 --- /dev/null +++ b/z-rqr.gemspec @@ -0,0 +1,20 @@ +require File.expand_path('../lib/rqr/version', __FILE__) + +Gem::Specification.new do |s| + s.name = %q{z-rqr} + s.version = RQR::VERSION::STRING + s.authors = ["Ryota Maruko", "zzzhc"] + s.date = Time.now.utc.strftime("%Y-%m-%d") + s.email = %q{pools _at_ rubyforge _dot_ org} + s.extensions = ["ext/rqr/extconf.rb"] + s.extra_rdoc_files = [ + ] + s.files = `git ls-files`.split("\n") + s.homepage = %q{http://github.com/zzzhc/rqr} + s.rdoc_options = ["--charset=UTF-8"] + s.require_paths = ["lib", "ext"] + s.rubygems_version = %q{1.4.2} + s.summary = %q{A ruby library to create qrcode. Output: PS, JPEG, PNG, EPS, TIFF.} + s.test_files = `git ls-files spec examples`.split("\n") +end +