mecab-ruby-0.996/0000755002562000116100000000000012110211100012037 5ustar takuengmecab-ruby-0.996/LGPL0000644002562000116100000006347412110211100012536 0ustar takueng GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! mecab-ruby-0.996/extconf.rb0000644002562000116100000000046212110211100014034 0ustar takuengrequire 'mkmf' mecab_config = with_config('mecab-config', 'mecab-config') use_mecab_config = enable_config('mecab-config') `mecab-config --libs-only-l`.chomp.split.each { | lib | have_library(lib) } $CFLAGS += ' ' + `#{mecab_config} --cflags`.chomp have_header('mecab.h') && create_makefile('MeCab') mecab-ruby-0.996/README0000644002562000116100000000031612110211100012717 0ustar takuengMeCab ruby module $Id: README,v 1.1.1.1 2005/12/03 14:18:52 taku-ku Exp $; 1. Installation % ruby extconf.rb % make % su # make install 2. How to use? See 'test.rb' as a sample program. mecab-ruby-0.996/COPYING0000644002562000116100000000036012110211100013071 0ustar takuengMeCab is copyrighted free software by Taku Kudo and Nippon Telegraph and Telephone Corporation, and is released under any of the GPL (see the file GPL), the LGPL (see the file LGPL), or the BSD License (see the file BSD). mecab-ruby-0.996/AUTHORS0000644002562000116100000000003412110211100013104 0ustar takuengTaku Kudo mecab-ruby-0.996/bindings.html0000644002562000116100000002240112110211100014521 0ustar takueng スクリプト言語のバインディング

スクリプト言語のバインディング

概要

各種スクリプト言語 (perl, ruby, python, Java) から, MeCab が提供する形態素解析の機能を利用可能です. 各バインディングは SWIG というプログラ ムを用いて, 自動生成されています. SWIG がサポートする他の言語も 生成可能だと思われますが, 現在は, 作者の管理できる範囲内ということで, 上記の4つの言語のみを提供しております.

インストール

各言語バイディングのインストール方法は, perl/README, ruby/README, python/README, java/README を御覧下さい.

とりあえず解析する

MeCab::Tagger というクラスのインスタンスを生成し, parse (もしくは parseToString) というメソッドを呼ぶことで, 解析結果が文字列として取得できます. MeCab::Tagger のコンストラクタの引数は, 基本的に mecab の実行形式に与え るパラメータと同一で, それらを文字列として与えます.

perl

use MeCab;
$m = new MeCab::Tagger ("-Ochasen");
print $m->parse ("今日もしないとね");

ruby

require 'MeCab'
m = MeCab::Tagger.new ("-Ochasen")
print m.parse ("今日もしないとね")

python

import sys
import MeCab
m = MeCab.Tagger ("-Ochasen")
print m.parse ("今日もしないとね")

Java

import org.chasen.mecab.Tagger;
import org.chasen.mecab.Node
 public static void main(String[] argv) {
 Tagger tagger = new Tagger ("-Ochasen");
 System.out.println (tagger.parse ("太郎は二郎にこの本を渡した.")); 
}

各形態素の詳細情報を取得する

MeCab::Tagger クラスの, parseToNode という メソッドを呼ぶことで, 「文頭」という特別な形態素が MeCab::Node クラスのインスタンスとして 取得できます.

MeCab::Node は, 双方向リストとして表現されており, next, prev というメン バ変数があります. それぞれ, 次の形態素, 前の形態素を MeCab::Node クラスのインスタンスとして 返します. 全形態素には, next を順次呼ぶことでアクセスできます.

MeCab::Node は C 言語のインタフェイスで提供している mecab_node_t をラッ プしたクラスです. mecab_node_t が持つほぼすべてのメンバ変数にアクセスす ることができます. ただし, surface のみ, 単語そのものが返るように変更して います.

以下に perl の例を示します. この例では, 各形態素を順次にアクセスし,形態素の表層文字列, 品詞, その形態素までのコストを表示します.

use MeCab;
my $m = new MeCab::Tagger ("");

for (my $n = $m->parseToNode ("今日もしないとね"); $n ; $n = $n->{next}) {
   printf ("%s\t%s\t%d\n",
            $n->{surface},          # 表層
	    $n->{feature},          # 現在の品詞
	    $n->{cost}              # その形態素までのコスト
	    );
}

エラー処理

もし, コンストラクタや, 解析途中でエラーが起きた場合は, RuntimeError 例外が発生します. 例外のハンドリングの方法は, 各言語のリファレンスマニュアルを ごらんください. 以下は, python の例です

try:
    m = MeCab.Tagger ("-d .")
    print m.parse ("今日もしないとね")
except RuntimeError, e:
    print "RuntimeError:", e;

注意事項

文頭,文末形態素

parseToNode の返り値は, 「文頭」という特別な形態素を示す MeCab::Node インタンスです. さらに, 「文末」という特別な形態素も存在いたしますので, 注意してください. もし, これらを無視したい場合は, 以下のように next でそれぞれを読み飛ばしてください.

my $n = $m->parseToNode ("今日もしないとね"); 
$n = $n->{next}; # 「文頭」を無視

while ($n->{next}) { # next を調べる
  printf ("%s\n", $n->{surface});
  $n = $n->{next}; # 次に移動
}

MeCab::Node の振舞い

MeCab::Node の実体(メモリ上にある形態素情報)は, MeCab::Tagger インスタンスが管理しています. MeCab::Node は, Node の実体を指している参照にすぎせん. そのために, parseToNode が 呼ばれる度に, 実体そのものが, 上書きされていきます. 以下のような例はソースの意図する通りには動きません.

m = MeCab.Tagger ("")
n1 = m.parseToNode ("今日もしないとね") 
n2 = m.parseToNode ("さくさくさくら")

# n1 の内容は無効になっている
while (n1.hasNode () != 0):
   print n1.getSurface ()
   n1 = n1.next ()

上記の例では, n1 の指す中身が, 「さくさくさくら」を解析した時点で 上書きされており, 使用できなくなっています.

複数の Node を同時にアクセスしたい場合は, 複数の MeCab::Tagger インスタンスを生成してください.

全メソッド

以下に, SWIG用のインタフェースファイル の一部を示します. バイディングの実装言語の都合上, C++ のシンタックスで 表記されていますが, 適宜読みかえてください. また, 各メソッドの動作も添え ていますので参考にしてください.

namespace MeCab {

  class Tagger {

     // str を解析して文字列として結果を得ます. len は str の長さ(省略可能)
     string parse(string str, int len);
  
     // parse と同じ
     string parseToString(string str, int len);
  
     // str を解析して MeCab::Node 型の形態素を返します. 
     // この形態素は文頭を示すもので, next を順に辿ることで全形態素にアクセスできます
     Node parseToNode(string str, int len);
  
     // parse の Nbest 版です. N に nbest の個数を指定します.
     // この機能を使う場合は, 起動時オプションとして -l 1 を指定する必要があります
     string parseNBest(int N, string str, int len);
  
     // 解析結果を, 確からしいものから順番に取得する場合にこの関数で初期化を行います.
     bool  parseNBestInit(string str, int len);
  
     // parseNbestInit() の後, この関数を順次呼ぶことで, 確からしい解析結果を, 順番に取得できます.
     string next();
  
     // next() と同じですが, MeCab::Node を返します.
     Node  nextNode();
  };
  
  #define MECAB_NOR_NODE  0
  #define MECAB_UNK_NODE  1
  #define MECAB_BOS_NODE  2
  #define MECAB_EOS_NODE  3
  
  struct Node {

    struct Node  prev;  // 一つ前の形態素へのポインタ
    struct Node  next;  // 一つ先の形態素へのポインタ
    
    struct Node  enext; // 同じ位置で終わる形態素へのポインタ
    struct Node  bnext; // 同じ開始位置で始まる形態素へのポインタ
  
    string surface;             // 形態素の文字列情報 
  			      
    string feature;             // CSV で表記された素性情報
    unsigned int   length;      // 形態素の長さ
    unsigned int   rlength;     // 形態素の長さ(先頭のスペースを含む)
    unsigned int   id;          // 形態素に付与される ユニークID
    unsigned short rcAttr;      // 右文脈 id 
    unsigned short lcAttr;      // 左文脈 id
    unsigned short posid;       // 形態素 ID (未使用)
    unsigned char  char_type;   // 文字種情報
    unsigned char  stat;        // 形態素の種類: 以下のマクロの値
                                // #define MECAB_NOR_NODE  0
                                // #define MECAB_UNK_NODE  1
                                // #define MECAB_BOS_NODE  2
                                // #define MECAB_EOS_NODE  3
    unsigned char  isbest;      // ベスト解の場合 1, それ以外 0
  
    float          alpha;       // forward backward の foward log 確率
    float          beta;        // forward backward の backward log 確率 
    float          prob;        // 周辺確率
                                // alpha, beta, prob は -l 2 オプションを指定した時に定義されます
  
    short          wcost;       // 単語生起コスト
    long           cost;        // 累積コスト
  };
}

サンプルプログラム

perl/test.pl, ruby/test.rb, python/test.py, java/test.java にそれぞれの言語のサンプルがありますので, 参考にしてください.

mecab-ruby-0.996/mecab-ruby.gemspec0000644002562000116100000000102112110211100015424 0ustar takuengGem::Specification.new do |s| s.name = %q{mecab-ruby} s.version = '0.99' s.author = 'Taku Kudo' s.date = '2011-12-24' s.description = <<-EOF Ruby bindings for MeCab, a morphological analyzer. EOF s.email = 'taku@chasen.org' s.extensions = [ 'extconf.rb' ] s.files = [ 'AUTHORS', 'BSD', 'COPYING', 'GPL', 'LGPL', 'MeCab_wrap.cpp', 'README', 'bindings.html', 'extconf.rb', 'mecab-ruby.gemspec', 'test.rb' ] s.has_rdoc = false s.homepage = 'http://mecab.sourceforge.net/' s.summary = 'Ruby bindings for MeCab.' end mecab-ruby-0.996/GPL0000644002562000116100000004313112110211100012406 0ustar takueng GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. mecab-ruby-0.996/BSD0000644002562000116100000000310212110211100012366 0ustar takuengCopyright (c) 2001-2008, Taku Kudo Copyright (c) 2004-2008, Nippon Telegraph and Telephone Corporation All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Nippon Telegraph and Telegraph Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. mecab-ruby-0.996/MeCab_wrap.cpp0000644002562000116100000062377012110211100014562 0ustar takueng/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * 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 * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #define SWIGRUBY #ifdef __cplusplus /* 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() : 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 /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ----------------------------------------------------------------------------- */ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # 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 # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # 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) # else # define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods */ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) # ifndef GCC_HASCLASSVISIBILITY # define GCC_HASCLASSVISIBILITY # endif #endif #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) # define SWIGEXPORT __attribute__ ((visibility("default"))) # else # define SWIGEXPORT # endif # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # 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. * ----------------------------------------------------------------------------- */ /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR # 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 # endif #endif /* inline attribute */ #ifndef SWIGINLINE # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # define SWIGINLINE inline # else # define SWIGINLINE # endif #endif /* attribute recognised by some compilers to avoid 'unused' warnings */ #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) # define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # 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) # else # define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif /* internal SWIG method */ #ifndef SWIGINTERN # define SWIGINTERN static SWIGUNUSED #endif /* internal inline SWIG method */ #ifndef SWIGINTERNINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE #endif /* exporting methods */ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) # ifndef GCC_HASCLASSVISIBILITY # define GCC_HASCLASSVISIBILITY # endif #endif #ifndef SWIGEXPORT # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # if defined(STATIC_LINKED) # define SWIGEXPORT # else # define SWIGEXPORT __declspec(dllexport) # endif # else # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) # define SWIGEXPORT __attribute__ ((visibility("default"))) # else # define SWIGEXPORT # endif # endif #endif /* calling conventions for Windows */ #ifndef SWIGSTDCALL # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL # endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # 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 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 "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE # define SWIG_QUOTE_STRING(x) #x # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) #else # define SWIG_TYPE_TABLE_NAME #endif /* 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'. But only do this if strictly necessary, ie, if you have problems with your compiler or suchlike. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif #ifndef SWIGRUNTIMEINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE #endif /* Generic buffer size */ #ifndef SWIG_BUFFER_SIZE # define SWIG_BUFFER_SIZE 1024 #endif /* 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 /* Flags/methods for returning states. 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 versions of SWIG, code such as the following was usually written: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { // success code } else { //fail code } Now you can be more explicit: int res = SWIG_ConvertPtr(obj,vptr,ty.flags); if (SWIG_IsOK(res)) { // success code } else { // fail code } which is the same really, but now you can also do Type *ptr; int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); if (SWIG_IsOK(res)) { // success code if (SWIG_IsNewObj(res) { ... delete *ptr; } else { ... } } else { // fail code } I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that also requires SWIG_ConvertPtr to return new result values, such as int SWIG_ConvertPtr(obj, ptr,...) { if () { if () { *ptr = ; return SWIG_NEWOBJ; } else { *ptr = ; return SWIG_OLDOBJ; } } else { return SWIG_BADOBJ; } } 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. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code allows to return the 'cast rank', for example, if you have this int food(double) int fooi(int); and you call food(1) // cast rank '1' (1 -> 1.0) 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) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) /* The CastRankLimit says how many bits are used for the cast rank */ #define SWIG_CASTRANKLIMIT (1 << 8) /* The NewMask denotes the object was created (using new/malloc) */ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) /* The TmpMask is for in/out typemaps that use temporal objects */ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) /* Simple returning values */ #define SWIG_BADOBJ (SWIG_ERROR) #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) /* Check, add and del mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) #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 # define SWIG_TypeRank unsigned long # endif # ifndef SWIG_MAXCASTRANK /* Default cast allowed */ # define SWIG_MAXCASTRANK (2) # endif # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) SWIGINTERNINLINE int SWIG_AddCast(int r) { return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; } SWIGINTERNINLINE int SWIG_CheckState(int r) { return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; } #else /* no cast-rank mode */ # define SWIG_AddCast # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) #endif #include #ifdef __cplusplus extern "C" { #endif typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); /* 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 */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */ void *clientdata; /* language specific type data */ int owndata; /* flag if the structure owns the clientdata */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ size_t size; /* Number of types in this module */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */ swig_type_info **type_initial; /* Array of initially generated type structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */ void *clientdata; /* Language specific module data */ } swig_module_info; /* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } return (int)((l1 - f1) - (l2 - f2)); } /* Check type equivalence in a name list like ||... Return 0 if not equal, 1 if equal */ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check type equivalence in a name list like ||... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) { int equiv = 0; const char* te = tb + strlen(tb); const char* ne = nb; while (!equiv && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; if (*ne) ++ne; } return equiv; } /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *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; } /* 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 *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, int *newmemory) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; while (ty && (ty->dcast)) { ty = (*ty->dcast)(ptr); if (ty) lastty = ty; } return lastty; } /* Return the name associated with this type */ SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty) { return ty->name; } /* Return the pretty name associated with this type, that is an unmangled type name in a form presentable to the user. */ SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the type, separated by vertical-bar characters. We choose to print the last name, as it is often (?) the most specific. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; const char *s; for (s = type->str; *s; s++) if (*s == '|') last_name = s+1; return last_name; } else return type->name; } /* Set the clientdata field for a type */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; while (cast) { if (!cast->converter) { swig_type_info *tc = cast->type; if (!tc->clientdata) { SWIG_TypeClientData(tc, clientdata); } } cast = cast->next; } } SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); ti->owndata = 1; } /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { register size_t l = 0; register size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ register size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { register int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { r = i - 1; } else { break; } } else if (compare > 0) { l = i + 1; } } else { break; /* should never happen */ } } while (l <= r); } iter = iter->next; } while (iter != end); return 0; } /* Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); if (ret) { return ret; } else { /* STEP 2: If the type hasn't been found, do a complete search of the str field (the human readable name) */ swig_module_info *iter = start; do { register size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; } iter = iter->next; } while (iter != end); } /* neither found a match */ return 0; } /* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; register const unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } /* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { register unsigned char *u = (unsigned char *) ptr; register const unsigned char *eu = u + sz; for (; u != eu; ++u) { register char d = *(c++); register unsigned char uu; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); else return (char *) 0; *u = uu; } return c; } /* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { char *r = buff; if ((2*sizeof(void *) + 2) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,&ptr,sizeof(void *)); if (strlen(name) + 1 > (bsz - (r - buff))) return 0; strcpy(r,name); return buff; } SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { *ptr = (void *) 0; return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sizeof(void *)); } SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { char *r = buff; size_t lname = (name ? strlen(name) : 0); if ((2*sz + 2 + lname) > bsz) return 0; *(r++) = '_'; r = SWIG_PackData(r,ptr,sz); if (lname) { strncpy(r,name,lname+1); } else { *r = 0; } return buff; } SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { if (*c != '_') { if (strcmp(c,"NULL") == 0) { memset(ptr,0,sz); return name; } else { return 0; } } return SWIG_UnpackData(++c,ptr,sz); } #ifdef __cplusplus } #endif /* Errors in SWIG */ #define SWIG_UnknownError -1 #define SWIG_IOError -2 #define SWIG_RuntimeError -3 #define SWIG_IndexError -4 #define SWIG_TypeError -5 #define SWIG_DivisionByZero -6 #define SWIG_OverflowError -7 #define SWIG_SyntaxError -8 #define SWIG_ValueError -9 #define SWIG_SystemError -10 #define SWIG_AttributeError -11 #define SWIG_MemoryError -12 #define SWIG_NullReferenceError -13 #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)) #endif #ifndef LL2NUM #define LL2NUM(x) INT2NUM((long) (x)) #endif #ifndef ULL2NUM #define ULL2NUM(x) UINT2NUM((unsigned long) (x)) #endif /* Ruby 1.7 doesn't (yet) define NUM2ULL() */ #ifndef NUM2ULL #ifdef HAVE_LONG_LONG #define NUM2ULL(x) rb_num2ull((x)) #else #define NUM2ULL(x) NUM2ULONG(x) #endif #endif /* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */ /* Define these for older versions so we can just write code the new way */ #ifndef RSTRING_LEN # define RSTRING_LEN(x) RSTRING(x)->len #endif #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 * when compiling C++ code or C code with an ANSI C compiler. * * VALUEFUNC(f) is a macro used to typecast a C function that implements * a Ruby method so that it can be passed as an argument to API functions * like rb_define_method() and rb_define_singleton_method(). * * VOIDFUNC(f) is a macro used to typecast a C function that implements * either the "mark" or "free" stuff for a Ruby Data object, so that it * can be passed as an argument to API functions like Data_Wrap_Struct() * and Data_Make_Struct(). */ #ifdef __cplusplus # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */ # define PROTECTFUNC(f) ((VALUE (*)()) f) # define VALUEFUNC(f) ((VALUE (*)()) f) # define VOIDFUNC(f) ((void (*)()) f) # else # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */ # define PROTECTFUNC(f) ((VALUE (*)()) f) # define VALUEFUNC(f) ((VALUE (*)()) f) # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) # else /* These definitions should work for Ruby 1.7+ */ # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f) # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f) # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) # endif # endif #else # define VALUEFUNC(f) (f) # define VOIDFUNC(f) (f) #endif /* Don't use for expressions have side effect */ #ifndef RB_STRING_VALUE #define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s))) #endif #ifndef StringValue #define StringValue(s) RB_STRING_VALUE(s) #endif #ifndef StringValuePtr #define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s)) #endif #ifndef StringValueLen #define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s)) #endif #ifndef SafeStringValue #define SafeStringValue(v) do {\ StringValue(v);\ rb_check_safe_str(v);\ } while (0) #endif #ifndef HAVE_RB_DEFINE_ALLOC_FUNC #define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1) #define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new") #endif static VALUE _mSWIG = Qnil; /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ /* Define some additional error types */ #define SWIG_ObjectPreviouslyDeletedError -100 /* 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 function in C. For C, fallback to rb_eRuntimeError.*/ SWIGINTERN VALUE getNullReferenceError(void) { static int init = 0; static VALUE rb_eNullReferenceError ; if (!init) { init = 1; rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError); } return rb_eNullReferenceError; } SWIGINTERN VALUE getObjectPreviouslyDeletedError(void) { static int init = 0; static VALUE rb_eObjectPreviouslyDeleted ; if (!init) { init = 1; rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError); } return rb_eObjectPreviouslyDeleted; } SWIGINTERN VALUE SWIG_Ruby_ErrorType(int SWIG_code) { VALUE type; switch (SWIG_code) { case SWIG_MemoryError: type = rb_eNoMemError; break; case SWIG_IOError: type = rb_eIOError; break; case SWIG_RuntimeError: type = rb_eRuntimeError; break; case SWIG_IndexError: type = rb_eIndexError; break; case SWIG_TypeError: type = rb_eTypeError; break; case SWIG_DivisionByZero: type = rb_eZeroDivError; break; case SWIG_OverflowError: type = rb_eRangeError; break; case SWIG_SyntaxError: type = rb_eSyntaxError; break; case SWIG_ValueError: type = rb_eArgError; break; case SWIG_SystemError: type = rb_eFatal; break; case SWIG_AttributeError: type = rb_eRuntimeError; break; case SWIG_NullReferenceError: type = getNullReferenceError(); break; case SWIG_ObjectPreviouslyDeletedError: type = getObjectPreviouslyDeletedError(); break; case SWIG_UnknownError: type = rb_eRuntimeError; break; default: type = rb_eRuntimeError; } return type; } /* 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); } /* ----------------------------------------------------------------------------- * rubytracking.swg * * This file contains support for tracking mappings from * Ruby objects to C++ objects. This functionality is needed * to implement mark functions for Ruby's mark and sweep * garbage collector. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus 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 = 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. */ /* 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 */ SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) { /* We cast the pointer to an unsigned long and then store a reference to it using a Ruby number object. */ /* Convert the pointer to a Ruby number */ return SWIG2NUM(ptr); } /* Get a Ruby number to reference an object */ SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) { /* We cast the object to an unsigned long and then store a reference to it using a Ruby number object. */ /* Convert the Object to a Ruby number */ return SWIG2NUM(object); } /* Get a Ruby object from a previously stored reference */ SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) { /* The provided Ruby number object is a reference to the Ruby object we want.*/ /* Convert the Ruby number to a Ruby object */ return NUM2SWIG(reference); } /* Add a Tracking from a C/C++ struct to a Ruby object */ SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) { /* In a Ruby hash table we store the pointer and the associated Ruby object. The trick here is that we cannot store the Ruby object directly - if we do then it cannot be garbage collected. So instead we typecast it as a unsigned long and convert it to a Ruby number object.*/ /* Get a reference to the pointer as a Ruby number */ VALUE key = SWIG_RubyPtrToReference(ptr); /* Get a reference to the Ruby object as a Ruby number */ VALUE value = SWIG_RubyObjectToReference(object); /* Store the mapping to the global hash table. */ rb_hash_aset(swig_ruby_trackings, key, value); } /* Get the Ruby object that owns the specified C/C++ struct */ SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) { /* Get a reference to the pointer as a Ruby number */ VALUE key = SWIG_RubyPtrToReference(ptr); /* Now lookup the value stored in the global hash table */ VALUE value = rb_hash_aref(swig_ruby_trackings, key); if (value == Qnil) { /* No object exists - return nil. */ return Qnil; } else { /* Convert this value to Ruby object */ return SWIG_RubyReferenceToObject(value); } } /* Remove a Tracking from a C/C++ struct to a Ruby object. It is very important to remove objects once they are destroyed since the same memory address may be reused later to create a new object. */ SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) { /* Get a reference to the pointer as a Ruby number */ VALUE key = SWIG_RubyPtrToReference(ptr); /* Delete the object from the hash table by calling Ruby's do this we need to call the Hash.delete method.*/ rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key); } /* This is a helper method that unlinks a Ruby object from its underlying C++ object. This is needed if the lifetime of the Ruby object is longer than the C++ object */ SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) { VALUE object = SWIG_RubyInstanceFor(ptr); if (object != Qnil) { DATA_PTR(object) = 0; } } #ifdef __cplusplus } #endif /* ----------------------------------------------------------------------------- * Ruby API portion that goes into the runtime * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #endif SWIGINTERN VALUE SWIG_Ruby_AppendOutput(VALUE target, VALUE o) { if (NIL_P(target)) { target = o; } else { if (TYPE(target) != T_ARRAY) { VALUE o2 = target; target = rb_ary_new(); rb_ary_push(target, o2); } rb_ary_push(target, 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 /* ----------------------------------------------------------------------------- * rubyrun.swg * * This file contains the runtime support for Ruby modules * and includes code for managing global variables and pointer * type checking. * ----------------------------------------------------------------------------- */ /* For backward compatibility only */ #define SWIG_POINTER_EXCEPTION 0 /* for raw pointers */ #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0) #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own) #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags) #define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own) #define swig_owntype ruby_owntype /* for raw packed data */ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags) #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type) /* for class or struct pointers */ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) /* for C or C++ function pointers */ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0) #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0) /* for C++ member pointers, ie, member methods */ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty) #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type) /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer) /* Error manipulation */ #define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code) #define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg) #define SWIG_fail goto fail /* Ruby-specific SWIG API */ #define SWIG_InitRuntime() SWIG_Ruby_InitRuntime() #define SWIG_define_class(ty) SWIG_Ruby_define_class(ty) #define SWIG_NewClassInstance(value, ty) SWIG_Ruby_NewClassInstance(value, ty) #define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value) #define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty) #include "assert.h" /* ----------------------------------------------------------------------------- * pointers/data manipulation * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #endif typedef struct { VALUE klass; VALUE mImpl; void (*mark)(void *); void (*destroy)(void *); int trackObjects; } swig_class; /* 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; static VALUE rubyExceptionClass ; if (!init) { init = 1; rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception")); } return rubyExceptionClass; } /* This code checks to see if the Ruby object being raised as part of an exception inherits from the Ruby class Exception. If so, the object is simply returned. If not, then a new Ruby exception object is created and that will be returned to Ruby.*/ SWIGRUNTIME VALUE SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) { VALUE exceptionClass = getExceptionClass(); if (rb_obj_is_kind_of(obj, exceptionClass)) { return obj; } else { return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj)); } } /* Initialize Ruby runtime support */ SWIGRUNTIME void SWIG_Ruby_InitRuntime(void) { if (_mSWIG == Qnil) { _mSWIG = rb_define_module("SWIG"); swig_call_id = rb_intern("call"); swig_arity_id = rb_intern("arity"); } } /* Define Ruby class for C type */ SWIGRUNTIME void SWIG_Ruby_define_class(swig_type_info *type) { VALUE klass; char *klass_name = (char *) malloc(4 + strlen(type->name) + 1); sprintf(klass_name, "TYPE%s", type->name); if (NIL_P(_cSWIG_Pointer)) { _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject); rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new"); } klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer); free((void *) klass_name); } /* Create a new pointer object */ 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; VALUE obj; if (!ptr) return Qnil; if (type->clientdata) { sklass = (swig_class *) type->clientdata; /* Are we tracking this class and have we already returned this Ruby object? */ 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__"); char* type_name = RSTRING_PTR(value); if (strcmp(type->name, type_name) == 0) { return obj; } } } /* Create a new Ruby object */ 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 (track) { SWIG_RubyAddTracking(ptr, obj); } } else { klass_name = (char *) malloc(4 + strlen(type->name) + 1); sprintf(klass_name, "TYPE%s", type->name); klass = rb_const_get(_mSWIG, rb_intern(klass_name)); free((void *) klass_name); obj = Data_Wrap_Struct(klass, 0, 0, ptr); } rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name)); return obj; } /* Create a new class instance (always owned) */ SWIGRUNTIME VALUE 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)); return obj; } /* Get type mangle from class name */ SWIGRUNTIMEINLINE char * SWIG_Ruby_MangleStr(VALUE obj) { VALUE stype = rb_iv_get(obj, "@__swigtype__"); return StringValuePtr(stype); } /* Acquire a pointer value */ typedef void (*ruby_owntype)(void*); SWIGRUNTIME ruby_owntype SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) { if (obj) { ruby_owntype oldown = RDATA(obj)->dfree; RDATA(obj)->dfree = own; return oldown; } else { return 0; } } /* Convert a pointer value */ SWIGRUNTIME int SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own) { char *c; swig_cast_info *tc; void *vptr = 0; /* Grab the pointer */ if (NIL_P(obj)) { *ptr = 0; return SWIG_OK; } else { if (TYPE(obj) != T_DATA) { return SWIG_ERROR; } Data_Get_Struct(obj, void, vptr); } if (own) *own = RDATA(obj)->dfree; /* Check to see if the input object is giving up ownership of the underlying C struct or C++ object. If so then we need to reset the destructor since the Ruby object no longer owns the underlying C++ object.*/ if (flags & SWIG_POINTER_DISOWN) { /* Is tracking on for this class? */ int track = 0; if (ty && ty->clientdata) { swig_class *sklass = (swig_class *) ty->clientdata; track = sklass->trackObjects; } if (track) { /* We are tracking objects for this class. Thus we change the destructor * to SWIG_RubyRemoveTracking. This allows us to * remove the mapping from the C++ to Ruby object * when the Ruby object is garbage collected. If we don't * do this, then it is possible we will return a reference * to a Ruby object that no longer exists thereby crashing Ruby. */ RDATA(obj)->dfree = SWIG_RubyRemoveTracking; } else { RDATA(obj)->dfree = 0; } } /* Do type-checking if type info was provided */ if (ty) { if (ty->clientdata) { if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) { if (vptr == 0) { /* The object has already been deleted */ return SWIG_ObjectPreviouslyDeletedError; } *ptr = vptr; return SWIG_OK; } } if ((c = SWIG_MangleStr(obj)) == NULL) { return SWIG_ERROR; } 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 */ } } else { *ptr = vptr; } return SWIG_OK; } /* Check convert */ SWIGRUNTIMEINLINE int SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty) { char *c = SWIG_MangleStr(obj); if (!c) return 0; return SWIG_TypeCheck(c,ty) != 0; } SWIGRUNTIME VALUE SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) { char result[1024]; char *r = result; if ((2*sz + 1 + strlen(type->name)) > 1000) return 0; *(r++) = '_'; r = SWIG_PackData(r, ptr, sz); strcpy(r, type->name); return rb_str_new2(result); } /* Convert a packed value value */ SWIGRUNTIME int SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) { swig_cast_info *tc; const char *c; if (TYPE(obj) != T_STRING) goto type_error; c = StringValuePtr(obj); /* Pointer values must start with leading underscore */ if (*c != '_') goto type_error; c++; c = SWIG_UnpackData(c, ptr, sz); if (ty) { tc = SWIG_TypeCheck(c, ty); if (!tc) goto type_error; } return SWIG_OK; type_error: return SWIG_ERROR; } SWIGRUNTIME swig_module_info * SWIG_Ruby_GetModule(void) { VALUE pointer; swig_module_info *ret = 0; VALUE verbose = rb_gv_get("VERBOSE"); /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */ rb_gv_set("VERBOSE", Qfalse); /* first check if pointer already created */ pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); if (pointer != Qnil) { Data_Get_Struct(pointer, swig_module_info, ret); } /* reinstate warnings */ rb_gv_set("VERBOSE", verbose); return ret; } SWIGRUNTIME void SWIG_Ruby_SetModule(swig_module_info *pointer) { /* register a new class */ VALUE cl = rb_define_class("swig_runtime_data", rb_cObject); /* create and store the structure pointer to a global variable */ swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, 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 } #endif #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else #define SWIG_exception(code, msg) do { SWIG_Error(code, msg);; } while(0) /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_MeCab__Lattice swig_types[0] #define SWIGTYPE_p_MeCab__Model swig_types[1] #define SWIGTYPE_p_MeCab__Tagger swig_types[2] #define SWIGTYPE_p_char swig_types[3] #define SWIGTYPE_p_mecab_dictionary_info_t swig_types[4] #define SWIGTYPE_p_mecab_node_t swig_types[5] #define SWIGTYPE_p_mecab_path_t swig_types[6] #define SWIGTYPE_p_mecab_t swig_types[7] #define SWIGTYPE_p_p_char swig_types[8] static swig_type_info *swig_types[10]; static swig_module_info swig_module = {swig_types, 9, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ #define SWIG_init Init_MeCab #define SWIG_name "MeCab" static VALUE mMeCab; #define SWIG_RUBY_THREAD_BEGIN_BLOCK #define SWIG_RUBY_THREAD_END_BLOCK #define SWIGVERSION 0x020004 #define SWIG_VERSION SWIGVERSION #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) #include #include "mecab.h" /* Workaround for ruby1.9.x */ #if defined SWIGRUBY #include "ruby/version.h" #if RUBY_API_VERSION_CODE >= 10900 #include "ruby/encoding.h" #define rb_str_new rb_external_str_new #endif #endif MeCab::Tagger* new_MeCab_Tagger (const char *arg) { char *p = new char [strlen(arg) + 4]; strcpy(p, "-C "); strcat(p, arg); MeCab::Tagger *tagger = MeCab::createTagger(p); delete [] p; if (! tagger) throw MeCab::getLastError(); return tagger; } MeCab::Tagger* new_MeCab_Tagger () { MeCab::Tagger *tagger = MeCab::createTagger("-C"); if (! tagger) throw MeCab::getLastError(); return tagger; } void delete_MeCab_Tagger (MeCab::Tagger *t) { delete t; t = 0; } MeCab::Model* new_MeCab_Model (const char *arg) { char *p = new char [strlen(arg) + 4]; strcpy(p, "-C "); strcat(p, arg); MeCab::Model *model = MeCab::createModel(p); delete [] p; if (! model) throw MeCab::getLastError(); return model; } MeCab::Model* new_MeCab_Model () { MeCab::Model *model = MeCab::createModel("-C"); if (! model) throw MeCab::getLastError(); return model; } void delete_MeCab_Model (MeCab::Model *t) { delete t; t = 0; } MeCab::Lattice* new_MeCab_Lattice () { return MeCab::createLattice(); } void delete_MeCab_Lattice (MeCab::Lattice *t) { delete t; t = 0; } char* mecab_node_t_surface_get(mecab_node_t *n) { char *s = new char [n->length + 1]; memcpy (s, n->surface, n->length); s[n->length] = '\0'; return s; } SWIGINTERN swig_type_info* SWIG_pchar_descriptor(void) { static int init = 0; static swig_type_info* info = 0; if (!init) { info = SWIG_TypeQuery("_p_char"); init = 1; } return info; } SWIGINTERNINLINE VALUE SWIG_FromCharPtrAndSize(const char* carray, size_t size) { if (carray) { if (size > LONG_MAX) { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); return pchar_descriptor ? SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : Qnil; } else { return rb_str_new(carray, static_cast< long >(size)); } } else { return Qnil; } } SWIGINTERNINLINE VALUE SWIG_FromCharPtr(const char *cptr) { return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); } #include #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 #define SWIG_From_long LONG2NUM SWIGINTERNINLINE VALUE SWIG_From_unsigned_SS_long (unsigned long value) { return ULONG2NUM(value); } SWIGINTERNINLINE VALUE SWIG_From_unsigned_SS_int (unsigned int value) { return SWIG_From_unsigned_SS_long (value); } SWIGINTERNINLINE VALUE SWIG_From_int (int value) { return SWIG_From_long (value); } SWIGINTERNINLINE VALUE SWIG_From_unsigned_SS_short (unsigned short value) { return SWIG_From_unsigned_SS_long (value); } #include SWIGINTERN VALUE SWIG_ruby_failed(void) { return Qnil; } /*@SWIG:/usr/share/swig2.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE *args) { VALUE obj = args[0]; VALUE type = TYPE(obj); double *res = (double *)(args[1]); *res = NUM2DBL(obj); return obj; } /*@SWIG@*/ SWIGINTERN int SWIG_AsVal_double (VALUE obj, double *val) { VALUE type = TYPE(obj); if ((type == T_FLOAT) || (type == T_FIXNUM) || (type == T_BIGNUM)) { double v; VALUE a[2]; a[0] = obj; a[1] = (VALUE)(&v); if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { if (val) *val = v; return SWIG_OK; } } return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_float (VALUE obj, float *val) { double v; int res = SWIG_AsVal_double (obj, &v); if (SWIG_IsOK(res)) { if ((v < -FLT_MAX || v > FLT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< float >(v); } } return res; } #define SWIG_From_double rb_float_new SWIGINTERNINLINE VALUE SWIG_From_float (float value) { return SWIG_From_double (value); } SWIGINTERNINLINE VALUE SWIG_From_unsigned_SS_char (unsigned char value) { return SWIG_From_unsigned_SS_long (value); } SWIGINTERNINLINE VALUE SWIG_From_short (short value) { return SWIG_From_long (value); } SWIGINTERNINLINE VALUE SWIG_From_bool (bool value) { return value ? Qtrue : Qfalse; } /*@SWIG:/usr/share/swig2.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args) { VALUE obj = args[0]; VALUE type = TYPE(obj); unsigned long *res = (unsigned long *)(args[1]); *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj); return obj; } /*@SWIG@*/ SWIGINTERN int SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val) { VALUE type = TYPE(obj); if ((type == T_FIXNUM) || (type == T_BIGNUM)) { unsigned long v; VALUE a[2]; a[0] = obj; a[1] = (VALUE)(&v); if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { if (val) *val = v; return SWIG_OK; } } return SWIG_TypeError; } SWIGINTERNINLINE int SWIG_AsVal_size_t (VALUE obj, size_t *val) { unsigned long v; int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0); if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v); return res; } SWIGINTERNINLINE VALUE SWIG_From_size_t (size_t value) { return SWIG_From_unsigned_SS_long (static_cast< unsigned long >(value)); } /*@SWIG:/usr/share/swig2.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args) { VALUE obj = args[0]; VALUE type = TYPE(obj); long *res = (long *)(args[1]); *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj); return obj; } /*@SWIG@*/ SWIGINTERN int SWIG_AsVal_long (VALUE obj, long* val) { VALUE type = TYPE(obj); if ((type == T_FIXNUM) || (type == T_BIGNUM)) { long v; VALUE a[2]; a[0] = obj; a[1] = (VALUE)(&v); if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { if (val) *val = v; return SWIG_OK; } } return SWIG_TypeError; } SWIGINTERN int SWIG_AsVal_int (VALUE obj, int *val) { long v; int res = SWIG_AsVal_long (obj, &v); if (SWIG_IsOK(res)) { if ((v < INT_MIN || v > INT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< int >(v); } } return res; } 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) { if (*alloc == SWIG_NEWOBJ) { *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size))); } else { *cptr = cstr; *alloc = SWIG_OLDOBJ; } } } if (psize) *psize = size; return SWIG_OK; } else { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); if (pchar_descriptor) { void* vptr = 0; if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { if (cptr) *cptr = (char *)vptr; if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0; if (alloc) *alloc = SWIG_OLDOBJ; return SWIG_OK; } } } return SWIG_TypeError; } SWIGINTERN void MeCab_Lattice_set_sentence(MeCab::Lattice *self,char const *sentence){ self->add_request_type(MECAB_ALLOCATE_SENTENCE); self->set_sentence(sentence); } SWIGINTERN int SWIG_AsVal_unsigned_SS_short (VALUE obj, unsigned short *val) { unsigned long v; int res = SWIG_AsVal_unsigned_SS_long (obj, &v); if (SWIG_IsOK(res)) { if ((v > USHRT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = static_cast< unsigned short >(v); } } return res; } SWIGINTERN int SWIG_AsVal_bool (VALUE obj, bool *val) { if (obj == Qtrue) { if (val) *val = true; return SWIG_OK; } else if (obj == Qfalse) { if (val) *val = false; return SWIG_OK; } else { int res = 0; if (SWIG_AsVal_int (obj, &res) == SWIG_OK) { if (val) *val = res ? true : false; return SWIG_OK; } } return SWIG_TypeError; } SWIGINTERN char const *MeCab_Tagger_parseToString__SWIG_0(MeCab::Tagger *self,char const *str,size_t length=0){ return self->parse(str, length); } swig_class SwigClassDictionaryInfo; SWIGINTERN VALUE _wrap_DictionaryInfo_filename_get(int argc, VALUE *argv, VALUE self) { mecab_dictionary_info_t *arg1 = (mecab_dictionary_info_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; VALUE vresult = Qnil; 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_mecab_dictionary_info_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_dictionary_info_t *","filename", 1, self )); } arg1 = reinterpret_cast< mecab_dictionary_info_t * >(argp1); result = (char *) ((arg1)->filename); vresult = SWIG_FromCharPtr((const char *)result); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_DictionaryInfo_charset_get(int argc, VALUE *argv, VALUE self) { mecab_dictionary_info_t *arg1 = (mecab_dictionary_info_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; VALUE vresult = Qnil; 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_mecab_dictionary_info_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_dictionary_info_t *","charset", 1, self )); } arg1 = reinterpret_cast< mecab_dictionary_info_t * >(argp1); result = (char *) ((arg1)->charset); vresult = SWIG_FromCharPtr((const char *)result); return vresult; fail: return Qnil; } /* Document-method: MeCab::DictionaryInfo.size call-seq: size -> unsigned int Size or Length of the DictionaryInfo. */ SWIGINTERN VALUE _wrap_DictionaryInfo_size_get(int argc, VALUE *argv, VALUE self) { mecab_dictionary_info_t *arg1 = (mecab_dictionary_info_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; unsigned int result; VALUE vresult = Qnil; 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_mecab_dictionary_info_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_dictionary_info_t *","size", 1, self )); } arg1 = reinterpret_cast< mecab_dictionary_info_t * >(argp1); result = (unsigned int) ((arg1)->size); vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_DictionaryInfo_type_get(int argc, VALUE *argv, VALUE self) { mecab_dictionary_info_t *arg1 = (mecab_dictionary_info_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; VALUE vresult = Qnil; 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_mecab_dictionary_info_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_dictionary_info_t *","type", 1, self )); } arg1 = reinterpret_cast< mecab_dictionary_info_t * >(argp1); result = (int) ((arg1)->type); vresult = SWIG_From_int(static_cast< int >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_DictionaryInfo_lsize_get(int argc, VALUE *argv, VALUE self) { mecab_dictionary_info_t *arg1 = (mecab_dictionary_info_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; unsigned int result; VALUE vresult = Qnil; 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_mecab_dictionary_info_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_dictionary_info_t *","lsize", 1, self )); } arg1 = reinterpret_cast< mecab_dictionary_info_t * >(argp1); result = (unsigned int) ((arg1)->lsize); vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_DictionaryInfo_rsize_get(int argc, VALUE *argv, VALUE self) { mecab_dictionary_info_t *arg1 = (mecab_dictionary_info_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; unsigned int result; VALUE vresult = Qnil; 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_mecab_dictionary_info_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_dictionary_info_t *","rsize", 1, self )); } arg1 = reinterpret_cast< mecab_dictionary_info_t * >(argp1); result = (unsigned int) ((arg1)->rsize); vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_DictionaryInfo_version_get(int argc, VALUE *argv, VALUE self) { mecab_dictionary_info_t *arg1 = (mecab_dictionary_info_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; unsigned short result; VALUE vresult = Qnil; 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_mecab_dictionary_info_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_dictionary_info_t *","version", 1, self )); } arg1 = reinterpret_cast< mecab_dictionary_info_t * >(argp1); result = (unsigned short) ((arg1)->version); vresult = SWIG_From_unsigned_SS_short(static_cast< unsigned short >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_DictionaryInfo_next_get(int argc, VALUE *argv, VALUE self) { mecab_dictionary_info_t *arg1 = (mecab_dictionary_info_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; mecab_dictionary_info_t *result = 0 ; VALUE vresult = Qnil; 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_mecab_dictionary_info_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_dictionary_info_t *","next", 1, self )); } arg1 = reinterpret_cast< mecab_dictionary_info_t * >(argp1); result = (mecab_dictionary_info_t *) ((arg1)->next); vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_dictionary_info_t, 0 | 0 ); return vresult; fail: return Qnil; } #ifdef HAVE_RB_DEFINE_ALLOC_FUNC SWIGINTERN VALUE _wrap_DictionaryInfo_allocate(VALUE self) { #else SWIGINTERN VALUE _wrap_DictionaryInfo_allocate(int argc, VALUE *argv, VALUE self) { #endif VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_mecab_dictionary_info_t); #ifndef HAVE_RB_DEFINE_ALLOC_FUNC rb_obj_call_init(vresult, argc, argv); #endif return vresult; } SWIGINTERN VALUE _wrap_new_DictionaryInfo(int argc, VALUE *argv, VALUE self) { mecab_dictionary_info_t *result = 0 ; if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } { try { result = (mecab_dictionary_info_t *)new mecab_dictionary_info_t(); DATA_PTR(self) = result; } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } return self; fail: return Qnil; } SWIGINTERN void free_mecab_dictionary_info_t(mecab_dictionary_info_t *arg1) { delete arg1; } swig_class SwigClassPath; SWIGINTERN VALUE _wrap_Path_rnode_get(int argc, VALUE *argv, VALUE self) { mecab_path_t *arg1 = (mecab_path_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; mecab_node_t *result = 0 ; VALUE vresult = Qnil; 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_mecab_path_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_path_t *","rnode", 1, self )); } arg1 = reinterpret_cast< mecab_path_t * >(argp1); result = (mecab_node_t *) ((arg1)->rnode); vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_node_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Path_rnext_get(int argc, VALUE *argv, VALUE self) { mecab_path_t *arg1 = (mecab_path_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; mecab_path_t *result = 0 ; VALUE vresult = Qnil; 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_mecab_path_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_path_t *","rnext", 1, self )); } arg1 = reinterpret_cast< mecab_path_t * >(argp1); result = (mecab_path_t *) ((arg1)->rnext); vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_path_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Path_lnode_get(int argc, VALUE *argv, VALUE self) { mecab_path_t *arg1 = (mecab_path_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; mecab_node_t *result = 0 ; VALUE vresult = Qnil; 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_mecab_path_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_path_t *","lnode", 1, self )); } arg1 = reinterpret_cast< mecab_path_t * >(argp1); result = (mecab_node_t *) ((arg1)->lnode); vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_node_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Path_lnext_get(int argc, VALUE *argv, VALUE self) { mecab_path_t *arg1 = (mecab_path_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; mecab_path_t *result = 0 ; VALUE vresult = Qnil; 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_mecab_path_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_path_t *","lnext", 1, self )); } arg1 = reinterpret_cast< mecab_path_t * >(argp1); result = (mecab_path_t *) ((arg1)->lnext); vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_path_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Path_cost_get(int argc, VALUE *argv, VALUE self) { mecab_path_t *arg1 = (mecab_path_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; VALUE vresult = Qnil; 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_mecab_path_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_path_t *","cost", 1, self )); } arg1 = reinterpret_cast< mecab_path_t * >(argp1); result = (int) ((arg1)->cost); vresult = SWIG_From_int(static_cast< int >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Path_prob_set(int argc, VALUE *argv, VALUE self) { mecab_path_t *arg1 = (mecab_path_t *) 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_mecab_path_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_path_t *","prob", 1, self )); } arg1 = reinterpret_cast< mecab_path_t * >(argp1); ecode2 = SWIG_AsVal_float(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "float","prob", 2, argv[0] )); } arg2 = static_cast< float >(val2); if (arg1) (arg1)->prob = arg2; return Qnil; fail: return Qnil; } SWIGINTERN VALUE _wrap_Path_prob_get(int argc, VALUE *argv, VALUE self) { mecab_path_t *arg1 = (mecab_path_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; float result; VALUE vresult = Qnil; 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_mecab_path_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_path_t *","prob", 1, self )); } arg1 = reinterpret_cast< mecab_path_t * >(argp1); result = (float) ((arg1)->prob); vresult = SWIG_From_float(static_cast< float >(result)); return vresult; fail: return Qnil; } swig_class SwigClassNode; SWIGINTERN VALUE _wrap_Node_prev_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; mecab_node_t *result = 0 ; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","prev", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (mecab_node_t *) ((arg1)->prev); vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_node_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_next_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; mecab_node_t *result = 0 ; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","next", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (mecab_node_t *) ((arg1)->next); vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_node_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_enext_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; mecab_node_t *result = 0 ; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","enext", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (mecab_node_t *) ((arg1)->enext); vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_node_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_bnext_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; mecab_node_t *result = 0 ; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","bnext", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (mecab_node_t *) ((arg1)->bnext); vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_node_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_rpath_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; mecab_path_t *result = 0 ; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","rpath", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (mecab_path_t *) ((arg1)->rpath); vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_path_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_lpath_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; mecab_path_t *result = 0 ; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","lpath", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (mecab_path_t *) ((arg1)->lpath); vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_path_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_feature_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","feature", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (char *) ((arg1)->feature); vresult = SWIG_FromCharPtr((const char *)result); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_id_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; unsigned int result; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","id", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (unsigned int) ((arg1)->id); vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_length_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; unsigned short result; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","length", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (unsigned short) ((arg1)->length); vresult = SWIG_From_unsigned_SS_short(static_cast< unsigned short >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_rlength_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; unsigned short result; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","rlength", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (unsigned short) ((arg1)->rlength); vresult = SWIG_From_unsigned_SS_short(static_cast< unsigned short >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_rcAttr_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; unsigned short result; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","rcAttr", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (unsigned short) ((arg1)->rcAttr); vresult = SWIG_From_unsigned_SS_short(static_cast< unsigned short >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_lcAttr_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; unsigned short result; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","lcAttr", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (unsigned short) ((arg1)->lcAttr); vresult = SWIG_From_unsigned_SS_short(static_cast< unsigned short >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_posid_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; unsigned short result; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","posid", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (unsigned short) ((arg1)->posid); vresult = SWIG_From_unsigned_SS_short(static_cast< unsigned short >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_char_type_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; unsigned char result; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","char_type", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (unsigned char) ((arg1)->char_type); vresult = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_stat_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; unsigned char result; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","stat", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (unsigned char) ((arg1)->stat); vresult = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_isbest_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; unsigned char result; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","isbest", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (unsigned char) ((arg1)->isbest); vresult = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_alpha_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; float result; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","alpha", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (float) ((arg1)->alpha); vresult = SWIG_From_float(static_cast< float >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_beta_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; float result; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","beta", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (float) ((arg1)->beta); vresult = SWIG_From_float(static_cast< float >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_prob_set(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","prob", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); ecode2 = SWIG_AsVal_float(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "float","prob", 2, argv[0] )); } arg2 = static_cast< float >(val2); if (arg1) (arg1)->prob = arg2; return Qnil; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_prob_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; float result; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","prob", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (float) ((arg1)->prob); vresult = SWIG_From_float(static_cast< float >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_wcost_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; short result; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","wcost", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (short) ((arg1)->wcost); vresult = SWIG_From_short(static_cast< short >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_cost_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; long result; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","cost", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); result = (long) ((arg1)->cost); vresult = SWIG_From_long(static_cast< long >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Node_surface_get(int argc, VALUE *argv, VALUE self) { mecab_node_t *arg1 = (mecab_node_t *) 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; VALUE vresult = Qnil; 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_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "mecab_node_t *","surface", 1, self )); } arg1 = reinterpret_cast< mecab_node_t * >(argp1); { try { result = (char *)mecab_node_t_surface_get(arg1); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_FromCharPtr((const char *)result); delete[] result; return vresult; fail: return Qnil; } swig_class SwigClassLattice; SWIGINTERN VALUE _wrap_Lattice_clear(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 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_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice *","clear", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); { try { (arg1)->clear(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } return Qnil; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_is_available(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; void *argp1 = 0 ; int res1 = 0 ; bool result; VALUE vresult = Qnil; 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_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice const *","is_available", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); { try { result = (bool)((MeCab::Lattice const *)arg1)->is_available(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_bool(static_cast< bool >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_bos_node(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; void *argp1 = 0 ; int res1 = 0 ; MeCab::Node *result = 0 ; VALUE vresult = Qnil; 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_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice const *","bos_node", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); { try { result = (MeCab::Node *)((MeCab::Lattice const *)arg1)->bos_node(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_node_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_eos_node(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; void *argp1 = 0 ; int res1 = 0 ; MeCab::Node *result = 0 ; VALUE vresult = Qnil; 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_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice const *","eos_node", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); { try { result = (MeCab::Node *)((MeCab::Lattice const *)arg1)->eos_node(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_node_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_end_nodes(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; size_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; MeCab::Node *result = 0 ; VALUE vresult = Qnil; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice const *","end_nodes", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); ecode2 = SWIG_AsVal_size_t(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","end_nodes", 2, argv[0] )); } arg2 = static_cast< size_t >(val2); { try { result = (MeCab::Node *)((MeCab::Lattice const *)arg1)->end_nodes(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_node_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_begin_nodes(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; size_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; MeCab::Node *result = 0 ; VALUE vresult = Qnil; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice const *","begin_nodes", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); ecode2 = SWIG_AsVal_size_t(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","begin_nodes", 2, argv[0] )); } arg2 = static_cast< size_t >(val2); { try { result = (MeCab::Node *)((MeCab::Lattice const *)arg1)->begin_nodes(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_node_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_sentence(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; VALUE vresult = Qnil; 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_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice const *","sentence", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); { try { result = (char *)((MeCab::Lattice const *)arg1)->sentence(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_FromCharPtr((const char *)result); return vresult; fail: return Qnil; } /* Document-method: MeCab::Lattice.size call-seq: size -> size_t Size or Length of the Lattice. */ SWIGINTERN VALUE _wrap_Lattice_size(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; void *argp1 = 0 ; int res1 = 0 ; size_t result; VALUE vresult = Qnil; 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_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice const *","size", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); { try { result = ((MeCab::Lattice const *)arg1)->size(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_size_t(static_cast< size_t >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_set_Z(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; double arg2 ; void *argp1 = 0 ; int res1 = 0 ; double val2 ; int ecode2 = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice *","set_Z", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); ecode2 = SWIG_AsVal_double(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","set_Z", 2, argv[0] )); } arg2 = static_cast< double >(val2); { try { (arg1)->set_Z(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } return Qnil; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_Z(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; void *argp1 = 0 ; int res1 = 0 ; double result; VALUE vresult = Qnil; 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_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice const *","Z", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); { try { result = (double)((MeCab::Lattice const *)arg1)->Z(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_double(static_cast< double >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_set_theta(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice *","set_theta", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); ecode2 = SWIG_AsVal_float(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "float","set_theta", 2, argv[0] )); } arg2 = static_cast< float >(val2); { try { (arg1)->set_theta(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } return Qnil; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_theta(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; void *argp1 = 0 ; int res1 = 0 ; float result; VALUE vresult = Qnil; 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_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice const *","theta", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); { try { result = (float)((MeCab::Lattice const *)arg1)->theta(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_float(static_cast< float >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_next(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; void *argp1 = 0 ; int res1 = 0 ; bool result; VALUE vresult = Qnil; 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_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice *","next", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); { try { result = (bool)(arg1)->next(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_bool(static_cast< bool >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_request_type(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; VALUE vresult = Qnil; 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_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice const *","request_type", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); { try { result = (int)((MeCab::Lattice const *)arg1)->request_type(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_int(static_cast< int >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_has_request_type(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; bool result; VALUE vresult = Qnil; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice const *","has_request_type", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","has_request_type", 2, argv[0] )); } arg2 = static_cast< int >(val2); { try { result = (bool)((MeCab::Lattice const *)arg1)->has_request_type(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_bool(static_cast< bool >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_set_request_type(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice *","set_request_type", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","set_request_type", 2, argv[0] )); } arg2 = static_cast< int >(val2); { try { (arg1)->set_request_type(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } return Qnil; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_add_request_type(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice *","add_request_type", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","add_request_type", 2, argv[0] )); } arg2 = static_cast< int >(val2); { try { (arg1)->add_request_type(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } return Qnil; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_remove_request_type(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice *","remove_request_type", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","remove_request_type", 2, argv[0] )); } arg2 = static_cast< int >(val2); { try { (arg1)->remove_request_type(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } return Qnil; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_newNode(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; void *argp1 = 0 ; int res1 = 0 ; MeCab::Node *result = 0 ; VALUE vresult = Qnil; 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_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice *","newNode", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); { try { result = (MeCab::Node *)(arg1)->newNode(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_node_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_toString__SWIG_0(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; VALUE vresult = Qnil; 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_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice *","toString", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); { try { result = (char *)(arg1)->toString(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_FromCharPtr((const char *)result); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_toString__SWIG_1(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; MeCab::Node *arg2 = (MeCab::Node *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; char *result = 0 ; VALUE vresult = Qnil; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice *","toString", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MeCab::Node const *","toString", 2, argv[0] )); } arg2 = reinterpret_cast< MeCab::Node * >(argp2); { try { result = (char *)(arg1)->toString((MeCab::Node const *)arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_FromCharPtr((const char *)result); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_toString(int nargs, VALUE *args, VALUE self) { int argc; VALUE argv[3]; int ii; argc = nargs + 1; argv[0] = self; if (argc > 3) SWIG_fail; for (ii = 1; (ii < argc); ++ii) { argv[ii] = args[ii-1]; } if (argc == 1) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_MeCab__Lattice, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_Lattice_toString__SWIG_0(nargs, args, self); } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_MeCab__Lattice, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_mecab_node_t, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_Lattice_toString__SWIG_1(nargs, args, self); } } } fail: Ruby_Format_OverloadedError( argc, 3, "Lattice.toString", " char const * Lattice.toString()\n" " char const * Lattice.toString(MeCab::Node const *node)\n"); return Qnil; } SWIGINTERN VALUE _wrap_Lattice_enumNBestAsString(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; size_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; char *result = 0 ; VALUE vresult = Qnil; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice *","enumNBestAsString", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); ecode2 = SWIG_AsVal_size_t(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","enumNBestAsString", 2, argv[0] )); } arg2 = static_cast< size_t >(val2); { try { result = (char *)(arg1)->enumNBestAsString(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_FromCharPtr((const char *)result); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_has_constraint(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; void *argp1 = 0 ; int res1 = 0 ; bool result; VALUE vresult = Qnil; 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_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice const *","has_constraint", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); { try { result = (bool)((MeCab::Lattice const *)arg1)->has_constraint(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_bool(static_cast< bool >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_boundary_constraint(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; size_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; int result; VALUE vresult = Qnil; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice const *","boundary_constraint", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); ecode2 = SWIG_AsVal_size_t(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","boundary_constraint", 2, argv[0] )); } arg2 = static_cast< size_t >(val2); { try { result = (int)((MeCab::Lattice const *)arg1)->boundary_constraint(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_int(static_cast< int >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_feature_constraint(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; size_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; char *result = 0 ; VALUE vresult = Qnil; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice const *","feature_constraint", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); ecode2 = SWIG_AsVal_size_t(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","feature_constraint", 2, argv[0] )); } arg2 = static_cast< size_t >(val2); { try { result = (char *)((MeCab::Lattice const *)arg1)->feature_constraint(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_FromCharPtr((const char *)result); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_set_boundary_constraint(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; size_t arg2 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; int val3 ; int ecode3 = 0 ; if ((argc < 2) || (argc > 2)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice *","set_boundary_constraint", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); ecode2 = SWIG_AsVal_size_t(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","set_boundary_constraint", 2, argv[0] )); } arg2 = static_cast< size_t >(val2); ecode3 = SWIG_AsVal_int(argv[1], &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","set_boundary_constraint", 3, argv[1] )); } arg3 = static_cast< int >(val3); { try { (arg1)->set_boundary_constraint(arg2,arg3); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } return Qnil; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_set_feature_constraint(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; size_t arg2 ; size_t arg3 ; char *arg4 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; size_t val3 ; int ecode3 = 0 ; int res4 ; char *buf4 = 0 ; int alloc4 = 0 ; if ((argc < 3) || (argc > 3)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice *","set_feature_constraint", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); ecode2 = SWIG_AsVal_size_t(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","set_feature_constraint", 2, argv[0] )); } arg2 = static_cast< size_t >(val2); ecode3 = SWIG_AsVal_size_t(argv[1], &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "size_t","set_feature_constraint", 3, argv[1] )); } arg3 = static_cast< size_t >(val3); res4 = SWIG_AsCharPtrAndSize(argv[2], &buf4, NULL, &alloc4); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "char const *","set_feature_constraint", 4, argv[2] )); } arg4 = reinterpret_cast< char * >(buf4); { try { (arg1)->set_feature_constraint(arg2,arg3,(char const *)arg4); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } if (alloc4 == SWIG_NEWOBJ) delete[] buf4; return Qnil; fail: if (alloc4 == SWIG_NEWOBJ) delete[] buf4; return Qnil; } SWIGINTERN VALUE _wrap_Lattice_set_result(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice *","set_result", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","set_result", 2, argv[0] )); } arg2 = reinterpret_cast< char * >(buf2); { try { (arg1)->set_result((char const *)arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return Qnil; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return Qnil; } SWIGINTERN VALUE _wrap_Lattice_what(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; VALUE vresult = Qnil; 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_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice const *","what", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); { try { result = (char *)((MeCab::Lattice const *)arg1)->what(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_FromCharPtr((const char *)result); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_set_what(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice *","set_what", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","set_what", 2, argv[0] )); } arg2 = reinterpret_cast< char * >(buf2); { try { (arg1)->set_what((char const *)arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return Qnil; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return Qnil; } SWIGINTERN void free_MeCab_Lattice(MeCab::Lattice *arg1) { delete arg1; } #ifdef HAVE_RB_DEFINE_ALLOC_FUNC SWIGINTERN VALUE _wrap_Lattice_allocate(VALUE self) { #else SWIGINTERN VALUE _wrap_Lattice_allocate(int argc, VALUE *argv, VALUE self) { #endif VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_MeCab__Lattice); #ifndef HAVE_RB_DEFINE_ALLOC_FUNC rb_obj_call_init(vresult, argc, argv); #endif return vresult; } SWIGINTERN VALUE _wrap_new_Lattice(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *result = 0 ; if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } { try { result = (MeCab::Lattice *)new_MeCab_Lattice(); DATA_PTR(self) = result; } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } return self; fail: return Qnil; } SWIGINTERN VALUE _wrap_Lattice_set_sentence(int argc, VALUE *argv, VALUE self) { MeCab::Lattice *arg1 = (MeCab::Lattice *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Lattice *","set_sentence", 1, self )); } arg1 = reinterpret_cast< MeCab::Lattice * >(argp1); res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","set_sentence", 2, argv[0] )); } arg2 = reinterpret_cast< char * >(buf2); { try { MeCab_Lattice_set_sentence(arg1,(char const *)arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return Qnil; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return Qnil; } swig_class SwigClassModel; SWIGINTERN VALUE _wrap_Model_dictionary_info(int argc, VALUE *argv, VALUE self) { MeCab::Model *arg1 = (MeCab::Model *) 0 ; void *argp1 = 0 ; int res1 = 0 ; MeCab::DictionaryInfo *result = 0 ; VALUE vresult = Qnil; 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_MeCab__Model, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Model const *","dictionary_info", 1, self )); } arg1 = reinterpret_cast< MeCab::Model * >(argp1); { try { result = (MeCab::DictionaryInfo *)((MeCab::Model const *)arg1)->dictionary_info(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_dictionary_info_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Model_transition_cost(int argc, VALUE *argv, VALUE self) { MeCab::Model *arg1 = (MeCab::Model *) 0 ; unsigned short arg2 ; unsigned short arg3 ; void *argp1 = 0 ; int res1 = 0 ; unsigned short val2 ; int ecode2 = 0 ; unsigned short val3 ; int ecode3 = 0 ; int result; VALUE vresult = Qnil; if ((argc < 2) || (argc > 2)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Model, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Model const *","transition_cost", 1, self )); } arg1 = reinterpret_cast< MeCab::Model * >(argp1); ecode2 = SWIG_AsVal_unsigned_SS_short(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned short","transition_cost", 2, argv[0] )); } arg2 = static_cast< unsigned short >(val2); ecode3 = SWIG_AsVal_unsigned_SS_short(argv[1], &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "unsigned short","transition_cost", 3, argv[1] )); } arg3 = static_cast< unsigned short >(val3); { try { result = (int)((MeCab::Model const *)arg1)->transition_cost(arg2,arg3); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_int(static_cast< int >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Model_lookup(int argc, VALUE *argv, VALUE self) { MeCab::Model *arg1 = (MeCab::Model *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; MeCab::Lattice *arg4 = (MeCab::Lattice *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int res3 ; char *buf3 = 0 ; int alloc3 = 0 ; void *argp4 = 0 ; int res4 = 0 ; MeCab::Node *result = 0 ; VALUE vresult = Qnil; if ((argc < 3) || (argc > 3)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Model, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Model const *","lookup", 1, self )); } arg1 = reinterpret_cast< MeCab::Model * >(argp1); res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","lookup", 2, argv[0] )); } arg2 = reinterpret_cast< char * >(buf2); res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","lookup", 3, argv[1] )); } arg3 = reinterpret_cast< char * >(buf3); res4 = SWIG_ConvertPtr(argv[2], &argp4,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "MeCab::Lattice *","lookup", 4, argv[2] )); } arg4 = reinterpret_cast< MeCab::Lattice * >(argp4); { try { result = (MeCab::Node *)((MeCab::Model const *)arg1)->lookup((char const *)arg2,(char const *)arg3,arg4); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_node_t, 0 | 0 ); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; if (alloc3 == SWIG_NEWOBJ) delete[] buf3; return vresult; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; if (alloc3 == SWIG_NEWOBJ) delete[] buf3; return Qnil; } SWIGINTERN VALUE _wrap_Model_createTagger(int argc, VALUE *argv, VALUE self) { MeCab::Model *arg1 = (MeCab::Model *) 0 ; void *argp1 = 0 ; int res1 = 0 ; MeCab::Tagger *result = 0 ; VALUE vresult = Qnil; 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_MeCab__Model, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Model const *","createTagger", 1, self )); } arg1 = reinterpret_cast< MeCab::Model * >(argp1); { try { result = (MeCab::Tagger *)((MeCab::Model const *)arg1)->createTagger(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MeCab__Tagger, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Model_createLattice(int argc, VALUE *argv, VALUE self) { MeCab::Model *arg1 = (MeCab::Model *) 0 ; void *argp1 = 0 ; int res1 = 0 ; MeCab::Lattice *result = 0 ; VALUE vresult = Qnil; 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_MeCab__Model, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Model const *","createLattice", 1, self )); } arg1 = reinterpret_cast< MeCab::Model * >(argp1); { try { result = (MeCab::Lattice *)((MeCab::Model const *)arg1)->createLattice(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Model_swap(int argc, VALUE *argv, VALUE self) { MeCab::Model *arg1 = (MeCab::Model *) 0 ; MeCab::Model *arg2 = (MeCab::Model *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; bool result; VALUE vresult = Qnil; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Model, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Model *","swap", 1, self )); } arg1 = reinterpret_cast< MeCab::Model * >(argp1); res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_MeCab__Model, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MeCab::Model *","swap", 2, argv[0] )); } arg2 = reinterpret_cast< MeCab::Model * >(argp2); { try { result = (bool)(arg1)->swap(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_bool(static_cast< bool >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Model_version(int argc, VALUE *argv, VALUE self) { char *result = 0 ; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } { try { result = (char *)MeCab::Model::version(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_FromCharPtr((const char *)result); return vresult; fail: return Qnil; } SWIGINTERN void free_MeCab_Model(MeCab::Model *arg1) { delete arg1; } SWIGINTERN VALUE _wrap_Model_create__SWIG_0(int argc, VALUE *argv, VALUE self) { int arg1 ; char **arg2 = (char **) 0 ; int val1 ; int ecode1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; MeCab::Model *result = 0 ; VALUE vresult = Qnil; if ((argc < 2) || (argc > 2)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; } ecode1 = SWIG_AsVal_int(argv[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","MeCab::Model::create", 1, argv[0] )); } arg1 = static_cast< int >(val1); res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_p_char, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char **","MeCab::Model::create", 2, argv[1] )); } arg2 = reinterpret_cast< char ** >(argp2); { try { result = (MeCab::Model *)MeCab::Model::create(arg1,arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MeCab__Model, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Model_create__SWIG_1(int argc, VALUE *argv, VALUE self) { char *arg1 = (char *) 0 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; MeCab::Model *result = 0 ; VALUE vresult = Qnil; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","MeCab::Model::create", 1, argv[0] )); } arg1 = reinterpret_cast< char * >(buf1); { try { result = (MeCab::Model *)MeCab::Model::create((char const *)arg1); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MeCab__Model, 0 | 0 ); if (alloc1 == SWIG_NEWOBJ) delete[] buf1; return vresult; fail: if (alloc1 == SWIG_NEWOBJ) delete[] buf1; return Qnil; } SWIGINTERN VALUE _wrap_Model_create(int nargs, VALUE *args, VALUE self) { int argc; VALUE argv[2]; int ii; argc = nargs; if (argc > 2) SWIG_fail; for (ii = 0; (ii < argc); ++ii) { argv[ii] = args[ii]; } if (argc == 1) { int _v; int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_Model_create__SWIG_1(nargs, args, self); } } if (argc == 2) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); _v = SWIG_CheckState(res); } if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_p_char, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_Model_create__SWIG_0(nargs, args, self); } } } fail: Ruby_Format_OverloadedError( argc, 2, "Model.create", " MeCab::Model * Model.create(int argc, char **argv)\n" " MeCab::Model * Model.create(char const *arg)\n"); return Qnil; } SWIGINTERN VALUE _wrap_new_Model__SWIG_0(int argc, VALUE *argv, VALUE self) { char *arg1 = (char *) 0 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; MeCab::Model *result = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","MeCab::Model", 1, argv[0] )); } arg1 = reinterpret_cast< char * >(buf1); { try { result = (MeCab::Model *)new_MeCab_Model((char const *)arg1); DATA_PTR(self) = result; } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } if (alloc1 == SWIG_NEWOBJ) delete[] buf1; return self; fail: if (alloc1 == SWIG_NEWOBJ) delete[] buf1; return Qnil; } #ifdef HAVE_RB_DEFINE_ALLOC_FUNC SWIGINTERN VALUE _wrap_Model_allocate(VALUE self) { #else SWIGINTERN VALUE _wrap_Model_allocate(int argc, VALUE *argv, VALUE self) { #endif VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_MeCab__Model); #ifndef HAVE_RB_DEFINE_ALLOC_FUNC rb_obj_call_init(vresult, argc, argv); #endif return vresult; } SWIGINTERN VALUE _wrap_new_Model__SWIG_1(int argc, VALUE *argv, VALUE self) { MeCab::Model *result = 0 ; if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } { try { result = (MeCab::Model *)new_MeCab_Model(); DATA_PTR(self) = result; } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } return self; fail: return Qnil; } SWIGINTERN VALUE _wrap_new_Model(int nargs, VALUE *args, VALUE self) { int argc; VALUE argv[1]; int ii; argc = nargs; if (argc > 1) SWIG_fail; for (ii = 0; (ii < argc); ++ii) { argv[ii] = args[ii]; } if (argc == 0) { return _wrap_new_Model__SWIG_1(nargs, args, self); } if (argc == 1) { int _v; int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_Model__SWIG_0(nargs, args, self); } } fail: Ruby_Format_OverloadedError( argc, 1, "Model.new", " Model.new(char const *argc)\n" " Model.new()\n"); return Qnil; } swig_class SwigClassTagger; SWIGINTERN VALUE _wrap_Tagger_parse__SWIG_0(int argc, VALUE *argv, VALUE self) { MeCab::Model *arg1 = 0 ; MeCab::Lattice *arg2 = (MeCab::Lattice *) 0 ; void *argp1 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; bool result; VALUE vresult = Qnil; if ((argc < 2) || (argc > 2)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_MeCab__Model, 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Model const &","MeCab::Tagger::parse", 1, argv[0] )); } if (!argp1) { SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MeCab::Model const &","MeCab::Tagger::parse", 1, argv[0])); } arg1 = reinterpret_cast< MeCab::Model * >(argp1); res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MeCab::Lattice *","MeCab::Tagger::parse", 2, argv[1] )); } arg2 = reinterpret_cast< MeCab::Lattice * >(argp2); { try { result = (bool)MeCab::Tagger::parse((MeCab::Model const &)*arg1,arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_bool(static_cast< bool >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_parse__SWIG_1(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; MeCab::Lattice *arg2 = (MeCab::Lattice *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; bool result; VALUE vresult = Qnil; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger const *","parse", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_MeCab__Lattice, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MeCab::Lattice *","parse", 2, argv[0] )); } arg2 = reinterpret_cast< MeCab::Lattice * >(argp2); { try { result = (bool)((MeCab::Tagger const *)arg1)->parse(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_bool(static_cast< bool >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_parse__SWIG_2(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; char *result = 0 ; VALUE vresult = Qnil; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger *","parse", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","parse", 2, argv[0] )); } arg2 = reinterpret_cast< char * >(buf2); { try { result = (char *)(arg1)->parse((char const *)arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_FromCharPtr((const char *)result); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return vresult; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return Qnil; } SWIGINTERN VALUE _wrap_Tagger_parse(int nargs, VALUE *args, VALUE self) { int argc; VALUE argv[3]; int ii; argc = nargs + 1; argv[0] = self; if (argc > 3) SWIG_fail; for (ii = 1; (ii < argc); ++ii) { argv[ii] = args[ii-1]; } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_MeCab__Model, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_MeCab__Lattice, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_Tagger_parse__SWIG_0(nargs, args, self); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_MeCab__Tagger, 0); _v = SWIG_CheckState(res); if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_MeCab__Lattice, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_Tagger_parse__SWIG_1(nargs, args, self); } } } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_MeCab__Tagger, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_Tagger_parse__SWIG_2(nargs, args, self); } } } fail: Ruby_Format_OverloadedError( argc, 3, "Tagger.parse", " char const * Tagger.parse(MeCab::Lattice *lattice)\n" " char const * Tagger.parse(MeCab::Lattice *lattice)\n" " char const * Tagger.parse(char const *str)\n"); return Qnil; } SWIGINTERN VALUE _wrap_Tagger_parseToNode(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; MeCab::Node *result = 0 ; VALUE vresult = Qnil; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger *","parseToNode", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","parseToNode", 2, argv[0] )); } arg2 = reinterpret_cast< char * >(buf2); { try { result = (MeCab::Node *)(arg1)->parseToNode((char const *)arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_node_t, 0 | 0 ); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return vresult; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return Qnil; } SWIGINTERN VALUE _wrap_Tagger_parseNBest(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; size_t arg2 ; char *arg3 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; size_t val2 ; int ecode2 = 0 ; int res3 ; char *buf3 = 0 ; int alloc3 = 0 ; char *result = 0 ; VALUE vresult = Qnil; if ((argc < 2) || (argc > 2)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger *","parseNBest", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); ecode2 = SWIG_AsVal_size_t(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","parseNBest", 2, argv[0] )); } arg2 = static_cast< size_t >(val2); res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","parseNBest", 3, argv[1] )); } arg3 = reinterpret_cast< char * >(buf3); { try { result = (char *)(arg1)->parseNBest(arg2,(char const *)arg3); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_FromCharPtr((const char *)result); if (alloc3 == SWIG_NEWOBJ) delete[] buf3; return vresult; fail: if (alloc3 == SWIG_NEWOBJ) delete[] buf3; return Qnil; } SWIGINTERN VALUE _wrap_Tagger_parseNBestInit(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; bool result; VALUE vresult = Qnil; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger *","parseNBestInit", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","parseNBestInit", 2, argv[0] )); } arg2 = reinterpret_cast< char * >(buf2); { try { result = (bool)(arg1)->parseNBestInit((char const *)arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_bool(static_cast< bool >(result)); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return vresult; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return Qnil; } SWIGINTERN VALUE _wrap_Tagger_nextNode(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; void *argp1 = 0 ; int res1 = 0 ; MeCab::Node *result = 0 ; VALUE vresult = Qnil; 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_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger *","nextNode", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); { try { result = (MeCab::Node *)(arg1)->nextNode(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_node_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_next(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; VALUE vresult = Qnil; 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_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger *","next", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); { try { result = (char *)(arg1)->next(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_FromCharPtr((const char *)result); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_formatNode(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; MeCab::Node *arg2 = (MeCab::Node *) 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; char *result = 0 ; VALUE vresult = Qnil; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger *","formatNode", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_mecab_node_t, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MeCab::Node const *","formatNode", 2, argv[0] )); } arg2 = reinterpret_cast< MeCab::Node * >(argp2); { try { result = (char *)(arg1)->formatNode((MeCab::Node const *)arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_FromCharPtr((const char *)result); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_set_request_type(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger *","set_request_type", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","set_request_type", 2, argv[0] )); } arg2 = static_cast< int >(val2); { try { (arg1)->set_request_type(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } return Qnil; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_request_type(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; VALUE vresult = Qnil; 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_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger const *","request_type", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); { try { result = (int)((MeCab::Tagger const *)arg1)->request_type(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_int(static_cast< int >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_partial(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; void *argp1 = 0 ; int res1 = 0 ; bool result; VALUE vresult = Qnil; 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_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger const *","partial", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); { try { result = (bool)((MeCab::Tagger const *)arg1)->partial(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_bool(static_cast< bool >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_set_partial(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; bool arg2 ; void *argp1 = 0 ; int res1 = 0 ; bool val2 ; int ecode2 = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger *","set_partial", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); ecode2 = SWIG_AsVal_bool(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","set_partial", 2, argv[0] )); } arg2 = static_cast< bool >(val2); { try { (arg1)->set_partial(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } return Qnil; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_lattice_level(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; VALUE vresult = Qnil; 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_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger const *","lattice_level", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); { try { result = (int)((MeCab::Tagger const *)arg1)->lattice_level(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_int(static_cast< int >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_set_lattice_level(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger *","set_lattice_level", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","set_lattice_level", 2, argv[0] )); } arg2 = static_cast< int >(val2); { try { (arg1)->set_lattice_level(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } return Qnil; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_all_morphs(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; void *argp1 = 0 ; int res1 = 0 ; bool result; VALUE vresult = Qnil; 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_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger const *","all_morphs", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); { try { result = (bool)((MeCab::Tagger const *)arg1)->all_morphs(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_bool(static_cast< bool >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_set_all_morphs(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; bool arg2 ; void *argp1 = 0 ; int res1 = 0 ; bool val2 ; int ecode2 = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger *","set_all_morphs", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); ecode2 = SWIG_AsVal_bool(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","set_all_morphs", 2, argv[0] )); } arg2 = static_cast< bool >(val2); { try { (arg1)->set_all_morphs(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } return Qnil; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_set_theta(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; float arg2 ; void *argp1 = 0 ; int res1 = 0 ; float val2 ; int ecode2 = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger *","set_theta", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); ecode2 = SWIG_AsVal_float(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "float","set_theta", 2, argv[0] )); } arg2 = static_cast< float >(val2); { try { (arg1)->set_theta(arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } return Qnil; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_theta(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; void *argp1 = 0 ; int res1 = 0 ; float result; VALUE vresult = Qnil; 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_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger const *","theta", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); { try { result = (float)((MeCab::Tagger const *)arg1)->theta(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_From_float(static_cast< float >(result)); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_dictionary_info(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; void *argp1 = 0 ; int res1 = 0 ; MeCab::DictionaryInfo *result = 0 ; VALUE vresult = Qnil; 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_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger const *","dictionary_info", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); { try { result = (MeCab::DictionaryInfo *)((MeCab::Tagger const *)arg1)->dictionary_info(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_dictionary_info_t, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_what(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; VALUE vresult = Qnil; 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_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger const *","what", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); { try { result = (char *)((MeCab::Tagger const *)arg1)->what(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_FromCharPtr((const char *)result); return vresult; fail: return Qnil; } SWIGINTERN void free_MeCab_Tagger(MeCab::Tagger *arg1) { delete arg1; } SWIGINTERN VALUE _wrap_Tagger_create__SWIG_0(int argc, VALUE *argv, VALUE self) { int arg1 ; char **arg2 = (char **) 0 ; int val1 ; int ecode1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; MeCab::Tagger *result = 0 ; VALUE vresult = Qnil; if ((argc < 2) || (argc > 2)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; } ecode1 = SWIG_AsVal_int(argv[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","MeCab::Tagger::create", 1, argv[0] )); } arg1 = static_cast< int >(val1); res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_p_char, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char **","MeCab::Tagger::create", 2, argv[1] )); } arg2 = reinterpret_cast< char ** >(argp2); { try { result = (MeCab::Tagger *)MeCab::Tagger::create(arg1,arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MeCab__Tagger, 0 | 0 ); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_Tagger_create__SWIG_1(int argc, VALUE *argv, VALUE self) { char *arg1 = (char *) 0 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; MeCab::Tagger *result = 0 ; VALUE vresult = Qnil; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","MeCab::Tagger::create", 1, argv[0] )); } arg1 = reinterpret_cast< char * >(buf1); { try { result = (MeCab::Tagger *)MeCab::Tagger::create((char const *)arg1); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MeCab__Tagger, 0 | 0 ); if (alloc1 == SWIG_NEWOBJ) delete[] buf1; return vresult; fail: if (alloc1 == SWIG_NEWOBJ) delete[] buf1; return Qnil; } SWIGINTERN VALUE _wrap_Tagger_create(int nargs, VALUE *args, VALUE self) { int argc; VALUE argv[2]; int ii; argc = nargs; if (argc > 2) SWIG_fail; for (ii = 0; (ii < argc); ++ii) { argv[ii] = args[ii]; } if (argc == 1) { int _v; int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_Tagger_create__SWIG_1(nargs, args, self); } } if (argc == 2) { int _v; { int res = SWIG_AsVal_int(argv[0], NULL); _v = SWIG_CheckState(res); } if (_v) { void *vptr = 0; int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_p_char, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_Tagger_create__SWIG_0(nargs, args, self); } } } fail: Ruby_Format_OverloadedError( argc, 2, "Tagger.create", " MeCab::Tagger * Tagger.create(int argc, char **argv)\n" " MeCab::Tagger * Tagger.create(char const *arg)\n"); return Qnil; } SWIGINTERN VALUE _wrap_Tagger_version(int argc, VALUE *argv, VALUE self) { char *result = 0 ; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } { try { result = (char *)MeCab::Tagger::version(); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_FromCharPtr((const char *)result); return vresult; fail: return Qnil; } SWIGINTERN VALUE _wrap_new_Tagger__SWIG_0(int argc, VALUE *argv, VALUE self) { char *arg1 = (char *) 0 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; MeCab::Tagger *result = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","MeCab::Tagger", 1, argv[0] )); } arg1 = reinterpret_cast< char * >(buf1); { try { result = (MeCab::Tagger *)new_MeCab_Tagger((char const *)arg1); DATA_PTR(self) = result; } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } if (alloc1 == SWIG_NEWOBJ) delete[] buf1; return self; fail: if (alloc1 == SWIG_NEWOBJ) delete[] buf1; return Qnil; } #ifdef HAVE_RB_DEFINE_ALLOC_FUNC SWIGINTERN VALUE _wrap_Tagger_allocate(VALUE self) { #else SWIGINTERN VALUE _wrap_Tagger_allocate(int argc, VALUE *argv, VALUE self) { #endif VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_MeCab__Tagger); #ifndef HAVE_RB_DEFINE_ALLOC_FUNC rb_obj_call_init(vresult, argc, argv); #endif return vresult; } SWIGINTERN VALUE _wrap_new_Tagger__SWIG_1(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *result = 0 ; if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } { try { result = (MeCab::Tagger *)new_MeCab_Tagger(); DATA_PTR(self) = result; } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } return self; fail: return Qnil; } SWIGINTERN VALUE _wrap_new_Tagger(int nargs, VALUE *args, VALUE self) { int argc; VALUE argv[1]; int ii; argc = nargs; if (argc > 1) SWIG_fail; for (ii = 0; (ii < argc); ++ii) { argv[ii] = args[ii]; } if (argc == 0) { return _wrap_new_Tagger__SWIG_1(nargs, args, self); } if (argc == 1) { int _v; int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_new_Tagger__SWIG_0(nargs, args, self); } } fail: Ruby_Format_OverloadedError( argc, 1, "Tagger.new", " Tagger.new(char const *argc)\n" " Tagger.new()\n"); return Qnil; } SWIGINTERN VALUE _wrap_Tagger_parseToString__SWIG_0(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; char *arg2 = (char *) 0 ; size_t arg3 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; size_t val3 ; int ecode3 = 0 ; char *result = 0 ; VALUE vresult = Qnil; if ((argc < 2) || (argc > 2)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger *","parseToString", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","parseToString", 2, argv[0] )); } arg2 = reinterpret_cast< char * >(buf2); ecode3 = SWIG_AsVal_size_t(argv[1], &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "size_t","parseToString", 3, argv[1] )); } arg3 = static_cast< size_t >(val3); { try { result = (char *)MeCab_Tagger_parseToString__SWIG_0(arg1,(char const *)arg2,arg3); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_FromCharPtr((const char *)result); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return vresult; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return Qnil; } SWIGINTERN VALUE _wrap_Tagger_parseToString__SWIG_1(int argc, VALUE *argv, VALUE self) { MeCab::Tagger *arg1 = (MeCab::Tagger *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; char *result = 0 ; VALUE vresult = Qnil; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MeCab__Tagger, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MeCab::Tagger *","parseToString", 1, self )); } arg1 = reinterpret_cast< MeCab::Tagger * >(argp1); res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","parseToString", 2, argv[0] )); } arg2 = reinterpret_cast< char * >(buf2); { try { result = (char *)MeCab_Tagger_parseToString__SWIG_0(arg1,(char const *)arg2); } catch (char *e) { SWIG_exception (SWIG_RuntimeError, e); } catch (const char *e) { SWIG_exception (SWIG_RuntimeError, (char*)e); } } vresult = SWIG_FromCharPtr((const char *)result); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return vresult; fail: if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return Qnil; } SWIGINTERN VALUE _wrap_Tagger_parseToString(int nargs, VALUE *args, VALUE self) { int argc; VALUE argv[4]; int ii; argc = nargs + 1; argv[0] = self; if (argc > 4) SWIG_fail; for (ii = 1; (ii < argc); ++ii) { argv[ii] = args[ii-1]; } if (argc == 2) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_MeCab__Tagger, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { return _wrap_Tagger_parseToString__SWIG_1(nargs, args, self); } } } if (argc == 3) { int _v; void *vptr = 0; int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_MeCab__Tagger, 0); _v = SWIG_CheckState(res); if (_v) { int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); _v = SWIG_CheckState(res); if (_v) { { int res = SWIG_AsVal_size_t(argv[2], NULL); _v = SWIG_CheckState(res); } if (_v) { return _wrap_Tagger_parseToString__SWIG_0(nargs, args, self); } } } } fail: Ruby_Format_OverloadedError( argc, 4, "parseToString", " char const * parseToString(char const *str, size_t length)\n" " char const * parseToString(char const *str)\n"); return Qnil; } /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ static swig_type_info _swigt__p_MeCab__Lattice = {"_p_MeCab__Lattice", "MeCab::Lattice *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_MeCab__Model = {"_p_MeCab__Model", "MeCab::Model *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_MeCab__Tagger = {"_p_MeCab__Tagger", "MeCab::Tagger *", 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_mecab_dictionary_info_t = {"_p_mecab_dictionary_info_t", "MeCab::DictionaryInfo *|mecab_dictionary_info_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_mecab_node_t = {"_p_mecab_node_t", "mecab_node_t *|MeCab::Node *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_mecab_path_t = {"_p_mecab_path_t", "mecab_path_t *|MeCab::Path *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_mecab_t = {"_p_mecab_t", "mecab_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_MeCab__Lattice, &_swigt__p_MeCab__Model, &_swigt__p_MeCab__Tagger, &_swigt__p_char, &_swigt__p_mecab_dictionary_info_t, &_swigt__p_mecab_node_t, &_swigt__p_mecab_path_t, &_swigt__p_mecab_t, &_swigt__p_p_char, }; static swig_cast_info _swigc__p_MeCab__Lattice[] = { {&_swigt__p_MeCab__Lattice, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_MeCab__Model[] = { {&_swigt__p_MeCab__Model, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_MeCab__Tagger[] = { {&_swigt__p_MeCab__Tagger, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_mecab_dictionary_info_t[] = { {&_swigt__p_mecab_dictionary_info_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_mecab_node_t[] = { {&_swigt__p_mecab_node_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_mecab_path_t[] = { {&_swigt__p_mecab_path_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_mecab_t[] = { {&_swigt__p_mecab_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_MeCab__Lattice, _swigc__p_MeCab__Model, _swigc__p_MeCab__Tagger, _swigc__p_char, _swigc__p_mecab_dictionary_info_t, _swigc__p_mecab_node_t, _swigc__p_mecab_path_t, _swigc__p_mecab_t, _swigc__p_p_char, }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ /* ----------------------------------------------------------------------------- * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. * ----------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #if 0 } /* c-mode */ #endif #endif #if 0 #define SWIGRUNTIME_DEBUG #endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; int found, init; clientdata = clientdata; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { /* Initialize the swig_module */ 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 */ module_head = SWIG_GetModule(clientdata); if (!module_head) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ found=0; iter=module_head; do { if (iter==&swig_module) { found=1; break; } iter=iter->next; } while (iter!= module_head); /* if the is found in the list, then all is done and we may leave */ if (found) return; /* otherwise we must add out module into the list */ swig_module.next = module_head->next; 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); #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); #endif /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found type %s\n", type->name); #endif if (swig_module.type_initial[i]->clientdata) { type->clientdata = swig_module.type_initial[i]->clientdata; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); #endif } } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); #ifdef SWIGRUNTIME_DEBUG if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); #endif } if (ret) { if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: skip old type %s\n", ret->name); #endif cast->type = ret; ret = 0; } else { /* Check for casting already in the list */ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); #ifdef SWIGRUNTIME_DEBUG if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); #endif if (!ocast) ret = 0; } } if (!ret) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } swig_module.types[i] = 0; #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { int j = 0; swig_cast_info *cast = swig_module.cast_initial[i]; printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); while (cast->type) { printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); cast++; ++j; } printf("---- Total casts: %d\n",j); } printf("**** SWIG_InitializeModule: Cast List ******\n"); #endif } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus #if 0 { /* c-mode */ #endif } #endif /* */ #ifdef __cplusplus extern "C" #endif SWIGEXPORT void Init_MeCab(void) { size_t i; SWIG_InitRuntime(); mMeCab = rb_define_module("MeCab"); SWIG_InitializeModule(0); for (i = 0; i < swig_module.size; i++) { SWIG_define_class(swig_module.types[i]); } SWIG_RubyInitializeTrackings(); SwigClassDictionaryInfo.klass = rb_define_class_under(mMeCab, "DictionaryInfo", rb_cObject); SWIG_TypeClientData(SWIGTYPE_p_mecab_dictionary_info_t, (void *) &SwigClassDictionaryInfo); rb_define_alloc_func(SwigClassDictionaryInfo.klass, _wrap_DictionaryInfo_allocate); rb_define_method(SwigClassDictionaryInfo.klass, "initialize", VALUEFUNC(_wrap_new_DictionaryInfo), -1); rb_define_method(SwigClassDictionaryInfo.klass, "filename", VALUEFUNC(_wrap_DictionaryInfo_filename_get), -1); rb_define_method(SwigClassDictionaryInfo.klass, "charset", VALUEFUNC(_wrap_DictionaryInfo_charset_get), -1); rb_define_method(SwigClassDictionaryInfo.klass, "size", VALUEFUNC(_wrap_DictionaryInfo_size_get), -1); rb_define_method(SwigClassDictionaryInfo.klass, "type", VALUEFUNC(_wrap_DictionaryInfo_type_get), -1); rb_define_method(SwigClassDictionaryInfo.klass, "lsize", VALUEFUNC(_wrap_DictionaryInfo_lsize_get), -1); rb_define_method(SwigClassDictionaryInfo.klass, "rsize", VALUEFUNC(_wrap_DictionaryInfo_rsize_get), -1); rb_define_method(SwigClassDictionaryInfo.klass, "version", VALUEFUNC(_wrap_DictionaryInfo_version_get), -1); rb_define_method(SwigClassDictionaryInfo.klass, "next", VALUEFUNC(_wrap_DictionaryInfo_next_get), -1); SwigClassDictionaryInfo.mark = 0; SwigClassDictionaryInfo.destroy = (void (*)(void *)) free_mecab_dictionary_info_t; SwigClassDictionaryInfo.trackObjects = 0; SwigClassPath.klass = rb_define_class_under(mMeCab, "Path", rb_cObject); SWIG_TypeClientData(SWIGTYPE_p_mecab_path_t, (void *) &SwigClassPath); rb_undef_alloc_func(SwigClassPath.klass); rb_define_method(SwigClassPath.klass, "rnode", VALUEFUNC(_wrap_Path_rnode_get), -1); rb_define_method(SwigClassPath.klass, "rnext", VALUEFUNC(_wrap_Path_rnext_get), -1); rb_define_method(SwigClassPath.klass, "lnode", VALUEFUNC(_wrap_Path_lnode_get), -1); rb_define_method(SwigClassPath.klass, "lnext", VALUEFUNC(_wrap_Path_lnext_get), -1); rb_define_method(SwigClassPath.klass, "cost", VALUEFUNC(_wrap_Path_cost_get), -1); rb_define_method(SwigClassPath.klass, "prob=", VALUEFUNC(_wrap_Path_prob_set), -1); rb_define_method(SwigClassPath.klass, "prob", VALUEFUNC(_wrap_Path_prob_get), -1); SwigClassPath.mark = 0; SwigClassPath.trackObjects = 0; SwigClassNode.klass = rb_define_class_under(mMeCab, "Node", rb_cObject); SWIG_TypeClientData(SWIGTYPE_p_mecab_node_t, (void *) &SwigClassNode); rb_undef_alloc_func(SwigClassNode.klass); rb_define_method(SwigClassNode.klass, "prev", VALUEFUNC(_wrap_Node_prev_get), -1); rb_define_method(SwigClassNode.klass, "next", VALUEFUNC(_wrap_Node_next_get), -1); rb_define_method(SwigClassNode.klass, "enext", VALUEFUNC(_wrap_Node_enext_get), -1); rb_define_method(SwigClassNode.klass, "bnext", VALUEFUNC(_wrap_Node_bnext_get), -1); rb_define_method(SwigClassNode.klass, "rpath", VALUEFUNC(_wrap_Node_rpath_get), -1); rb_define_method(SwigClassNode.klass, "lpath", VALUEFUNC(_wrap_Node_lpath_get), -1); rb_define_method(SwigClassNode.klass, "feature", VALUEFUNC(_wrap_Node_feature_get), -1); rb_define_method(SwigClassNode.klass, "id", VALUEFUNC(_wrap_Node_id_get), -1); rb_define_method(SwigClassNode.klass, "length", VALUEFUNC(_wrap_Node_length_get), -1); rb_define_method(SwigClassNode.klass, "rlength", VALUEFUNC(_wrap_Node_rlength_get), -1); rb_define_method(SwigClassNode.klass, "rcAttr", VALUEFUNC(_wrap_Node_rcAttr_get), -1); rb_define_method(SwigClassNode.klass, "lcAttr", VALUEFUNC(_wrap_Node_lcAttr_get), -1); rb_define_method(SwigClassNode.klass, "posid", VALUEFUNC(_wrap_Node_posid_get), -1); rb_define_method(SwigClassNode.klass, "char_type", VALUEFUNC(_wrap_Node_char_type_get), -1); rb_define_method(SwigClassNode.klass, "stat", VALUEFUNC(_wrap_Node_stat_get), -1); rb_define_method(SwigClassNode.klass, "isbest", VALUEFUNC(_wrap_Node_isbest_get), -1); rb_define_method(SwigClassNode.klass, "alpha", VALUEFUNC(_wrap_Node_alpha_get), -1); rb_define_method(SwigClassNode.klass, "beta", VALUEFUNC(_wrap_Node_beta_get), -1); rb_define_method(SwigClassNode.klass, "prob=", VALUEFUNC(_wrap_Node_prob_set), -1); rb_define_method(SwigClassNode.klass, "prob", VALUEFUNC(_wrap_Node_prob_get), -1); rb_define_method(SwigClassNode.klass, "wcost", VALUEFUNC(_wrap_Node_wcost_get), -1); rb_define_method(SwigClassNode.klass, "cost", VALUEFUNC(_wrap_Node_cost_get), -1); rb_define_method(SwigClassNode.klass, "surface", VALUEFUNC(_wrap_Node_surface_get), -1); SwigClassNode.mark = 0; SwigClassNode.trackObjects = 0; rb_define_const(mMeCab, "MECAB_NOR_NODE", SWIG_From_int(static_cast< int >(MECAB_NOR_NODE))); rb_define_const(mMeCab, "MECAB_UNK_NODE", SWIG_From_int(static_cast< int >(MECAB_UNK_NODE))); rb_define_const(mMeCab, "MECAB_BOS_NODE", SWIG_From_int(static_cast< int >(MECAB_BOS_NODE))); rb_define_const(mMeCab, "MECAB_EOS_NODE", SWIG_From_int(static_cast< int >(MECAB_EOS_NODE))); rb_define_const(mMeCab, "MECAB_EON_NODE", SWIG_From_int(static_cast< int >(MECAB_EON_NODE))); rb_define_const(mMeCab, "MECAB_SYS_DIC", SWIG_From_int(static_cast< int >(MECAB_SYS_DIC))); rb_define_const(mMeCab, "MECAB_USR_DIC", SWIG_From_int(static_cast< int >(MECAB_USR_DIC))); rb_define_const(mMeCab, "MECAB_UNK_DIC", SWIG_From_int(static_cast< int >(MECAB_UNK_DIC))); rb_define_const(mMeCab, "MECAB_ONE_BEST", SWIG_From_int(static_cast< int >(MECAB_ONE_BEST))); rb_define_const(mMeCab, "MECAB_NBEST", SWIG_From_int(static_cast< int >(MECAB_NBEST))); rb_define_const(mMeCab, "MECAB_PARTIAL", SWIG_From_int(static_cast< int >(MECAB_PARTIAL))); rb_define_const(mMeCab, "MECAB_MARGINAL_PROB", SWIG_From_int(static_cast< int >(MECAB_MARGINAL_PROB))); rb_define_const(mMeCab, "MECAB_ALTERNATIVE", SWIG_From_int(static_cast< int >(MECAB_ALTERNATIVE))); rb_define_const(mMeCab, "MECAB_ALL_MORPHS", SWIG_From_int(static_cast< int >(MECAB_ALL_MORPHS))); rb_define_const(mMeCab, "MECAB_ALLOCATE_SENTENCE", SWIG_From_int(static_cast< int >(MECAB_ALLOCATE_SENTENCE))); rb_define_const(mMeCab, "MECAB_ANY_BOUNDARY", SWIG_From_int(static_cast< int >(MECAB_ANY_BOUNDARY))); rb_define_const(mMeCab, "MECAB_TOKEN_BOUNDARY", SWIG_From_int(static_cast< int >(MECAB_TOKEN_BOUNDARY))); rb_define_const(mMeCab, "MECAB_INSIDE_TOKEN", SWIG_From_int(static_cast< int >(MECAB_INSIDE_TOKEN))); SwigClassLattice.klass = rb_define_class_under(mMeCab, "Lattice", rb_cObject); SWIG_TypeClientData(SWIGTYPE_p_MeCab__Lattice, (void *) &SwigClassLattice); rb_define_alloc_func(SwigClassLattice.klass, _wrap_Lattice_allocate); rb_define_method(SwigClassLattice.klass, "initialize", VALUEFUNC(_wrap_new_Lattice), -1); rb_define_method(SwigClassLattice.klass, "clear", VALUEFUNC(_wrap_Lattice_clear), -1); rb_define_method(SwigClassLattice.klass, "is_available", VALUEFUNC(_wrap_Lattice_is_available), -1); rb_define_method(SwigClassLattice.klass, "bos_node", VALUEFUNC(_wrap_Lattice_bos_node), -1); rb_define_method(SwigClassLattice.klass, "eos_node", VALUEFUNC(_wrap_Lattice_eos_node), -1); rb_define_method(SwigClassLattice.klass, "end_nodes", VALUEFUNC(_wrap_Lattice_end_nodes), -1); rb_define_method(SwigClassLattice.klass, "begin_nodes", VALUEFUNC(_wrap_Lattice_begin_nodes), -1); rb_define_method(SwigClassLattice.klass, "sentence", VALUEFUNC(_wrap_Lattice_sentence), -1); rb_define_method(SwigClassLattice.klass, "size", VALUEFUNC(_wrap_Lattice_size), -1); rb_define_method(SwigClassLattice.klass, "set_Z", VALUEFUNC(_wrap_Lattice_set_Z), -1); rb_define_method(SwigClassLattice.klass, "Z", VALUEFUNC(_wrap_Lattice_Z), -1); rb_define_method(SwigClassLattice.klass, "set_theta", VALUEFUNC(_wrap_Lattice_set_theta), -1); rb_define_method(SwigClassLattice.klass, "theta", VALUEFUNC(_wrap_Lattice_theta), -1); rb_define_method(SwigClassLattice.klass, "next", VALUEFUNC(_wrap_Lattice_next), -1); rb_define_method(SwigClassLattice.klass, "request_type", VALUEFUNC(_wrap_Lattice_request_type), -1); rb_define_method(SwigClassLattice.klass, "has_request_type", VALUEFUNC(_wrap_Lattice_has_request_type), -1); rb_define_method(SwigClassLattice.klass, "set_request_type", VALUEFUNC(_wrap_Lattice_set_request_type), -1); rb_define_method(SwigClassLattice.klass, "add_request_type", VALUEFUNC(_wrap_Lattice_add_request_type), -1); rb_define_method(SwigClassLattice.klass, "remove_request_type", VALUEFUNC(_wrap_Lattice_remove_request_type), -1); rb_define_method(SwigClassLattice.klass, "newNode", VALUEFUNC(_wrap_Lattice_newNode), -1); rb_define_method(SwigClassLattice.klass, "toString", VALUEFUNC(_wrap_Lattice_toString), -1); rb_define_method(SwigClassLattice.klass, "enumNBestAsString", VALUEFUNC(_wrap_Lattice_enumNBestAsString), -1); rb_define_method(SwigClassLattice.klass, "has_constraint", VALUEFUNC(_wrap_Lattice_has_constraint), -1); rb_define_method(SwigClassLattice.klass, "boundary_constraint", VALUEFUNC(_wrap_Lattice_boundary_constraint), -1); rb_define_method(SwigClassLattice.klass, "feature_constraint", VALUEFUNC(_wrap_Lattice_feature_constraint), -1); rb_define_method(SwigClassLattice.klass, "set_boundary_constraint", VALUEFUNC(_wrap_Lattice_set_boundary_constraint), -1); rb_define_method(SwigClassLattice.klass, "set_feature_constraint", VALUEFUNC(_wrap_Lattice_set_feature_constraint), -1); rb_define_method(SwigClassLattice.klass, "set_result", VALUEFUNC(_wrap_Lattice_set_result), -1); rb_define_method(SwigClassLattice.klass, "what", VALUEFUNC(_wrap_Lattice_what), -1); rb_define_method(SwigClassLattice.klass, "set_what", VALUEFUNC(_wrap_Lattice_set_what), -1); rb_define_method(SwigClassLattice.klass, "set_sentence", VALUEFUNC(_wrap_Lattice_set_sentence), -1); SwigClassLattice.mark = 0; SwigClassLattice.destroy = (void (*)(void *)) free_MeCab_Lattice; SwigClassLattice.trackObjects = 0; SwigClassModel.klass = rb_define_class_under(mMeCab, "Model", rb_cObject); SWIG_TypeClientData(SWIGTYPE_p_MeCab__Model, (void *) &SwigClassModel); rb_define_alloc_func(SwigClassModel.klass, _wrap_Model_allocate); rb_define_method(SwigClassModel.klass, "initialize", VALUEFUNC(_wrap_new_Model), -1); rb_define_method(SwigClassModel.klass, "dictionary_info", VALUEFUNC(_wrap_Model_dictionary_info), -1); rb_define_method(SwigClassModel.klass, "transition_cost", VALUEFUNC(_wrap_Model_transition_cost), -1); rb_define_method(SwigClassModel.klass, "lookup", VALUEFUNC(_wrap_Model_lookup), -1); rb_define_method(SwigClassModel.klass, "createTagger", VALUEFUNC(_wrap_Model_createTagger), -1); rb_define_method(SwigClassModel.klass, "createLattice", VALUEFUNC(_wrap_Model_createLattice), -1); rb_define_method(SwigClassModel.klass, "swap", VALUEFUNC(_wrap_Model_swap), -1); rb_define_singleton_method(SwigClassModel.klass, "version", VALUEFUNC(_wrap_Model_version), -1); rb_define_singleton_method(SwigClassModel.klass, "create", VALUEFUNC(_wrap_Model_create), -1); SwigClassModel.mark = 0; SwigClassModel.destroy = (void (*)(void *)) free_MeCab_Model; SwigClassModel.trackObjects = 0; SwigClassTagger.klass = rb_define_class_under(mMeCab, "Tagger", rb_cObject); SWIG_TypeClientData(SWIGTYPE_p_MeCab__Tagger, (void *) &SwigClassTagger); rb_define_alloc_func(SwigClassTagger.klass, _wrap_Tagger_allocate); rb_define_method(SwigClassTagger.klass, "initialize", VALUEFUNC(_wrap_new_Tagger), -1); rb_define_method(SwigClassTagger.klass, "parse", VALUEFUNC(_wrap_Tagger_parse), -1); rb_define_method(SwigClassTagger.klass, "parseToNode", VALUEFUNC(_wrap_Tagger_parseToNode), -1); rb_define_method(SwigClassTagger.klass, "parseNBest", VALUEFUNC(_wrap_Tagger_parseNBest), -1); rb_define_method(SwigClassTagger.klass, "parseNBestInit", VALUEFUNC(_wrap_Tagger_parseNBestInit), -1); rb_define_method(SwigClassTagger.klass, "nextNode", VALUEFUNC(_wrap_Tagger_nextNode), -1); rb_define_method(SwigClassTagger.klass, "next", VALUEFUNC(_wrap_Tagger_next), -1); rb_define_method(SwigClassTagger.klass, "formatNode", VALUEFUNC(_wrap_Tagger_formatNode), -1); rb_define_method(SwigClassTagger.klass, "set_request_type", VALUEFUNC(_wrap_Tagger_set_request_type), -1); rb_define_method(SwigClassTagger.klass, "request_type", VALUEFUNC(_wrap_Tagger_request_type), -1); rb_define_method(SwigClassTagger.klass, "partial", VALUEFUNC(_wrap_Tagger_partial), -1); rb_define_method(SwigClassTagger.klass, "set_partial", VALUEFUNC(_wrap_Tagger_set_partial), -1); rb_define_method(SwigClassTagger.klass, "lattice_level", VALUEFUNC(_wrap_Tagger_lattice_level), -1); rb_define_method(SwigClassTagger.klass, "set_lattice_level", VALUEFUNC(_wrap_Tagger_set_lattice_level), -1); rb_define_method(SwigClassTagger.klass, "all_morphs", VALUEFUNC(_wrap_Tagger_all_morphs), -1); rb_define_method(SwigClassTagger.klass, "set_all_morphs", VALUEFUNC(_wrap_Tagger_set_all_morphs), -1); rb_define_method(SwigClassTagger.klass, "set_theta", VALUEFUNC(_wrap_Tagger_set_theta), -1); rb_define_method(SwigClassTagger.klass, "theta", VALUEFUNC(_wrap_Tagger_theta), -1); rb_define_method(SwigClassTagger.klass, "dictionary_info", VALUEFUNC(_wrap_Tagger_dictionary_info), -1); rb_define_method(SwigClassTagger.klass, "what", VALUEFUNC(_wrap_Tagger_what), -1); rb_define_singleton_method(SwigClassTagger.klass, "create", VALUEFUNC(_wrap_Tagger_create), -1); rb_define_singleton_method(SwigClassTagger.klass, "version", VALUEFUNC(_wrap_Tagger_version), -1); rb_define_method(SwigClassTagger.klass, "parseToString", VALUEFUNC(_wrap_Tagger_parseToString), -1); SwigClassTagger.mark = 0; SwigClassTagger.destroy = (void (*)(void *)) free_MeCab_Tagger; SwigClassTagger.trackObjects = 0; rb_define_const(mMeCab, "VERSION", SWIG_FromCharPtr("0.996")); } mecab-ruby-0.996/test.rb0000644002562000116100000000253612110211100013351 0ustar takueng#!/usr/bin/ruby # -*- coding: utf-8 -*- require 'MeCab' sentence = "太郎はこの本を二郎を見た女性に渡した。" begin print MeCab::VERSION, "\n" model = MeCab::Model.new(ARGV.join(" ")) tagger = model.createTagger() puts tagger.parse(sentence) n = tagger.parseToNode(sentence) while n do print n.surface, "\t", n.feature, "\t", n.cost, "\n" n = n.next end print "EOS\n"; lattice = MeCab::Lattice.new() lattice.set_sentence(sentence) tagger.parse(lattice) len = lattice.size() for i in 0..len b = lattice.begin_nodes(i) while b do printf "B[%d] %s\t%s\n", i, b.surface, b.feature; b = b.bnext end e = lattice.end_nodes(i) while e do printf "E[%d] %s\t%s\n", i, e.surface, e.feature; e = e.bnext end end print "EOS\n"; lattice.set_sentence(sentence) lattice.set_request_type(MeCab::MECAB_NBEST) tagger.parse(lattice) for i in 0..10 lattice.next() print lattice.toString() end d = model.dictionary_info() while d do printf "filename: %s\n", d.filename printf "charset: %s\n", d.charset printf "size: %d\n", d.size printf "type: %d\n", d.type printf "lsize: %d\n", d.lsize printf "rsize: %d\n", d.rsize printf "version: %d\n", d.version d = d.next end rescue print "RuntimeError: ", $!, "\n"; end