uhferret_lib_wrap.cxx 319 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727
  1. /* ----------------------------------------------------------------------------
  2. * This file was automatically generated by SWIG (http://www.swig.org).
  3. * Version 2.0.4
  4. *
  5. * This file is not intended to be easily readable and contains a number of
  6. * coding conventions designed to improve portability and efficiency. Do not make
  7. * changes to this file unless you know what you are doing--modify the SWIG
  8. * interface file instead.
  9. * ----------------------------------------------------------------------------- */
  10. #define SWIGRUBY
  11. #ifdef __cplusplus
  12. /* SwigValueWrapper is described in swig.swg */
  13. template<typename T> class SwigValueWrapper {
  14. struct SwigMovePointer {
  15. T *ptr;
  16. SwigMovePointer(T *p) : ptr(p) { }
  17. ~SwigMovePointer() { delete ptr; }
  18. SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
  19. } pointer;
  20. SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
  21. SwigValueWrapper(const SwigValueWrapper<T>& rhs);
  22. public:
  23. SwigValueWrapper() : pointer(0) { }
  24. SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
  25. operator T&() const { return *pointer.ptr; }
  26. T *operator&() { return pointer.ptr; }
  27. };
  28. template <typename T> T SwigValueInit() {
  29. return T();
  30. }
  31. #endif
  32. /* -----------------------------------------------------------------------------
  33. * This section contains generic SWIG labels for method/variable
  34. * declarations/attributes, and other compiler dependent labels.
  35. * ----------------------------------------------------------------------------- */
  36. /* template workaround for compilers that cannot correctly implement the C++ standard */
  37. #ifndef SWIGTEMPLATEDISAMBIGUATOR
  38. # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
  39. # define SWIGTEMPLATEDISAMBIGUATOR template
  40. # elif defined(__HP_aCC)
  41. /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
  42. /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
  43. # define SWIGTEMPLATEDISAMBIGUATOR template
  44. # else
  45. # define SWIGTEMPLATEDISAMBIGUATOR
  46. # endif
  47. #endif
  48. /* inline attribute */
  49. #ifndef SWIGINLINE
  50. # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
  51. # define SWIGINLINE inline
  52. # else
  53. # define SWIGINLINE
  54. # endif
  55. #endif
  56. /* attribute recognised by some compilers to avoid 'unused' warnings */
  57. #ifndef SWIGUNUSED
  58. # if defined(__GNUC__)
  59. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  60. # define SWIGUNUSED __attribute__ ((__unused__))
  61. # else
  62. # define SWIGUNUSED
  63. # endif
  64. # elif defined(__ICC)
  65. # define SWIGUNUSED __attribute__ ((__unused__))
  66. # else
  67. # define SWIGUNUSED
  68. # endif
  69. #endif
  70. #ifndef SWIG_MSC_UNSUPPRESS_4505
  71. # if defined(_MSC_VER)
  72. # pragma warning(disable : 4505) /* unreferenced local function has been removed */
  73. # endif
  74. #endif
  75. #ifndef SWIGUNUSEDPARM
  76. # ifdef __cplusplus
  77. # define SWIGUNUSEDPARM(p)
  78. # else
  79. # define SWIGUNUSEDPARM(p) p SWIGUNUSED
  80. # endif
  81. #endif
  82. /* internal SWIG method */
  83. #ifndef SWIGINTERN
  84. # define SWIGINTERN static SWIGUNUSED
  85. #endif
  86. /* internal inline SWIG method */
  87. #ifndef SWIGINTERNINLINE
  88. # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
  89. #endif
  90. /* exporting methods */
  91. #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
  92. # ifndef GCC_HASCLASSVISIBILITY
  93. # define GCC_HASCLASSVISIBILITY
  94. # endif
  95. #endif
  96. #ifndef SWIGEXPORT
  97. # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
  98. # if defined(STATIC_LINKED)
  99. # define SWIGEXPORT
  100. # else
  101. # define SWIGEXPORT __declspec(dllexport)
  102. # endif
  103. # else
  104. # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
  105. # define SWIGEXPORT __attribute__ ((visibility("default")))
  106. # else
  107. # define SWIGEXPORT
  108. # endif
  109. # endif
  110. #endif
  111. /* calling conventions for Windows */
  112. #ifndef SWIGSTDCALL
  113. # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
  114. # define SWIGSTDCALL __stdcall
  115. # else
  116. # define SWIGSTDCALL
  117. # endif
  118. #endif
  119. /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
  120. #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
  121. # define _CRT_SECURE_NO_DEPRECATE
  122. #endif
  123. /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
  124. #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
  125. # define _SCL_SECURE_NO_DEPRECATE
  126. #endif
  127. /* -----------------------------------------------------------------------------
  128. * This section contains generic SWIG labels for method/variable
  129. * declarations/attributes, and other compiler dependent labels.
  130. * ----------------------------------------------------------------------------- */
  131. /* template workaround for compilers that cannot correctly implement the C++ standard */
  132. #ifndef SWIGTEMPLATEDISAMBIGUATOR
  133. # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
  134. # define SWIGTEMPLATEDISAMBIGUATOR template
  135. # elif defined(__HP_aCC)
  136. /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
  137. /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
  138. # define SWIGTEMPLATEDISAMBIGUATOR template
  139. # else
  140. # define SWIGTEMPLATEDISAMBIGUATOR
  141. # endif
  142. #endif
  143. /* inline attribute */
  144. #ifndef SWIGINLINE
  145. # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
  146. # define SWIGINLINE inline
  147. # else
  148. # define SWIGINLINE
  149. # endif
  150. #endif
  151. /* attribute recognised by some compilers to avoid 'unused' warnings */
  152. #ifndef SWIGUNUSED
  153. # if defined(__GNUC__)
  154. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  155. # define SWIGUNUSED __attribute__ ((__unused__))
  156. # else
  157. # define SWIGUNUSED
  158. # endif
  159. # elif defined(__ICC)
  160. # define SWIGUNUSED __attribute__ ((__unused__))
  161. # else
  162. # define SWIGUNUSED
  163. # endif
  164. #endif
  165. #ifndef SWIG_MSC_UNSUPPRESS_4505
  166. # if defined(_MSC_VER)
  167. # pragma warning(disable : 4505) /* unreferenced local function has been removed */
  168. # endif
  169. #endif
  170. #ifndef SWIGUNUSEDPARM
  171. # ifdef __cplusplus
  172. # define SWIGUNUSEDPARM(p)
  173. # else
  174. # define SWIGUNUSEDPARM(p) p SWIGUNUSED
  175. # endif
  176. #endif
  177. /* internal SWIG method */
  178. #ifndef SWIGINTERN
  179. # define SWIGINTERN static SWIGUNUSED
  180. #endif
  181. /* internal inline SWIG method */
  182. #ifndef SWIGINTERNINLINE
  183. # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
  184. #endif
  185. /* exporting methods */
  186. #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
  187. # ifndef GCC_HASCLASSVISIBILITY
  188. # define GCC_HASCLASSVISIBILITY
  189. # endif
  190. #endif
  191. #ifndef SWIGEXPORT
  192. # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
  193. # if defined(STATIC_LINKED)
  194. # define SWIGEXPORT
  195. # else
  196. # define SWIGEXPORT __declspec(dllexport)
  197. # endif
  198. # else
  199. # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
  200. # define SWIGEXPORT __attribute__ ((visibility("default")))
  201. # else
  202. # define SWIGEXPORT
  203. # endif
  204. # endif
  205. #endif
  206. /* calling conventions for Windows */
  207. #ifndef SWIGSTDCALL
  208. # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
  209. # define SWIGSTDCALL __stdcall
  210. # else
  211. # define SWIGSTDCALL
  212. # endif
  213. #endif
  214. /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
  215. #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
  216. # define _CRT_SECURE_NO_DEPRECATE
  217. #endif
  218. /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
  219. #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
  220. # define _SCL_SECURE_NO_DEPRECATE
  221. #endif
  222. /* -----------------------------------------------------------------------------
  223. * swigrun.swg
  224. *
  225. * This file contains generic C API SWIG runtime support for pointer
  226. * type checking.
  227. * ----------------------------------------------------------------------------- */
  228. /* This should only be incremented when either the layout of swig_type_info changes,
  229. or for whatever reason, the runtime changes incompatibly */
  230. #define SWIG_RUNTIME_VERSION "4"
  231. /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
  232. #ifdef SWIG_TYPE_TABLE
  233. # define SWIG_QUOTE_STRING(x) #x
  234. # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
  235. # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
  236. #else
  237. # define SWIG_TYPE_TABLE_NAME
  238. #endif
  239. /*
  240. You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
  241. creating a static or dynamic library from the SWIG runtime code.
  242. In 99.9% of the cases, SWIG just needs to declare them as 'static'.
  243. But only do this if strictly necessary, ie, if you have problems
  244. with your compiler or suchlike.
  245. */
  246. #ifndef SWIGRUNTIME
  247. # define SWIGRUNTIME SWIGINTERN
  248. #endif
  249. #ifndef SWIGRUNTIMEINLINE
  250. # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
  251. #endif
  252. /* Generic buffer size */
  253. #ifndef SWIG_BUFFER_SIZE
  254. # define SWIG_BUFFER_SIZE 1024
  255. #endif
  256. /* Flags for pointer conversions */
  257. #define SWIG_POINTER_DISOWN 0x1
  258. #define SWIG_CAST_NEW_MEMORY 0x2
  259. /* Flags for new pointer objects */
  260. #define SWIG_POINTER_OWN 0x1
  261. /*
  262. Flags/methods for returning states.
  263. The SWIG conversion methods, as ConvertPtr, return an integer
  264. that tells if the conversion was successful or not. And if not,
  265. an error code can be returned (see swigerrors.swg for the codes).
  266. Use the following macros/flags to set or process the returning
  267. states.
  268. In old versions of SWIG, code such as the following was usually written:
  269. if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
  270. // success code
  271. } else {
  272. //fail code
  273. }
  274. Now you can be more explicit:
  275. int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
  276. if (SWIG_IsOK(res)) {
  277. // success code
  278. } else {
  279. // fail code
  280. }
  281. which is the same really, but now you can also do
  282. Type *ptr;
  283. int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
  284. if (SWIG_IsOK(res)) {
  285. // success code
  286. if (SWIG_IsNewObj(res) {
  287. ...
  288. delete *ptr;
  289. } else {
  290. ...
  291. }
  292. } else {
  293. // fail code
  294. }
  295. I.e., now SWIG_ConvertPtr can return new objects and you can
  296. identify the case and take care of the deallocation. Of course that
  297. also requires SWIG_ConvertPtr to return new result values, such as
  298. int SWIG_ConvertPtr(obj, ptr,...) {
  299. if (<obj is ok>) {
  300. if (<need new object>) {
  301. *ptr = <ptr to new allocated object>;
  302. return SWIG_NEWOBJ;
  303. } else {
  304. *ptr = <ptr to old object>;
  305. return SWIG_OLDOBJ;
  306. }
  307. } else {
  308. return SWIG_BADOBJ;
  309. }
  310. }
  311. Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
  312. more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
  313. SWIG errors code.
  314. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
  315. allows to return the 'cast rank', for example, if you have this
  316. int food(double)
  317. int fooi(int);
  318. and you call
  319. food(1) // cast rank '1' (1 -> 1.0)
  320. fooi(1) // cast rank '0'
  321. just use the SWIG_AddCast()/SWIG_CheckState()
  322. */
  323. #define SWIG_OK (0)
  324. #define SWIG_ERROR (-1)
  325. #define SWIG_IsOK(r) (r >= 0)
  326. #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
  327. /* The CastRankLimit says how many bits are used for the cast rank */
  328. #define SWIG_CASTRANKLIMIT (1 << 8)
  329. /* The NewMask denotes the object was created (using new/malloc) */
  330. #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
  331. /* The TmpMask is for in/out typemaps that use temporal objects */
  332. #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
  333. /* Simple returning values */
  334. #define SWIG_BADOBJ (SWIG_ERROR)
  335. #define SWIG_OLDOBJ (SWIG_OK)
  336. #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
  337. #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
  338. /* Check, add and del mask methods */
  339. #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
  340. #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
  341. #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
  342. #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
  343. #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
  344. #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
  345. /* Cast-Rank Mode */
  346. #if defined(SWIG_CASTRANK_MODE)
  347. # ifndef SWIG_TypeRank
  348. # define SWIG_TypeRank unsigned long
  349. # endif
  350. # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
  351. # define SWIG_MAXCASTRANK (2)
  352. # endif
  353. # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
  354. # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
  355. SWIGINTERNINLINE int SWIG_AddCast(int r) {
  356. return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
  357. }
  358. SWIGINTERNINLINE int SWIG_CheckState(int r) {
  359. return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
  360. }
  361. #else /* no cast-rank mode */
  362. # define SWIG_AddCast
  363. # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
  364. #endif
  365. #include <string.h>
  366. #ifdef __cplusplus
  367. extern "C" {
  368. #endif
  369. typedef void *(*swig_converter_func)(void *, int *);
  370. typedef struct swig_type_info *(*swig_dycast_func)(void **);
  371. /* Structure to store information on one type */
  372. typedef struct swig_type_info {
  373. const char *name; /* mangled name of this type */
  374. const char *str; /* human readable name of this type */
  375. swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
  376. struct swig_cast_info *cast; /* linked list of types that can cast into this type */
  377. void *clientdata; /* language specific type data */
  378. int owndata; /* flag if the structure owns the clientdata */
  379. } swig_type_info;
  380. /* Structure to store a type and conversion function used for casting */
  381. typedef struct swig_cast_info {
  382. swig_type_info *type; /* pointer to type that is equivalent to this type */
  383. swig_converter_func converter; /* function to cast the void pointers */
  384. struct swig_cast_info *next; /* pointer to next cast in linked list */
  385. struct swig_cast_info *prev; /* pointer to the previous cast */
  386. } swig_cast_info;
  387. /* Structure used to store module information
  388. * Each module generates one structure like this, and the runtime collects
  389. * all of these structures and stores them in a circularly linked list.*/
  390. typedef struct swig_module_info {
  391. swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
  392. size_t size; /* Number of types in this module */
  393. struct swig_module_info *next; /* Pointer to next element in circularly linked list */
  394. swig_type_info **type_initial; /* Array of initially generated type structures */
  395. swig_cast_info **cast_initial; /* Array of initially generated casting structures */
  396. void *clientdata; /* Language specific module data */
  397. } swig_module_info;
  398. /*
  399. Compare two type names skipping the space characters, therefore
  400. "char*" == "char *" and "Class<int>" == "Class<int >", etc.
  401. Return 0 when the two name types are equivalent, as in
  402. strncmp, but skipping ' '.
  403. */
  404. SWIGRUNTIME int
  405. SWIG_TypeNameComp(const char *f1, const char *l1,
  406. const char *f2, const char *l2) {
  407. for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
  408. while ((*f1 == ' ') && (f1 != l1)) ++f1;
  409. while ((*f2 == ' ') && (f2 != l2)) ++f2;
  410. if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
  411. }
  412. return (int)((l1 - f1) - (l2 - f2));
  413. }
  414. /*
  415. Check type equivalence in a name list like <name1>|<name2>|...
  416. Return 0 if not equal, 1 if equal
  417. */
  418. SWIGRUNTIME int
  419. SWIG_TypeEquiv(const char *nb, const char *tb) {
  420. int equiv = 0;
  421. const char* te = tb + strlen(tb);
  422. const char* ne = nb;
  423. while (!equiv && *ne) {
  424. for (nb = ne; *ne; ++ne) {
  425. if (*ne == '|') break;
  426. }
  427. equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
  428. if (*ne) ++ne;
  429. }
  430. return equiv;
  431. }
  432. /*
  433. Check type equivalence in a name list like <name1>|<name2>|...
  434. Return 0 if equal, -1 if nb < tb, 1 if nb > tb
  435. */
  436. SWIGRUNTIME int
  437. SWIG_TypeCompare(const char *nb, const char *tb) {
  438. int equiv = 0;
  439. const char* te = tb + strlen(tb);
  440. const char* ne = nb;
  441. while (!equiv && *ne) {
  442. for (nb = ne; *ne; ++ne) {
  443. if (*ne == '|') break;
  444. }
  445. equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
  446. if (*ne) ++ne;
  447. }
  448. return equiv;
  449. }
  450. /*
  451. Check the typename
  452. */
  453. SWIGRUNTIME swig_cast_info *
  454. SWIG_TypeCheck(const char *c, swig_type_info *ty) {
  455. if (ty) {
  456. swig_cast_info *iter = ty->cast;
  457. while (iter) {
  458. if (strcmp(iter->type->name, c) == 0) {
  459. if (iter == ty->cast)
  460. return iter;
  461. /* Move iter to the top of the linked list */
  462. iter->prev->next = iter->next;
  463. if (iter->next)
  464. iter->next->prev = iter->prev;
  465. iter->next = ty->cast;
  466. iter->prev = 0;
  467. if (ty->cast) ty->cast->prev = iter;
  468. ty->cast = iter;
  469. return iter;
  470. }
  471. iter = iter->next;
  472. }
  473. }
  474. return 0;
  475. }
  476. /*
  477. Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
  478. */
  479. SWIGRUNTIME swig_cast_info *
  480. SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
  481. if (ty) {
  482. swig_cast_info *iter = ty->cast;
  483. while (iter) {
  484. if (iter->type == from) {
  485. if (iter == ty->cast)
  486. return iter;
  487. /* Move iter to the top of the linked list */
  488. iter->prev->next = iter->next;
  489. if (iter->next)
  490. iter->next->prev = iter->prev;
  491. iter->next = ty->cast;
  492. iter->prev = 0;
  493. if (ty->cast) ty->cast->prev = iter;
  494. ty->cast = iter;
  495. return iter;
  496. }
  497. iter = iter->next;
  498. }
  499. }
  500. return 0;
  501. }
  502. /*
  503. Cast a pointer up an inheritance hierarchy
  504. */
  505. SWIGRUNTIMEINLINE void *
  506. SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
  507. return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
  508. }
  509. /*
  510. Dynamic pointer casting. Down an inheritance hierarchy
  511. */
  512. SWIGRUNTIME swig_type_info *
  513. SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
  514. swig_type_info *lastty = ty;
  515. if (!ty || !ty->dcast) return ty;
  516. while (ty && (ty->dcast)) {
  517. ty = (*ty->dcast)(ptr);
  518. if (ty) lastty = ty;
  519. }
  520. return lastty;
  521. }
  522. /*
  523. Return the name associated with this type
  524. */
  525. SWIGRUNTIMEINLINE const char *
  526. SWIG_TypeName(const swig_type_info *ty) {
  527. return ty->name;
  528. }
  529. /*
  530. Return the pretty name associated with this type,
  531. that is an unmangled type name in a form presentable to the user.
  532. */
  533. SWIGRUNTIME const char *
  534. SWIG_TypePrettyName(const swig_type_info *type) {
  535. /* The "str" field contains the equivalent pretty names of the
  536. type, separated by vertical-bar characters. We choose
  537. to print the last name, as it is often (?) the most
  538. specific. */
  539. if (!type) return NULL;
  540. if (type->str != NULL) {
  541. const char *last_name = type->str;
  542. const char *s;
  543. for (s = type->str; *s; s++)
  544. if (*s == '|') last_name = s+1;
  545. return last_name;
  546. }
  547. else
  548. return type->name;
  549. }
  550. /*
  551. Set the clientdata field for a type
  552. */
  553. SWIGRUNTIME void
  554. SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
  555. swig_cast_info *cast = ti->cast;
  556. /* if (ti->clientdata == clientdata) return; */
  557. ti->clientdata = clientdata;
  558. while (cast) {
  559. if (!cast->converter) {
  560. swig_type_info *tc = cast->type;
  561. if (!tc->clientdata) {
  562. SWIG_TypeClientData(tc, clientdata);
  563. }
  564. }
  565. cast = cast->next;
  566. }
  567. }
  568. SWIGRUNTIME void
  569. SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
  570. SWIG_TypeClientData(ti, clientdata);
  571. ti->owndata = 1;
  572. }
  573. /*
  574. Search for a swig_type_info structure only by mangled name
  575. Search is a O(log #types)
  576. We start searching at module start, and finish searching when start == end.
  577. Note: if start == end at the beginning of the function, we go all the way around
  578. the circular list.
  579. */
  580. SWIGRUNTIME swig_type_info *
  581. SWIG_MangledTypeQueryModule(swig_module_info *start,
  582. swig_module_info *end,
  583. const char *name) {
  584. swig_module_info *iter = start;
  585. do {
  586. if (iter->size) {
  587. register size_t l = 0;
  588. register size_t r = iter->size - 1;
  589. do {
  590. /* since l+r >= 0, we can (>> 1) instead (/ 2) */
  591. register size_t i = (l + r) >> 1;
  592. const char *iname = iter->types[i]->name;
  593. if (iname) {
  594. register int compare = strcmp(name, iname);
  595. if (compare == 0) {
  596. return iter->types[i];
  597. } else if (compare < 0) {
  598. if (i) {
  599. r = i - 1;
  600. } else {
  601. break;
  602. }
  603. } else if (compare > 0) {
  604. l = i + 1;
  605. }
  606. } else {
  607. break; /* should never happen */
  608. }
  609. } while (l <= r);
  610. }
  611. iter = iter->next;
  612. } while (iter != end);
  613. return 0;
  614. }
  615. /*
  616. Search for a swig_type_info structure for either a mangled name or a human readable name.
  617. It first searches the mangled names of the types, which is a O(log #types)
  618. If a type is not found it then searches the human readable names, which is O(#types).
  619. We start searching at module start, and finish searching when start == end.
  620. Note: if start == end at the beginning of the function, we go all the way around
  621. the circular list.
  622. */
  623. SWIGRUNTIME swig_type_info *
  624. SWIG_TypeQueryModule(swig_module_info *start,
  625. swig_module_info *end,
  626. const char *name) {
  627. /* STEP 1: Search the name field using binary search */
  628. swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
  629. if (ret) {
  630. return ret;
  631. } else {
  632. /* STEP 2: If the type hasn't been found, do a complete search
  633. of the str field (the human readable name) */
  634. swig_module_info *iter = start;
  635. do {
  636. register size_t i = 0;
  637. for (; i < iter->size; ++i) {
  638. if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
  639. return iter->types[i];
  640. }
  641. iter = iter->next;
  642. } while (iter != end);
  643. }
  644. /* neither found a match */
  645. return 0;
  646. }
  647. /*
  648. Pack binary data into a string
  649. */
  650. SWIGRUNTIME char *
  651. SWIG_PackData(char *c, void *ptr, size_t sz) {
  652. static const char hex[17] = "0123456789abcdef";
  653. register const unsigned char *u = (unsigned char *) ptr;
  654. register const unsigned char *eu = u + sz;
  655. for (; u != eu; ++u) {
  656. register unsigned char uu = *u;
  657. *(c++) = hex[(uu & 0xf0) >> 4];
  658. *(c++) = hex[uu & 0xf];
  659. }
  660. return c;
  661. }
  662. /*
  663. Unpack binary data from a string
  664. */
  665. SWIGRUNTIME const char *
  666. SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
  667. register unsigned char *u = (unsigned char *) ptr;
  668. register const unsigned char *eu = u + sz;
  669. for (; u != eu; ++u) {
  670. register char d = *(c++);
  671. register unsigned char uu;
  672. if ((d >= '0') && (d <= '9'))
  673. uu = ((d - '0') << 4);
  674. else if ((d >= 'a') && (d <= 'f'))
  675. uu = ((d - ('a'-10)) << 4);
  676. else
  677. return (char *) 0;
  678. d = *(c++);
  679. if ((d >= '0') && (d <= '9'))
  680. uu |= (d - '0');
  681. else if ((d >= 'a') && (d <= 'f'))
  682. uu |= (d - ('a'-10));
  683. else
  684. return (char *) 0;
  685. *u = uu;
  686. }
  687. return c;
  688. }
  689. /*
  690. Pack 'void *' into a string buffer.
  691. */
  692. SWIGRUNTIME char *
  693. SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
  694. char *r = buff;
  695. if ((2*sizeof(void *) + 2) > bsz) return 0;
  696. *(r++) = '_';
  697. r = SWIG_PackData(r,&ptr,sizeof(void *));
  698. if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
  699. strcpy(r,name);
  700. return buff;
  701. }
  702. SWIGRUNTIME const char *
  703. SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
  704. if (*c != '_') {
  705. if (strcmp(c,"NULL") == 0) {
  706. *ptr = (void *) 0;
  707. return name;
  708. } else {
  709. return 0;
  710. }
  711. }
  712. return SWIG_UnpackData(++c,ptr,sizeof(void *));
  713. }
  714. SWIGRUNTIME char *
  715. SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
  716. char *r = buff;
  717. size_t lname = (name ? strlen(name) : 0);
  718. if ((2*sz + 2 + lname) > bsz) return 0;
  719. *(r++) = '_';
  720. r = SWIG_PackData(r,ptr,sz);
  721. if (lname) {
  722. strncpy(r,name,lname+1);
  723. } else {
  724. *r = 0;
  725. }
  726. return buff;
  727. }
  728. SWIGRUNTIME const char *
  729. SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
  730. if (*c != '_') {
  731. if (strcmp(c,"NULL") == 0) {
  732. memset(ptr,0,sz);
  733. return name;
  734. } else {
  735. return 0;
  736. }
  737. }
  738. return SWIG_UnpackData(++c,ptr,sz);
  739. }
  740. #ifdef __cplusplus
  741. }
  742. #endif
  743. /* Errors in SWIG */
  744. #define SWIG_UnknownError -1
  745. #define SWIG_IOError -2
  746. #define SWIG_RuntimeError -3
  747. #define SWIG_IndexError -4
  748. #define SWIG_TypeError -5
  749. #define SWIG_DivisionByZero -6
  750. #define SWIG_OverflowError -7
  751. #define SWIG_SyntaxError -8
  752. #define SWIG_ValueError -9
  753. #define SWIG_SystemError -10
  754. #define SWIG_AttributeError -11
  755. #define SWIG_MemoryError -12
  756. #define SWIG_NullReferenceError -13
  757. #include <ruby.h>
  758. /* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which
  759. * breaks using rb_intern as an lvalue, as SWIG does. We work around this
  760. * issue for now by disabling this.
  761. * https://sourceforge.net/tracker/?func=detail&aid=2859614&group_id=1645&atid=101645
  762. */
  763. #ifdef rb_intern
  764. # undef rb_intern
  765. #endif
  766. /* Remove global macros defined in Ruby's win32.h */
  767. #ifdef write
  768. # undef write
  769. #endif
  770. #ifdef read
  771. # undef read
  772. #endif
  773. #ifdef bind
  774. # undef bind
  775. #endif
  776. #ifdef close
  777. # undef close
  778. #endif
  779. #ifdef connect
  780. # undef connect
  781. #endif
  782. /* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
  783. #ifndef NUM2LL
  784. #define NUM2LL(x) NUM2LONG((x))
  785. #endif
  786. #ifndef LL2NUM
  787. #define LL2NUM(x) INT2NUM((long) (x))
  788. #endif
  789. #ifndef ULL2NUM
  790. #define ULL2NUM(x) UINT2NUM((unsigned long) (x))
  791. #endif
  792. /* Ruby 1.7 doesn't (yet) define NUM2ULL() */
  793. #ifndef NUM2ULL
  794. #ifdef HAVE_LONG_LONG
  795. #define NUM2ULL(x) rb_num2ull((x))
  796. #else
  797. #define NUM2ULL(x) NUM2ULONG(x)
  798. #endif
  799. #endif
  800. /* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
  801. /* Define these for older versions so we can just write code the new way */
  802. #ifndef RSTRING_LEN
  803. # define RSTRING_LEN(x) RSTRING(x)->len
  804. #endif
  805. #ifndef RSTRING_PTR
  806. # define RSTRING_PTR(x) RSTRING(x)->ptr
  807. #endif
  808. #ifndef RSTRING_END
  809. # define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
  810. #endif
  811. #ifndef RARRAY_LEN
  812. # define RARRAY_LEN(x) RARRAY(x)->len
  813. #endif
  814. #ifndef RARRAY_PTR
  815. # define RARRAY_PTR(x) RARRAY(x)->ptr
  816. #endif
  817. #ifndef RFLOAT_VALUE
  818. # define RFLOAT_VALUE(x) RFLOAT(x)->value
  819. #endif
  820. #ifndef DOUBLE2NUM
  821. # define DOUBLE2NUM(x) rb_float_new(x)
  822. #endif
  823. #ifndef RHASH_TBL
  824. # define RHASH_TBL(x) (RHASH(x)->tbl)
  825. #endif
  826. #ifndef RHASH_ITER_LEV
  827. # define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
  828. #endif
  829. #ifndef RHASH_IFNONE
  830. # define RHASH_IFNONE(x) (RHASH(x)->ifnone)
  831. #endif
  832. #ifndef RHASH_SIZE
  833. # define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
  834. #endif
  835. #ifndef RHASH_EMPTY_P
  836. # define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
  837. #endif
  838. #ifndef RSTRUCT_LEN
  839. # define RSTRUCT_LEN(x) RSTRUCT(x)->len
  840. #endif
  841. #ifndef RSTRUCT_PTR
  842. # define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
  843. #endif
  844. /*
  845. * Need to be very careful about how these macros are defined, especially
  846. * when compiling C++ code or C code with an ANSI C compiler.
  847. *
  848. * VALUEFUNC(f) is a macro used to typecast a C function that implements
  849. * a Ruby method so that it can be passed as an argument to API functions
  850. * like rb_define_method() and rb_define_singleton_method().
  851. *
  852. * VOIDFUNC(f) is a macro used to typecast a C function that implements
  853. * either the "mark" or "free" stuff for a Ruby Data object, so that it
  854. * can be passed as an argument to API functions like Data_Wrap_Struct()
  855. * and Data_Make_Struct().
  856. */
  857. #ifdef __cplusplus
  858. # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
  859. # define PROTECTFUNC(f) ((VALUE (*)()) f)
  860. # define VALUEFUNC(f) ((VALUE (*)()) f)
  861. # define VOIDFUNC(f) ((void (*)()) f)
  862. # else
  863. # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
  864. # define PROTECTFUNC(f) ((VALUE (*)()) f)
  865. # define VALUEFUNC(f) ((VALUE (*)()) f)
  866. # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
  867. # else /* These definitions should work for Ruby 1.7+ */
  868. # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
  869. # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
  870. # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
  871. # endif
  872. # endif
  873. #else
  874. # define VALUEFUNC(f) (f)
  875. # define VOIDFUNC(f) (f)
  876. #endif
  877. /* Don't use for expressions have side effect */
  878. #ifndef RB_STRING_VALUE
  879. #define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
  880. #endif
  881. #ifndef StringValue
  882. #define StringValue(s) RB_STRING_VALUE(s)
  883. #endif
  884. #ifndef StringValuePtr
  885. #define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
  886. #endif
  887. #ifndef StringValueLen
  888. #define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
  889. #endif
  890. #ifndef SafeStringValue
  891. #define SafeStringValue(v) do {\
  892. StringValue(v);\
  893. rb_check_safe_str(v);\
  894. } while (0)
  895. #endif
  896. #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
  897. #define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
  898. #define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
  899. #endif
  900. static VALUE _mSWIG = Qnil;
  901. /* -----------------------------------------------------------------------------
  902. * error manipulation
  903. * ----------------------------------------------------------------------------- */
  904. /* Define some additional error types */
  905. #define SWIG_ObjectPreviouslyDeletedError -100
  906. /* Define custom exceptions for errors that do not map to existing Ruby
  907. exceptions. Note this only works for C++ since a global cannot be
  908. initialized by a function in C. For C, fallback to rb_eRuntimeError.*/
  909. SWIGINTERN VALUE
  910. getNullReferenceError(void) {
  911. static int init = 0;
  912. static VALUE rb_eNullReferenceError ;
  913. if (!init) {
  914. init = 1;
  915. rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
  916. }
  917. return rb_eNullReferenceError;
  918. }
  919. SWIGINTERN VALUE
  920. getObjectPreviouslyDeletedError(void) {
  921. static int init = 0;
  922. static VALUE rb_eObjectPreviouslyDeleted ;
  923. if (!init) {
  924. init = 1;
  925. rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
  926. }
  927. return rb_eObjectPreviouslyDeleted;
  928. }
  929. SWIGINTERN VALUE
  930. SWIG_Ruby_ErrorType(int SWIG_code) {
  931. VALUE type;
  932. switch (SWIG_code) {
  933. case SWIG_MemoryError:
  934. type = rb_eNoMemError;
  935. break;
  936. case SWIG_IOError:
  937. type = rb_eIOError;
  938. break;
  939. case SWIG_RuntimeError:
  940. type = rb_eRuntimeError;
  941. break;
  942. case SWIG_IndexError:
  943. type = rb_eIndexError;
  944. break;
  945. case SWIG_TypeError:
  946. type = rb_eTypeError;
  947. break;
  948. case SWIG_DivisionByZero:
  949. type = rb_eZeroDivError;
  950. break;
  951. case SWIG_OverflowError:
  952. type = rb_eRangeError;
  953. break;
  954. case SWIG_SyntaxError:
  955. type = rb_eSyntaxError;
  956. break;
  957. case SWIG_ValueError:
  958. type = rb_eArgError;
  959. break;
  960. case SWIG_SystemError:
  961. type = rb_eFatal;
  962. break;
  963. case SWIG_AttributeError:
  964. type = rb_eRuntimeError;
  965. break;
  966. case SWIG_NullReferenceError:
  967. type = getNullReferenceError();
  968. break;
  969. case SWIG_ObjectPreviouslyDeletedError:
  970. type = getObjectPreviouslyDeletedError();
  971. break;
  972. case SWIG_UnknownError:
  973. type = rb_eRuntimeError;
  974. break;
  975. default:
  976. type = rb_eRuntimeError;
  977. }
  978. return type;
  979. }
  980. /* This function is called when a user inputs a wrong argument to
  981. a method.
  982. */
  983. SWIGINTERN
  984. const char* Ruby_Format_TypeError( const char* msg,
  985. const char* type,
  986. const char* name,
  987. const int argn,
  988. VALUE input )
  989. {
  990. char buf[128];
  991. VALUE str;
  992. VALUE asStr;
  993. if ( msg && *msg )
  994. {
  995. str = rb_str_new2(msg);
  996. }
  997. else
  998. {
  999. str = rb_str_new(NULL, 0);
  1000. }
  1001. str = rb_str_cat2( str, "Expected argument " );
  1002. sprintf( buf, "%d of type ", argn-1 );
  1003. str = rb_str_cat2( str, buf );
  1004. str = rb_str_cat2( str, type );
  1005. str = rb_str_cat2( str, ", but got " );
  1006. str = rb_str_cat2( str, rb_obj_classname(input) );
  1007. str = rb_str_cat2( str, " " );
  1008. asStr = rb_inspect(input);
  1009. if ( RSTRING_LEN(asStr) > 30 )
  1010. {
  1011. str = rb_str_cat( str, StringValuePtr(asStr), 30 );
  1012. str = rb_str_cat2( str, "..." );
  1013. }
  1014. else
  1015. {
  1016. str = rb_str_append( str, asStr );
  1017. }
  1018. if ( name )
  1019. {
  1020. str = rb_str_cat2( str, "\n\tin SWIG method '" );
  1021. str = rb_str_cat2( str, name );
  1022. str = rb_str_cat2( str, "'" );
  1023. }
  1024. return StringValuePtr( str );
  1025. }
  1026. /* This function is called when an overloaded method fails */
  1027. SWIGINTERN
  1028. void Ruby_Format_OverloadedError(
  1029. const int argc,
  1030. const int maxargs,
  1031. const char* method,
  1032. const char* prototypes
  1033. )
  1034. {
  1035. const char* msg = "Wrong # of arguments";
  1036. if ( argc <= maxargs ) msg = "Wrong arguments";
  1037. rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"
  1038. "Possible C/C++ prototypes are:\n%s",
  1039. msg, method, prototypes);
  1040. }
  1041. /* -----------------------------------------------------------------------------
  1042. * rubytracking.swg
  1043. *
  1044. * This file contains support for tracking mappings from
  1045. * Ruby objects to C++ objects. This functionality is needed
  1046. * to implement mark functions for Ruby's mark and sweep
  1047. * garbage collector.
  1048. * ----------------------------------------------------------------------------- */
  1049. #ifdef __cplusplus
  1050. extern "C" {
  1051. #endif
  1052. /* Ruby 1.8 actually assumes the first case. */
  1053. #if SIZEOF_VOIDP == SIZEOF_LONG
  1054. # define SWIG2NUM(v) LONG2NUM((unsigned long)v)
  1055. # define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
  1056. #elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
  1057. # define SWIG2NUM(v) LL2NUM((unsigned long long)v)
  1058. # define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
  1059. #else
  1060. # error sizeof(void*) is not the same as long or long long
  1061. #endif
  1062. /* Global Ruby hash table to store Trackings from C/C++
  1063. structs to Ruby Objects.
  1064. */
  1065. static VALUE swig_ruby_trackings = Qnil;
  1066. /* Global variable that stores a reference to the ruby
  1067. hash table delete function. */
  1068. static ID swig_ruby_hash_delete;
  1069. /* Setup a Ruby hash table to store Trackings */
  1070. SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
  1071. /* Create a ruby hash table to store Trackings from C++
  1072. objects to Ruby objects. */
  1073. /* Try to see if some other .so has already created a
  1074. tracking hash table, which we keep hidden in an instance var
  1075. in the SWIG module.
  1076. This is done to allow multiple DSOs to share the same
  1077. tracking table.
  1078. */
  1079. ID trackings_id = rb_intern( "@__trackings__" );
  1080. VALUE verbose = rb_gv_get("VERBOSE");
  1081. rb_gv_set("VERBOSE", Qfalse);
  1082. swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
  1083. rb_gv_set("VERBOSE", verbose);
  1084. /* No, it hasn't. Create one ourselves */
  1085. if ( swig_ruby_trackings == Qnil )
  1086. {
  1087. swig_ruby_trackings = rb_hash_new();
  1088. rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
  1089. }
  1090. /* Now store a reference to the hash table delete function
  1091. so that we only have to look it up once.*/
  1092. swig_ruby_hash_delete = rb_intern("delete");
  1093. }
  1094. /* Get a Ruby number to reference a pointer */
  1095. SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
  1096. /* We cast the pointer to an unsigned long
  1097. and then store a reference to it using
  1098. a Ruby number object. */
  1099. /* Convert the pointer to a Ruby number */
  1100. return SWIG2NUM(ptr);
  1101. }
  1102. /* Get a Ruby number to reference an object */
  1103. SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
  1104. /* We cast the object to an unsigned long
  1105. and then store a reference to it using
  1106. a Ruby number object. */
  1107. /* Convert the Object to a Ruby number */
  1108. return SWIG2NUM(object);
  1109. }
  1110. /* Get a Ruby object from a previously stored reference */
  1111. SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
  1112. /* The provided Ruby number object is a reference
  1113. to the Ruby object we want.*/
  1114. /* Convert the Ruby number to a Ruby object */
  1115. return NUM2SWIG(reference);
  1116. }
  1117. /* Add a Tracking from a C/C++ struct to a Ruby object */
  1118. SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
  1119. /* In a Ruby hash table we store the pointer and
  1120. the associated Ruby object. The trick here is
  1121. that we cannot store the Ruby object directly - if
  1122. we do then it cannot be garbage collected. So
  1123. instead we typecast it as a unsigned long and
  1124. convert it to a Ruby number object.*/
  1125. /* Get a reference to the pointer as a Ruby number */
  1126. VALUE key = SWIG_RubyPtrToReference(ptr);
  1127. /* Get a reference to the Ruby object as a Ruby number */
  1128. VALUE value = SWIG_RubyObjectToReference(object);
  1129. /* Store the mapping to the global hash table. */
  1130. rb_hash_aset(swig_ruby_trackings, key, value);
  1131. }
  1132. /* Get the Ruby object that owns the specified C/C++ struct */
  1133. SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
  1134. /* Get a reference to the pointer as a Ruby number */
  1135. VALUE key = SWIG_RubyPtrToReference(ptr);
  1136. /* Now lookup the value stored in the global hash table */
  1137. VALUE value = rb_hash_aref(swig_ruby_trackings, key);
  1138. if (value == Qnil) {
  1139. /* No object exists - return nil. */
  1140. return Qnil;
  1141. }
  1142. else {
  1143. /* Convert this value to Ruby object */
  1144. return SWIG_RubyReferenceToObject(value);
  1145. }
  1146. }
  1147. /* Remove a Tracking from a C/C++ struct to a Ruby object. It
  1148. is very important to remove objects once they are destroyed
  1149. since the same memory address may be reused later to create
  1150. a new object. */
  1151. SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
  1152. /* Get a reference to the pointer as a Ruby number */
  1153. VALUE key = SWIG_RubyPtrToReference(ptr);
  1154. /* Delete the object from the hash table by calling Ruby's
  1155. do this we need to call the Hash.delete method.*/
  1156. rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
  1157. }
  1158. /* This is a helper method that unlinks a Ruby object from its
  1159. underlying C++ object. This is needed if the lifetime of the
  1160. Ruby object is longer than the C++ object */
  1161. SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
  1162. VALUE object = SWIG_RubyInstanceFor(ptr);
  1163. if (object != Qnil) {
  1164. DATA_PTR(object) = 0;
  1165. }
  1166. }
  1167. #ifdef __cplusplus
  1168. }
  1169. #endif
  1170. /* -----------------------------------------------------------------------------
  1171. * Ruby API portion that goes into the runtime
  1172. * ----------------------------------------------------------------------------- */
  1173. #ifdef __cplusplus
  1174. extern "C" {
  1175. #endif
  1176. SWIGINTERN VALUE
  1177. SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
  1178. if (NIL_P(target)) {
  1179. target = o;
  1180. } else {
  1181. if (TYPE(target) != T_ARRAY) {
  1182. VALUE o2 = target;
  1183. target = rb_ary_new();
  1184. rb_ary_push(target, o2);
  1185. }
  1186. rb_ary_push(target, o);
  1187. }
  1188. return target;
  1189. }
  1190. /* For ruby1.8.4 and earlier. */
  1191. #ifndef RUBY_INIT_STACK
  1192. RUBY_EXTERN void Init_stack(VALUE* addr);
  1193. # define RUBY_INIT_STACK \
  1194. VALUE variable_in_this_stack_frame; \
  1195. Init_stack(&variable_in_this_stack_frame);
  1196. #endif
  1197. #ifdef __cplusplus
  1198. }
  1199. #endif
  1200. /* -----------------------------------------------------------------------------
  1201. * rubyrun.swg
  1202. *
  1203. * This file contains the runtime support for Ruby modules
  1204. * and includes code for managing global variables and pointer
  1205. * type checking.
  1206. * ----------------------------------------------------------------------------- */
  1207. /* For backward compatibility only */
  1208. #define SWIG_POINTER_EXCEPTION 0
  1209. /* for raw pointers */
  1210. #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
  1211. #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
  1212. #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags)
  1213. #define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own)
  1214. #define swig_owntype ruby_owntype
  1215. /* for raw packed data */
  1216. #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
  1217. #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
  1218. /* for class or struct pointers */
  1219. #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
  1220. #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
  1221. /* for C or C++ function pointers */
  1222. #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0)
  1223. #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0)
  1224. /* for C++ member pointers, ie, member methods */
  1225. #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
  1226. #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
  1227. /* Runtime API */
  1228. #define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule()
  1229. #define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
  1230. /* Error manipulation */
  1231. #define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
  1232. #define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg)
  1233. #define SWIG_fail goto fail
  1234. /* Ruby-specific SWIG API */
  1235. #define SWIG_InitRuntime() SWIG_Ruby_InitRuntime()
  1236. #define SWIG_define_class(ty) SWIG_Ruby_define_class(ty)
  1237. #define SWIG_NewClassInstance(value, ty) SWIG_Ruby_NewClassInstance(value, ty)
  1238. #define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
  1239. #define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
  1240. #include "assert.h"
  1241. /* -----------------------------------------------------------------------------
  1242. * pointers/data manipulation
  1243. * ----------------------------------------------------------------------------- */
  1244. #ifdef __cplusplus
  1245. extern "C" {
  1246. #endif
  1247. typedef struct {
  1248. VALUE klass;
  1249. VALUE mImpl;
  1250. void (*mark)(void *);
  1251. void (*destroy)(void *);
  1252. int trackObjects;
  1253. } swig_class;
  1254. /* Global pointer used to keep some internal SWIG stuff */
  1255. static VALUE _cSWIG_Pointer = Qnil;
  1256. static VALUE swig_runtime_data_type_pointer = Qnil;
  1257. /* Global IDs used to keep some internal SWIG stuff */
  1258. static ID swig_arity_id = 0;
  1259. static ID swig_call_id = 0;
  1260. /*
  1261. If your swig extension is to be run within an embedded ruby and has
  1262. director callbacks, you should set -DRUBY_EMBEDDED during compilation.
  1263. This will reset ruby's stack frame on each entry point from the main
  1264. program the first time a virtual director function is invoked (in a
  1265. non-recursive way).
  1266. If this is not done, you run the risk of Ruby trashing the stack.
  1267. */
  1268. #ifdef RUBY_EMBEDDED
  1269. # define SWIG_INIT_STACK \
  1270. if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \
  1271. ++swig_virtual_calls;
  1272. # define SWIG_RELEASE_STACK --swig_virtual_calls;
  1273. # define Ruby_DirectorTypeMismatchException(x) \
  1274. rb_raise( rb_eTypeError, "%s", x ); return c_result;
  1275. static unsigned int swig_virtual_calls = 0;
  1276. #else /* normal non-embedded extension */
  1277. # define SWIG_INIT_STACK
  1278. # define SWIG_RELEASE_STACK
  1279. # define Ruby_DirectorTypeMismatchException(x) \
  1280. throw Swig::DirectorTypeMismatchException( x );
  1281. #endif /* RUBY_EMBEDDED */
  1282. SWIGRUNTIME VALUE
  1283. getExceptionClass(void) {
  1284. static int init = 0;
  1285. static VALUE rubyExceptionClass ;
  1286. if (!init) {
  1287. init = 1;
  1288. rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
  1289. }
  1290. return rubyExceptionClass;
  1291. }
  1292. /* This code checks to see if the Ruby object being raised as part
  1293. of an exception inherits from the Ruby class Exception. If so,
  1294. the object is simply returned. If not, then a new Ruby exception
  1295. object is created and that will be returned to Ruby.*/
  1296. SWIGRUNTIME VALUE
  1297. SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
  1298. VALUE exceptionClass = getExceptionClass();
  1299. if (rb_obj_is_kind_of(obj, exceptionClass)) {
  1300. return obj;
  1301. } else {
  1302. return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
  1303. }
  1304. }
  1305. /* Initialize Ruby runtime support */
  1306. SWIGRUNTIME void
  1307. SWIG_Ruby_InitRuntime(void)
  1308. {
  1309. if (_mSWIG == Qnil) {
  1310. _mSWIG = rb_define_module("SWIG");
  1311. swig_call_id = rb_intern("call");
  1312. swig_arity_id = rb_intern("arity");
  1313. }
  1314. }
  1315. /* Define Ruby class for C type */
  1316. SWIGRUNTIME void
  1317. SWIG_Ruby_define_class(swig_type_info *type)
  1318. {
  1319. VALUE klass;
  1320. char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
  1321. sprintf(klass_name, "TYPE%s", type->name);
  1322. if (NIL_P(_cSWIG_Pointer)) {
  1323. _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
  1324. rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
  1325. }
  1326. klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
  1327. free((void *) klass_name);
  1328. }
  1329. /* Create a new pointer object */
  1330. SWIGRUNTIME VALUE
  1331. SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
  1332. {
  1333. int own = flags & SWIG_POINTER_OWN;
  1334. int track;
  1335. char *klass_name;
  1336. swig_class *sklass;
  1337. VALUE klass;
  1338. VALUE obj;
  1339. if (!ptr)
  1340. return Qnil;
  1341. if (type->clientdata) {
  1342. sklass = (swig_class *) type->clientdata;
  1343. /* Are we tracking this class and have we already returned this Ruby object? */
  1344. track = sklass->trackObjects;
  1345. if (track) {
  1346. obj = SWIG_RubyInstanceFor(ptr);
  1347. /* Check the object's type and make sure it has the correct type.
  1348. It might not in cases where methods do things like
  1349. downcast methods. */
  1350. if (obj != Qnil) {
  1351. VALUE value = rb_iv_get(obj, "@__swigtype__");
  1352. char* type_name = RSTRING_PTR(value);
  1353. if (strcmp(type->name, type_name) == 0) {
  1354. return obj;
  1355. }
  1356. }
  1357. }
  1358. /* Create a new Ruby object */
  1359. obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark),
  1360. ( own ? VOIDFUNC(sklass->destroy) :
  1361. (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
  1362. ), ptr);
  1363. /* If tracking is on for this class then track this object. */
  1364. if (track) {
  1365. SWIG_RubyAddTracking(ptr, obj);
  1366. }
  1367. } else {
  1368. klass_name = (char *) malloc(4 + strlen(type->name) + 1);
  1369. sprintf(klass_name, "TYPE%s", type->name);
  1370. klass = rb_const_get(_mSWIG, rb_intern(klass_name));
  1371. free((void *) klass_name);
  1372. obj = Data_Wrap_Struct(klass, 0, 0, ptr);
  1373. }
  1374. rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
  1375. return obj;
  1376. }
  1377. /* Create a new class instance (always owned) */
  1378. SWIGRUNTIME VALUE
  1379. SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
  1380. {
  1381. VALUE obj;
  1382. swig_class *sklass = (swig_class *) type->clientdata;
  1383. obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
  1384. rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
  1385. return obj;
  1386. }
  1387. /* Get type mangle from class name */
  1388. SWIGRUNTIMEINLINE char *
  1389. SWIG_Ruby_MangleStr(VALUE obj)
  1390. {
  1391. VALUE stype = rb_iv_get(obj, "@__swigtype__");
  1392. return StringValuePtr(stype);
  1393. }
  1394. /* Acquire a pointer value */
  1395. typedef void (*ruby_owntype)(void*);
  1396. SWIGRUNTIME ruby_owntype
  1397. SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
  1398. if (obj) {
  1399. ruby_owntype oldown = RDATA(obj)->dfree;
  1400. RDATA(obj)->dfree = own;
  1401. return oldown;
  1402. } else {
  1403. return 0;
  1404. }
  1405. }
  1406. /* Convert a pointer value */
  1407. SWIGRUNTIME int
  1408. SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
  1409. {
  1410. char *c;
  1411. swig_cast_info *tc;
  1412. void *vptr = 0;
  1413. /* Grab the pointer */
  1414. if (NIL_P(obj)) {
  1415. *ptr = 0;
  1416. return SWIG_OK;
  1417. } else {
  1418. if (TYPE(obj) != T_DATA) {
  1419. return SWIG_ERROR;
  1420. }
  1421. Data_Get_Struct(obj, void, vptr);
  1422. }
  1423. if (own) *own = RDATA(obj)->dfree;
  1424. /* Check to see if the input object is giving up ownership
  1425. of the underlying C struct or C++ object. If so then we
  1426. need to reset the destructor since the Ruby object no
  1427. longer owns the underlying C++ object.*/
  1428. if (flags & SWIG_POINTER_DISOWN) {
  1429. /* Is tracking on for this class? */
  1430. int track = 0;
  1431. if (ty && ty->clientdata) {
  1432. swig_class *sklass = (swig_class *) ty->clientdata;
  1433. track = sklass->trackObjects;
  1434. }
  1435. if (track) {
  1436. /* We are tracking objects for this class. Thus we change the destructor
  1437. * to SWIG_RubyRemoveTracking. This allows us to
  1438. * remove the mapping from the C++ to Ruby object
  1439. * when the Ruby object is garbage collected. If we don't
  1440. * do this, then it is possible we will return a reference
  1441. * to a Ruby object that no longer exists thereby crashing Ruby. */
  1442. RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
  1443. } else {
  1444. RDATA(obj)->dfree = 0;
  1445. }
  1446. }
  1447. /* Do type-checking if type info was provided */
  1448. if (ty) {
  1449. if (ty->clientdata) {
  1450. if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
  1451. if (vptr == 0) {
  1452. /* The object has already been deleted */
  1453. return SWIG_ObjectPreviouslyDeletedError;
  1454. }
  1455. *ptr = vptr;
  1456. return SWIG_OK;
  1457. }
  1458. }
  1459. if ((c = SWIG_MangleStr(obj)) == NULL) {
  1460. return SWIG_ERROR;
  1461. }
  1462. tc = SWIG_TypeCheck(c, ty);
  1463. if (!tc) {
  1464. return SWIG_ERROR;
  1465. } else {
  1466. int newmemory = 0;
  1467. *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
  1468. assert(!newmemory); /* newmemory handling not yet implemented */
  1469. }
  1470. } else {
  1471. *ptr = vptr;
  1472. }
  1473. return SWIG_OK;
  1474. }
  1475. /* Check convert */
  1476. SWIGRUNTIMEINLINE int
  1477. SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
  1478. {
  1479. char *c = SWIG_MangleStr(obj);
  1480. if (!c) return 0;
  1481. return SWIG_TypeCheck(c,ty) != 0;
  1482. }
  1483. SWIGRUNTIME VALUE
  1484. SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
  1485. char result[1024];
  1486. char *r = result;
  1487. if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
  1488. *(r++) = '_';
  1489. r = SWIG_PackData(r, ptr, sz);
  1490. strcpy(r, type->name);
  1491. return rb_str_new2(result);
  1492. }
  1493. /* Convert a packed value value */
  1494. SWIGRUNTIME int
  1495. SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
  1496. swig_cast_info *tc;
  1497. const char *c;
  1498. if (TYPE(obj) != T_STRING) goto type_error;
  1499. c = StringValuePtr(obj);
  1500. /* Pointer values must start with leading underscore */
  1501. if (*c != '_') goto type_error;
  1502. c++;
  1503. c = SWIG_UnpackData(c, ptr, sz);
  1504. if (ty) {
  1505. tc = SWIG_TypeCheck(c, ty);
  1506. if (!tc) goto type_error;
  1507. }
  1508. return SWIG_OK;
  1509. type_error:
  1510. return SWIG_ERROR;
  1511. }
  1512. SWIGRUNTIME swig_module_info *
  1513. SWIG_Ruby_GetModule(void)
  1514. {
  1515. VALUE pointer;
  1516. swig_module_info *ret = 0;
  1517. VALUE verbose = rb_gv_get("VERBOSE");
  1518. /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
  1519. rb_gv_set("VERBOSE", Qfalse);
  1520. /* first check if pointer already created */
  1521. pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
  1522. if (pointer != Qnil) {
  1523. Data_Get_Struct(pointer, swig_module_info, ret);
  1524. }
  1525. /* reinstate warnings */
  1526. rb_gv_set("VERBOSE", verbose);
  1527. return ret;
  1528. }
  1529. SWIGRUNTIME void
  1530. SWIG_Ruby_SetModule(swig_module_info *pointer)
  1531. {
  1532. /* register a new class */
  1533. VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
  1534. /* create and store the structure pointer to a global variable */
  1535. swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
  1536. rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
  1537. }
  1538. /* This function can be used to check whether a proc or method or similarly
  1539. callable function has been passed. Usually used in a %typecheck, like:
  1540. %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
  1541. $result = SWIG_Ruby_isCallable( $input );
  1542. }
  1543. */
  1544. SWIGINTERN
  1545. int SWIG_Ruby_isCallable( VALUE proc )
  1546. {
  1547. if ( rb_respond_to( proc, swig_call_id ) == Qtrue )
  1548. return 1;
  1549. return 0;
  1550. }
  1551. /* This function can be used to check the arity (number of arguments)
  1552. a proc or method can take. Usually used in a %typecheck.
  1553. Valid arities will be that equal to minimal or those < 0
  1554. which indicate a variable number of parameters at the end.
  1555. */
  1556. SWIGINTERN
  1557. int SWIG_Ruby_arity( VALUE proc, int minimal )
  1558. {
  1559. if ( rb_respond_to( proc, swig_arity_id ) == Qtrue )
  1560. {
  1561. VALUE num = rb_funcall( proc, swig_arity_id, 0 );
  1562. int arity = NUM2INT(num);
  1563. if ( arity < 0 && (arity+1) < -minimal ) return 1;
  1564. if ( arity == minimal ) return 1;
  1565. return 1;
  1566. }
  1567. return 0;
  1568. }
  1569. #ifdef __cplusplus
  1570. }
  1571. #endif
  1572. #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
  1573. #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
  1574. #define SWIG_exception(code, msg) do { SWIG_Error(code, msg);; } while(0)
  1575. /* -------- TYPES TABLE (BEGIN) -------- */
  1576. #define SWIGTYPE_p_Document swig_types[0]
  1577. #define SWIGTYPE_p_DocumentList swig_types[1]
  1578. #define SWIGTYPE_p_TokenSet swig_types[2]
  1579. #define SWIGTYPE_p_TupleSet swig_types[3]
  1580. #define SWIGTYPE_p_allocator_type swig_types[4]
  1581. #define SWIGTYPE_p_char swig_types[5]
  1582. #define SWIGTYPE_p_difference_type swig_types[6]
  1583. #define SWIGTYPE_p_p_void swig_types[7]
  1584. #define SWIGTYPE_p_size_type swig_types[8]
  1585. #define SWIGTYPE_p_std__allocatorT_int_t swig_types[9]
  1586. #define SWIGTYPE_p_std__istream swig_types[10]
  1587. #define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[11]
  1588. #define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[12]
  1589. #define SWIGTYPE_p_swig__ConstIterator swig_types[13]
  1590. #define SWIGTYPE_p_swig__GC_VALUE swig_types[14]
  1591. #define SWIGTYPE_p_swig__Iterator swig_types[15]
  1592. #define SWIGTYPE_p_value_type swig_types[16]
  1593. #define SWIGTYPE_p_void swig_types[17]
  1594. static swig_type_info *swig_types[19];
  1595. static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0};
  1596. #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
  1597. #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
  1598. /* -------- TYPES TABLE (END) -------- */
  1599. #define SWIG_init Init_uhferret_lib
  1600. #define SWIG_name "Uhferret_lib"
  1601. static VALUE mUhferret_lib;
  1602. #define SWIG_RUBY_THREAD_BEGIN_BLOCK
  1603. #define SWIG_RUBY_THREAD_END_BLOCK
  1604. #define SWIGVERSION 0x020004
  1605. #define SWIG_VERSION SWIGVERSION
  1606. #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
  1607. #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
  1608. #include <stdexcept>
  1609. #include "document.h"
  1610. #include "documentlist.h"
  1611. #include "tupleset.h"
  1612. #include <string>
  1613. #include <iostream>
  1614. #include <stdexcept>
  1615. namespace swig {
  1616. class GC_VALUE {
  1617. protected:
  1618. // Hash of all GC_VALUE's currently in use
  1619. static VALUE _hash;
  1620. VALUE _obj;
  1621. static ID hash_id;
  1622. static ID lt_id;
  1623. static ID gt_id;
  1624. static ID eq_id;
  1625. static ID le_id;
  1626. static ID ge_id;
  1627. static ID pos_id;
  1628. static ID neg_id;
  1629. static ID inv_id;
  1630. static ID add_id;
  1631. static ID sub_id;
  1632. static ID mul_id;
  1633. static ID div_id;
  1634. static ID mod_id;
  1635. static ID and_id;
  1636. static ID or_id;
  1637. static ID xor_id;
  1638. static ID lshift_id;
  1639. static ID rshift_id;
  1640. struct OpArgs
  1641. {
  1642. VALUE src;
  1643. ID id;
  1644. int nargs;
  1645. VALUE target;
  1646. };
  1647. public:
  1648. static void initialize()
  1649. {
  1650. if ( _hash == Qnil )
  1651. {
  1652. _hash = rb_hash_new();
  1653. rb_gc_register_address( &_hash );
  1654. }
  1655. }
  1656. // this function is never called. Provided for symmetry only.
  1657. static void cleanup()
  1658. {
  1659. rb_gc_unregister_address( &_hash );
  1660. }
  1661. GC_VALUE() : _obj( Qnil )
  1662. {
  1663. }
  1664. GC_VALUE(const GC_VALUE& item) : _obj(item._obj)
  1665. {
  1666. GC_register();
  1667. }
  1668. GC_VALUE(VALUE obj) :_obj(obj)
  1669. {
  1670. GC_register();
  1671. }
  1672. ~GC_VALUE()
  1673. {
  1674. GC_unregister();
  1675. }
  1676. GC_VALUE & operator=(const GC_VALUE& item)
  1677. {
  1678. GC_unregister();
  1679. _obj = item._obj;
  1680. GC_register();
  1681. return *this;
  1682. }
  1683. void GC_register()
  1684. {
  1685. if ( FIXNUM_P(_obj) || SPECIAL_CONST_P(_obj) || SYMBOL_P(_obj) )
  1686. return;
  1687. VALUE val = rb_hash_aref( _hash, _obj );
  1688. unsigned n = FIXNUM_P(val) ? NUM2UINT(val) : 0;
  1689. ++n;
  1690. rb_hash_aset( _hash, _obj, INT2NUM(n) );
  1691. }
  1692. void GC_unregister()
  1693. {
  1694. if ( FIXNUM_P(_obj) || SPECIAL_CONST_P(_obj) || SYMBOL_P(_obj) )
  1695. return;
  1696. // this test should not be needed but I've noticed some very erratic
  1697. // behavior of none being unregistered in some very rare situations.
  1698. if ( BUILTIN_TYPE(_obj) == T_NONE ) return;
  1699. VALUE val = rb_hash_aref( _hash, _obj );
  1700. unsigned n = FIXNUM_P(val) ? NUM2UINT(val) : 1;
  1701. --n;
  1702. if ( n )
  1703. rb_hash_aset( _hash, _obj, INT2NUM(n) );
  1704. else
  1705. rb_hash_delete( _hash, _obj );
  1706. }
  1707. operator VALUE() const
  1708. {
  1709. return _obj;
  1710. }
  1711. VALUE inspect() const
  1712. {
  1713. return rb_inspect(_obj);
  1714. }
  1715. VALUE to_s() const
  1716. {
  1717. return rb_inspect(_obj);
  1718. }
  1719. static VALUE swig_protect_funcall( VALUE p )
  1720. {
  1721. OpArgs* args = (OpArgs*) p;
  1722. return rb_funcall( args->src, args->id, args->nargs, args->target );
  1723. }
  1724. #define GC_VALUE_CMP( op_id, op, cmp, cmpval ) \
  1725. bool op( const GC_VALUE& other ) const \
  1726. { \
  1727. if ( FIXNUM_P(_obj) && FIXNUM_P(other._obj) ) \
  1728. { \
  1729. return _obj cmp other._obj; \
  1730. } \
  1731. bool res = false; \
  1732. VALUE ret = Qnil; \
  1733. SWIG_RUBY_THREAD_BEGIN_BLOCK; \
  1734. if ( rb_respond_to( _obj, op_id ) == Qtrue ) \
  1735. { \
  1736. int status; \
  1737. OpArgs args; \
  1738. args.src = _obj; \
  1739. args.id = op_id; \
  1740. args.nargs = 1; \
  1741. args.target = VALUE(other); \
  1742. ret = rb_protect( PROTECTFUNC(swig_protect_funcall), \
  1743. VALUE(&args), &status ); \
  1744. } \
  1745. if ( ret == Qnil ) { \
  1746. VALUE a = rb_funcall( _obj, hash_id, 0 ); \
  1747. VALUE b = rb_funcall( VALUE(other), hash_id, 0 ); \
  1748. res = a cmp b; \
  1749. } \
  1750. else \
  1751. { \
  1752. res = RTEST( ret ); \
  1753. } \
  1754. SWIG_RUBY_THREAD_END_BLOCK; \
  1755. return res; \
  1756. }
  1757. GC_VALUE_CMP( eq_id, operator==, ==, == 0 )
  1758. GC_VALUE_CMP( lt_id, operator<, < , < 0 )
  1759. GC_VALUE_CMP( le_id, operator<=, <=, <= 0 )
  1760. GC_VALUE_CMP( gt_id, operator>, > , > 0 )
  1761. GC_VALUE_CMP( ge_id, operator>=, >=, >= 0 )
  1762. #undef GC_VALUE_CMP
  1763. bool operator!=( const GC_VALUE& other )
  1764. {
  1765. return !(this->operator==(other));
  1766. }
  1767. #define GC_VALUE_UNARY( proc_id, op ) \
  1768. GC_VALUE op() const \
  1769. { \
  1770. VALUE ret = Qnil; \
  1771. SWIG_RUBY_THREAD_BEGIN_BLOCK; \
  1772. int status; \
  1773. OpArgs args; \
  1774. args.src = _obj; \
  1775. args.id = proc_id; \
  1776. args.nargs = 0; \
  1777. args.target = Qnil; \
  1778. ret = rb_protect( PROTECTFUNC(swig_protect_funcall), VALUE(&args), \
  1779. &status ); \
  1780. SWIG_RUBY_THREAD_END_BLOCK; \
  1781. return ret; \
  1782. }
  1783. GC_VALUE_UNARY( pos_id, operator+ )
  1784. GC_VALUE_UNARY( neg_id, operator- )
  1785. GC_VALUE_UNARY( inv_id, operator~ )
  1786. #undef GC_VALUE_BINARY
  1787. #define GC_VALUE_BINARY( proc_id, op ) \
  1788. GC_VALUE op( const GC_VALUE& other ) const \
  1789. { \
  1790. VALUE ret = Qnil; \
  1791. SWIG_RUBY_THREAD_BEGIN_BLOCK; \
  1792. int status; \
  1793. OpArgs args; \
  1794. args.src = _obj; \
  1795. args.id = proc_id; \
  1796. args.nargs = 1; \
  1797. args.target = VALUE(other); \
  1798. ret = rb_protect( PROTECTFUNC(swig_protect_funcall), VALUE(&args), \
  1799. &status ); \
  1800. SWIG_RUBY_THREAD_END_BLOCK; \
  1801. return GC_VALUE(ret); \
  1802. }
  1803. GC_VALUE_BINARY( add_id, operator+ );
  1804. GC_VALUE_BINARY( sub_id, operator- );
  1805. GC_VALUE_BINARY( mul_id, operator* );
  1806. GC_VALUE_BINARY( div_id, operator/ );
  1807. GC_VALUE_BINARY( mod_id, operator% );
  1808. GC_VALUE_BINARY( and_id, operator& );
  1809. GC_VALUE_BINARY( xor_id, operator^ );
  1810. GC_VALUE_BINARY( or_id, operator| );
  1811. GC_VALUE_BINARY( lshift_id, operator<< );
  1812. GC_VALUE_BINARY( rshift_id, operator>> );
  1813. #undef GC_VALUE_BINARY
  1814. };
  1815. ID GC_VALUE::hash_id = rb_intern("hash");
  1816. ID GC_VALUE::lt_id = rb_intern("<");
  1817. ID GC_VALUE::gt_id = rb_intern(">");
  1818. ID GC_VALUE::eq_id = rb_intern("==");
  1819. ID GC_VALUE::le_id = rb_intern("<=");
  1820. ID GC_VALUE::ge_id = rb_intern(">=");
  1821. ID GC_VALUE::pos_id = rb_intern("+@");
  1822. ID GC_VALUE::neg_id = rb_intern("-@");
  1823. ID GC_VALUE::inv_id = rb_intern("~");
  1824. ID GC_VALUE::add_id = rb_intern("+");
  1825. ID GC_VALUE::sub_id = rb_intern("-");
  1826. ID GC_VALUE::mul_id = rb_intern("*");
  1827. ID GC_VALUE::div_id = rb_intern("/");
  1828. ID GC_VALUE::mod_id = rb_intern("%");
  1829. ID GC_VALUE::and_id = rb_intern("&");
  1830. ID GC_VALUE::or_id = rb_intern("|");
  1831. ID GC_VALUE::xor_id = rb_intern("^");
  1832. ID GC_VALUE::lshift_id = rb_intern("<<");
  1833. ID GC_VALUE::rshift_id = rb_intern(">>");
  1834. VALUE GC_VALUE::_hash = Qnil;
  1835. typedef GC_VALUE LANGUAGE_OBJ;
  1836. } // namespace swig
  1837. #if defined(__GNUC__)
  1838. # if __GNUC__ == 2 && __GNUC_MINOR <= 96
  1839. # define SWIG_STD_NOMODERN_STL
  1840. # endif
  1841. #endif
  1842. #include <string>
  1843. #include <stdexcept>
  1844. #include <stddef.h>
  1845. namespace swig {
  1846. struct stop_iteration {
  1847. };
  1848. /**
  1849. * Abstract base class used to represent all iterators of STL containers.
  1850. */
  1851. struct ConstIterator {
  1852. public:
  1853. typedef ConstIterator self_type;
  1854. protected:
  1855. GC_VALUE _seq;
  1856. protected:
  1857. ConstIterator(VALUE seq) : _seq(seq)
  1858. {
  1859. }
  1860. // Random access iterator methods, but not required in Ruby
  1861. virtual ptrdiff_t distance(const ConstIterator &x) const
  1862. {
  1863. throw std::invalid_argument("distance not supported");
  1864. }
  1865. virtual bool equal (const ConstIterator &x) const
  1866. {
  1867. throw std::invalid_argument("equal not supported");
  1868. }
  1869. virtual self_type* advance(ptrdiff_t n)
  1870. {
  1871. throw std::invalid_argument("advance not supported");
  1872. }
  1873. public:
  1874. virtual ~ConstIterator() {}
  1875. // Access iterator method, required by Ruby
  1876. virtual VALUE value() const {
  1877. throw std::invalid_argument("value not supported");
  1878. return Qnil;
  1879. };
  1880. virtual VALUE setValue( const VALUE& v ) {
  1881. throw std::invalid_argument("value= not supported");
  1882. return Qnil;
  1883. }
  1884. virtual self_type* next( size_t n = 1 )
  1885. {
  1886. return this->advance( n );
  1887. }
  1888. virtual self_type* previous( size_t n = 1 )
  1889. {
  1890. ptrdiff_t nn = n;
  1891. return this->advance( -nn );
  1892. }
  1893. virtual VALUE to_s() const {
  1894. throw std::invalid_argument("to_s not supported");
  1895. return Qnil;
  1896. }
  1897. virtual VALUE inspect() const {
  1898. throw std::invalid_argument("inspect not supported");
  1899. return Qnil;
  1900. }
  1901. virtual ConstIterator *dup() const
  1902. {
  1903. throw std::invalid_argument("dup not supported");
  1904. return NULL;
  1905. }
  1906. //
  1907. // C++ common/needed methods. We emulate a bidirectional
  1908. // operator, to be compatible with all the STL.
  1909. // The iterator traits will then tell the STL what type of
  1910. // iterator we really are.
  1911. //
  1912. ConstIterator() : _seq( Qnil )
  1913. {
  1914. }
  1915. ConstIterator( const self_type& b ) : _seq( b._seq )
  1916. {
  1917. }
  1918. self_type& operator=( const self_type& b )
  1919. {
  1920. _seq = b._seq;
  1921. return *this;
  1922. }
  1923. bool operator == (const ConstIterator& x) const
  1924. {
  1925. return equal(x);
  1926. }
  1927. bool operator != (const ConstIterator& x) const
  1928. {
  1929. return ! operator==(x);
  1930. }
  1931. // Pre-decrement operator
  1932. self_type& operator--()
  1933. {
  1934. return *previous();
  1935. }
  1936. // Pre-increment operator
  1937. self_type& operator++()
  1938. {
  1939. return *next();
  1940. }
  1941. // Post-decrement operator
  1942. self_type operator--(int)
  1943. {
  1944. self_type r = *this;
  1945. previous();
  1946. return r;
  1947. }
  1948. // Post-increment operator
  1949. self_type operator++(int)
  1950. {
  1951. self_type r = *this;
  1952. next();
  1953. return r;
  1954. }
  1955. ConstIterator& operator += (ptrdiff_t n)
  1956. {
  1957. return *advance(n);
  1958. }
  1959. ConstIterator& operator -= (ptrdiff_t n)
  1960. {
  1961. return *advance(-n);
  1962. }
  1963. ConstIterator* operator + (ptrdiff_t n) const
  1964. {
  1965. return dup()->advance(n);
  1966. }
  1967. ConstIterator* operator - (ptrdiff_t n) const
  1968. {
  1969. return dup()->advance(-n);
  1970. }
  1971. ptrdiff_t operator - (const ConstIterator& x) const
  1972. {
  1973. return x.distance(*this);
  1974. }
  1975. static swig_type_info* descriptor() {
  1976. static int init = 0;
  1977. static swig_type_info* desc = 0;
  1978. if (!init) {
  1979. desc = SWIG_TypeQuery("swig::ConstIterator *");
  1980. init = 1;
  1981. }
  1982. return desc;
  1983. }
  1984. };
  1985. /**
  1986. * Abstract base class used to represent all non-const iterators of STL containers.
  1987. *
  1988. */
  1989. struct Iterator : public ConstIterator {
  1990. public:
  1991. typedef Iterator self_type;
  1992. protected:
  1993. Iterator(VALUE seq) : ConstIterator(seq)
  1994. {
  1995. }
  1996. virtual self_type* advance(ptrdiff_t n)
  1997. {
  1998. throw std::invalid_argument("operation not supported");
  1999. }
  2000. public:
  2001. static swig_type_info* descriptor() {
  2002. static int init = 0;
  2003. static swig_type_info* desc = 0;
  2004. if (!init) {
  2005. desc = SWIG_TypeQuery("swig::Iterator *");
  2006. init = 1;
  2007. }
  2008. return desc;
  2009. }
  2010. virtual Iterator *dup() const
  2011. {
  2012. throw std::invalid_argument("dup not supported");
  2013. return NULL;
  2014. }
  2015. virtual self_type* next( size_t n = 1 )
  2016. {
  2017. return this->advance( n );
  2018. }
  2019. virtual self_type* previous( size_t n = 1 )
  2020. {
  2021. ptrdiff_t nn = n;
  2022. return this->advance( -nn );
  2023. }
  2024. bool operator == (const ConstIterator& x) const
  2025. {
  2026. return equal(x);
  2027. }
  2028. bool operator != (const Iterator& x) const
  2029. {
  2030. return ! operator==(x);
  2031. }
  2032. Iterator& operator += (ptrdiff_t n)
  2033. {
  2034. return *advance(n);
  2035. }
  2036. Iterator& operator -= (ptrdiff_t n)
  2037. {
  2038. return *advance(-n);
  2039. }
  2040. Iterator* operator + (ptrdiff_t n) const
  2041. {
  2042. return dup()->advance(n);
  2043. }
  2044. Iterator* operator - (ptrdiff_t n) const
  2045. {
  2046. return dup()->advance(-n);
  2047. }
  2048. ptrdiff_t operator - (const Iterator& x) const
  2049. {
  2050. return x.distance(*this);
  2051. }
  2052. };
  2053. }
  2054. SWIGINTERN VALUE
  2055. SWIG_ruby_failed(void)
  2056. {
  2057. return Qnil;
  2058. }
  2059. /*@SWIG:/usr/local/share/swig/2.0.4/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
  2060. SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
  2061. {
  2062. VALUE obj = args[0];
  2063. VALUE type = TYPE(obj);
  2064. unsigned long *res = (unsigned long *)(args[1]);
  2065. *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj);
  2066. return obj;
  2067. }
  2068. /*@SWIG@*/
  2069. SWIGINTERN int
  2070. SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val)
  2071. {
  2072. VALUE type = TYPE(obj);
  2073. if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
  2074. unsigned long v;
  2075. VALUE a[2];
  2076. a[0] = obj;
  2077. a[1] = (VALUE)(&v);
  2078. if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
  2079. if (val) *val = v;
  2080. return SWIG_OK;
  2081. }
  2082. }
  2083. return SWIG_TypeError;
  2084. }
  2085. SWIGINTERNINLINE int
  2086. SWIG_AsVal_size_t (VALUE obj, size_t *val)
  2087. {
  2088. unsigned long v;
  2089. int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
  2090. if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v);
  2091. return res;
  2092. }
  2093. SWIGINTERNINLINE VALUE
  2094. SWIG_From_bool (bool value)
  2095. {
  2096. return value ? Qtrue : Qfalse;
  2097. }
  2098. /*@SWIG:/usr/local/share/swig/2.0.4/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
  2099. SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
  2100. {
  2101. VALUE obj = args[0];
  2102. VALUE type = TYPE(obj);
  2103. long *res = (long *)(args[1]);
  2104. *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
  2105. return obj;
  2106. }
  2107. /*@SWIG@*/
  2108. SWIGINTERN int
  2109. SWIG_AsVal_long (VALUE obj, long* val)
  2110. {
  2111. VALUE type = TYPE(obj);
  2112. if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
  2113. long v;
  2114. VALUE a[2];
  2115. a[0] = obj;
  2116. a[1] = (VALUE)(&v);
  2117. if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
  2118. if (val) *val = v;
  2119. return SWIG_OK;
  2120. }
  2121. }
  2122. return SWIG_TypeError;
  2123. }
  2124. SWIGINTERNINLINE int
  2125. SWIG_AsVal_ptrdiff_t (VALUE obj, ptrdiff_t *val)
  2126. {
  2127. long v;
  2128. int res = SWIG_AsVal_long (obj, val ? &v : 0);
  2129. if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v);
  2130. return res;
  2131. }
  2132. #include <limits.h>
  2133. #if !defined(SWIG_NO_LLONG_MAX)
  2134. # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
  2135. # define LLONG_MAX __LONG_LONG_MAX__
  2136. # define LLONG_MIN (-LLONG_MAX - 1LL)
  2137. # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
  2138. # endif
  2139. #endif
  2140. #define SWIG_From_long LONG2NUM
  2141. SWIGINTERNINLINE VALUE
  2142. SWIG_From_ptrdiff_t (ptrdiff_t value)
  2143. {
  2144. return SWIG_From_long (static_cast< long >(value));
  2145. }
  2146. #include <stdexcept>
  2147. #include <algorithm>
  2148. #include <vector>
  2149. SWIGINTERN int
  2150. SWIG_AsVal_int (VALUE obj, int *val)
  2151. {
  2152. long v;
  2153. int res = SWIG_AsVal_long (obj, &v);
  2154. if (SWIG_IsOK(res)) {
  2155. if ((v < INT_MIN || v > INT_MAX)) {
  2156. return SWIG_OverflowError;
  2157. } else {
  2158. if (val) *val = static_cast< int >(v);
  2159. }
  2160. }
  2161. return res;
  2162. }
  2163. SWIGINTERNINLINE VALUE
  2164. SWIG_From_int (int value)
  2165. {
  2166. return SWIG_From_long (value);
  2167. }
  2168. namespace swig {
  2169. template <class Type>
  2170. struct noconst_traits {
  2171. typedef Type noconst_type;
  2172. };
  2173. template <class Type>
  2174. struct noconst_traits<const Type> {
  2175. typedef Type noconst_type;
  2176. };
  2177. /*
  2178. type categories
  2179. */
  2180. struct pointer_category { };
  2181. struct value_category { };
  2182. /*
  2183. General traits that provides type_name and type_info
  2184. */
  2185. template <class Type> struct traits { };
  2186. template <class Type>
  2187. inline const char* type_name() {
  2188. return traits<typename noconst_traits<Type >::noconst_type >::type_name();
  2189. }
  2190. template <class Type>
  2191. struct traits_info {
  2192. static swig_type_info *type_query(std::string name) {
  2193. name += " *";
  2194. return SWIG_TypeQuery(name.c_str());
  2195. }
  2196. static swig_type_info *type_info() {
  2197. static swig_type_info *info = type_query(type_name<Type>());
  2198. return info;
  2199. }
  2200. };
  2201. template <class Type>
  2202. inline swig_type_info *type_info() {
  2203. return traits_info<Type>::type_info();
  2204. }
  2205. /*
  2206. Partial specialization for pointers
  2207. */
  2208. template <class Type> struct traits <Type *> {
  2209. typedef pointer_category category;
  2210. static std::string make_ptr_name(const char* name) {
  2211. std::string ptrname = name;
  2212. ptrname += " *";
  2213. return ptrname;
  2214. }
  2215. static const char* type_name() {
  2216. static std::string name = make_ptr_name(swig::type_name<Type>());
  2217. return name.c_str();
  2218. }
  2219. };
  2220. template <class Type, class Category>
  2221. struct traits_as { };
  2222. template <class Type, class Category>
  2223. struct traits_check { };
  2224. }
  2225. namespace swig {
  2226. /*
  2227. Traits that provides the from method
  2228. */
  2229. template <class Type> struct traits_from_ptr {
  2230. static VALUE from(Type *val, int owner = 0) {
  2231. return SWIG_NewPointerObj(val, type_info<Type>(), owner);
  2232. }
  2233. };
  2234. template <class Type> struct traits_from {
  2235. static VALUE from(const Type& val) {
  2236. return traits_from_ptr<Type>::from(new Type(val), 1);
  2237. }
  2238. };
  2239. template <class Type> struct traits_from<Type *> {
  2240. static VALUE from(Type* val) {
  2241. return traits_from_ptr<Type>::from(val, 0);
  2242. }
  2243. };
  2244. template <class Type> struct traits_from<const Type *> {
  2245. static VALUE from(const Type* val) {
  2246. return traits_from_ptr<Type>::from(const_cast<Type*>(val), 0);
  2247. }
  2248. };
  2249. template <class Type>
  2250. inline VALUE from(const Type& val) {
  2251. return traits_from<Type>::from(val);
  2252. }
  2253. template <class Type>
  2254. inline VALUE from_ptr(Type* val, int owner) {
  2255. return traits_from_ptr<Type>::from(val, owner);
  2256. }
  2257. /*
  2258. Traits that provides the asval/as/check method
  2259. */
  2260. template <class Type>
  2261. struct traits_asptr {
  2262. static int asptr(VALUE obj, Type **val) {
  2263. Type *p;
  2264. int res = SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0);
  2265. if (SWIG_IsOK(res)) {
  2266. if (val) *val = p;
  2267. }
  2268. return res;
  2269. }
  2270. };
  2271. template <class Type>
  2272. inline int asptr(VALUE obj, Type **vptr) {
  2273. return traits_asptr<Type>::asptr(obj, vptr);
  2274. }
  2275. template <class Type>
  2276. struct traits_asval {
  2277. static int asval(VALUE obj, Type *val) {
  2278. if (val) {
  2279. Type *p = 0;
  2280. int res = traits_asptr<Type>::asptr(obj, &p);
  2281. if (!SWIG_IsOK(res)) return res;
  2282. if (p) {
  2283. typedef typename noconst_traits<Type>::noconst_type noconst_type;
  2284. *(const_cast<noconst_type*>(val)) = *p;
  2285. if (SWIG_IsNewObj(res)){
  2286. delete p;
  2287. res = SWIG_DelNewMask(res);
  2288. }
  2289. return res;
  2290. } else {
  2291. return SWIG_ERROR;
  2292. }
  2293. } else {
  2294. return traits_asptr<Type>::asptr(obj, (Type **)(0));
  2295. }
  2296. }
  2297. };
  2298. template <class Type> struct traits_asval<Type*> {
  2299. static int asval(VALUE obj, Type **val) {
  2300. if (val) {
  2301. typedef typename noconst_traits<Type>::noconst_type noconst_type;
  2302. noconst_type *p = 0;
  2303. int res = traits_asptr<noconst_type>::asptr(obj, &p);
  2304. if (SWIG_IsOK(res)) {
  2305. *(const_cast<noconst_type**>(val)) = p;
  2306. }
  2307. return res;
  2308. } else {
  2309. return traits_asptr<Type>::asptr(obj, (Type **)(0));
  2310. }
  2311. }
  2312. };
  2313. template <class Type>
  2314. inline int asval(VALUE obj, Type *val) {
  2315. return traits_asval<Type>::asval(obj, val);
  2316. }
  2317. template <class Type>
  2318. struct traits_as<Type, value_category> {
  2319. static Type as(VALUE obj, bool throw_error) {
  2320. Type v;
  2321. int res = asval(obj, &v);
  2322. if (!obj || !SWIG_IsOK(res)) {
  2323. if (throw_error) throw std::invalid_argument("bad type");
  2324. VALUE lastErr = rb_gv_get("$!");
  2325. if (lastErr == Qnil) {
  2326. SWIG_Error(SWIG_TypeError, swig::type_name<Type>());
  2327. }
  2328. }
  2329. return v;
  2330. }
  2331. };
  2332. template <class Type>
  2333. struct traits_as<Type, pointer_category> {
  2334. static Type as(VALUE obj, bool throw_error) {
  2335. Type *v = 0;
  2336. int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
  2337. if (SWIG_IsOK(res) && v) {
  2338. if (SWIG_IsNewObj(res)) {
  2339. Type r(*v);
  2340. delete v;
  2341. return r;
  2342. } else {
  2343. return *v;
  2344. }
  2345. } else {
  2346. // Uninitialized return value, no Type() constructor required.
  2347. if (throw_error) throw std::invalid_argument("bad type");
  2348. VALUE lastErr = rb_gv_get("$!");
  2349. if (lastErr == Qnil) {
  2350. SWIG_Error(SWIG_TypeError, swig::type_name<Type>());
  2351. }
  2352. static Type *v_def = (Type*) malloc(sizeof(Type));
  2353. memset(v_def,0,sizeof(Type));
  2354. return *v_def;
  2355. }
  2356. }
  2357. };
  2358. template <class Type>
  2359. struct traits_as<Type*, pointer_category> {
  2360. static Type* as(VALUE obj, bool throw_error) {
  2361. Type *v = 0;
  2362. int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
  2363. if (SWIG_IsOK(res)) {
  2364. return v;
  2365. } else {
  2366. if (throw_error) throw std::invalid_argument("bad type");
  2367. VALUE lastErr = rb_gv_get("$!");
  2368. if (lastErr == Qnil) {
  2369. SWIG_Error(SWIG_TypeError, swig::type_name<Type>());
  2370. }
  2371. return 0;
  2372. }
  2373. }
  2374. };
  2375. template <class Type>
  2376. inline Type as(VALUE obj, bool te = false) {
  2377. return traits_as< Type, typename traits< Type >::category >::as(obj, te);
  2378. }
  2379. template <class Type>
  2380. struct traits_check<Type, value_category> {
  2381. static bool check(VALUE obj) {
  2382. int res = obj ? asval(obj, (Type *)(0)) : SWIG_ERROR;
  2383. return SWIG_IsOK(res) ? true : false;
  2384. }
  2385. };
  2386. template <class Type>
  2387. struct traits_check<Type, pointer_category> {
  2388. static bool check(VALUE obj) {
  2389. int res = obj ? asptr(obj, (Type **)(0)) : SWIG_ERROR;
  2390. return SWIG_IsOK(res) ? true : false;
  2391. }
  2392. };
  2393. template <class Type>
  2394. inline bool check(VALUE obj) {
  2395. return traits_check<Type, typename traits<Type>::category>::check(obj);
  2396. }
  2397. }
  2398. namespace swig {
  2399. template <> struct traits<int > {
  2400. typedef value_category category;
  2401. static const char* type_name() { return"int"; }
  2402. };
  2403. template <> struct traits_asval<int > {
  2404. typedef int value_type;
  2405. static int asval(VALUE obj, value_type *val) {
  2406. return SWIG_AsVal_int (obj, val);
  2407. }
  2408. };
  2409. template <> struct traits_from<int > {
  2410. typedef int value_type;
  2411. static VALUE from(const value_type& val) {
  2412. return SWIG_From_int (val);
  2413. }
  2414. };
  2415. }
  2416. #include <functional>
  2417. namespace swig {
  2418. template < class T >
  2419. struct yield : public std::unary_function< T, bool >
  2420. {
  2421. bool
  2422. operator()( const T& v ) const
  2423. {
  2424. return RTEST( rb_yield( swig::from< T >(v) ) );
  2425. }
  2426. };
  2427. inline size_t
  2428. check_index(ptrdiff_t i, size_t size, bool insert = false) {
  2429. if ( i < 0 ) {
  2430. if ((size_t) (-i) <= size)
  2431. return (size_t) (i + size);
  2432. } else if ( (size_t) i < size ) {
  2433. return (size_t) i;
  2434. } else if (insert && ((size_t) i == size)) {
  2435. return size;
  2436. }
  2437. throw std::out_of_range("index out of range");
  2438. }
  2439. inline size_t
  2440. slice_index(ptrdiff_t i, size_t size) {
  2441. if ( i < 0 ) {
  2442. if ((size_t) (-i) <= size) {
  2443. return (size_t) (i + size);
  2444. } else {
  2445. throw std::out_of_range("index out of range");
  2446. }
  2447. } else {
  2448. return ( (size_t) i < size ) ? ((size_t) i) : size;
  2449. }
  2450. }
  2451. template <class Sequence, class Difference>
  2452. inline typename Sequence::iterator
  2453. getpos(Sequence* self, Difference i) {
  2454. typename Sequence::iterator pos = self->begin();
  2455. std::advance(pos, check_index(i,self->size()));
  2456. return pos;
  2457. }
  2458. template <class Sequence, class Difference>
  2459. inline typename Sequence::const_iterator
  2460. cgetpos(const Sequence* self, Difference i) {
  2461. typename Sequence::const_iterator pos = self->begin();
  2462. std::advance(pos, check_index(i,self->size()));
  2463. return pos;
  2464. }
  2465. template <class Sequence, class Difference>
  2466. inline Sequence*
  2467. getslice(const Sequence* self, Difference i, Difference j) {
  2468. typename Sequence::size_type size = self->size();
  2469. typename Sequence::size_type ii = swig::check_index(i, size);
  2470. typename Sequence::size_type jj = swig::slice_index(j, size);
  2471. if (jj > ii) {
  2472. typename Sequence::const_iterator vb = self->begin();
  2473. typename Sequence::const_iterator ve = self->begin();
  2474. std::advance(vb,ii);
  2475. std::advance(ve,jj);
  2476. return new Sequence(vb, ve);
  2477. } else {
  2478. return new Sequence();
  2479. }
  2480. }
  2481. template <class Sequence, class Difference, class InputSeq>
  2482. inline void
  2483. setslice(Sequence* self, Difference i, Difference j, const InputSeq& v) {
  2484. typename Sequence::size_type size = self->size();
  2485. typename Sequence::size_type ii = swig::check_index(i, size, true);
  2486. typename Sequence::size_type jj = swig::slice_index(j, size);
  2487. if (jj < ii) jj = ii;
  2488. size_t ssize = jj - ii;
  2489. if (ssize <= v.size()) {
  2490. typename Sequence::iterator sb = self->begin();
  2491. typename InputSeq::const_iterator vmid = v.begin();
  2492. std::advance(sb,ii);
  2493. std::advance(vmid, jj - ii);
  2494. self->insert(std::copy(v.begin(), vmid, sb), vmid, v.end());
  2495. } else {
  2496. typename Sequence::iterator sb = self->begin();
  2497. typename Sequence::iterator se = self->begin();
  2498. std::advance(sb,ii);
  2499. std::advance(se,jj);
  2500. self->erase(sb,se);
  2501. self->insert(sb, v.begin(), v.end());
  2502. }
  2503. }
  2504. template <class Sequence, class Difference>
  2505. inline void
  2506. delslice(Sequence* self, Difference i, Difference j) {
  2507. typename Sequence::size_type size = self->size();
  2508. typename Sequence::size_type ii = swig::check_index(i, size, true);
  2509. typename Sequence::size_type jj = swig::slice_index(j, size);
  2510. if (jj > ii) {
  2511. typename Sequence::iterator sb = self->begin();
  2512. typename Sequence::iterator se = self->begin();
  2513. std::advance(sb,ii);
  2514. std::advance(se,jj);
  2515. self->erase(sb,se);
  2516. }
  2517. }
  2518. }
  2519. #if defined(__SUNPRO_CC) && defined(_RWSTD_VER)
  2520. # if !defined(SWIG_NO_STD_NOITERATOR_TRAITS_STL)
  2521. # define SWIG_STD_NOITERATOR_TRAITS_STL
  2522. # endif
  2523. #endif
  2524. #if !defined(SWIG_STD_NOITERATOR_TRAITS_STL)
  2525. #include <iterator>
  2526. #else
  2527. namespace std {
  2528. template <class Iterator>
  2529. struct iterator_traits {
  2530. typedef ptrdiff_t difference_type;
  2531. typedef typename Iterator::value_type value_type;
  2532. };
  2533. template <class Iterator, class Category,class T, class Reference, class Pointer, class Distance>
  2534. struct iterator_traits<__reverse_bi_iterator<Iterator,Category,T,Reference,Pointer,Distance> > {
  2535. typedef Distance difference_type;
  2536. typedef T value_type;
  2537. };
  2538. template <class T>
  2539. struct iterator_traits<T*> {
  2540. typedef T value_type;
  2541. typedef ptrdiff_t difference_type;
  2542. };
  2543. template<typename _InputIterator>
  2544. inline typename iterator_traits<_InputIterator>::difference_type
  2545. distance(_InputIterator __first, _InputIterator __last)
  2546. {
  2547. typename iterator_traits<_InputIterator>::difference_type __n = 0;
  2548. while (__first != __last) {
  2549. ++__first; ++__n;
  2550. }
  2551. return __n;
  2552. }
  2553. }
  2554. #endif
  2555. namespace swig {
  2556. /**
  2557. * Templated base classes for all custom const_iterators.
  2558. *
  2559. */
  2560. template<typename OutConstIterator>
  2561. class ConstIterator_T : public ConstIterator
  2562. {
  2563. public:
  2564. typedef OutConstIterator const_iter;
  2565. typedef typename std::iterator_traits<const_iter>::value_type value_type;
  2566. typedef ConstIterator_T<const_iter> self_type;
  2567. protected:
  2568. virtual bool equal (const ConstIterator &iter) const
  2569. {
  2570. const self_type *iters = dynamic_cast<const self_type *>(&iter);
  2571. if (iters) {
  2572. return (current == iters->get_current());
  2573. } else {
  2574. throw std::invalid_argument("bad iterator type");
  2575. }
  2576. }
  2577. virtual ptrdiff_t distance(const ConstIterator &iter) const
  2578. {
  2579. const self_type *iters = dynamic_cast<const self_type *>(&iter);
  2580. if (iters) {
  2581. return std::distance(current, iters->get_current());
  2582. } else {
  2583. throw std::invalid_argument("bad iterator type");
  2584. }
  2585. }
  2586. virtual ConstIterator* advance(ptrdiff_t n)
  2587. {
  2588. std::advance( current, n );
  2589. return this;
  2590. }
  2591. public:
  2592. ConstIterator_T() : ConstIterator(Qnil)
  2593. {
  2594. }
  2595. ConstIterator_T(const_iter curr, VALUE seq = Qnil)
  2596. : ConstIterator(seq), current(curr)
  2597. {
  2598. }
  2599. const const_iter& get_current() const
  2600. {
  2601. return current;
  2602. }
  2603. const value_type& operator*() const
  2604. {
  2605. return *current;
  2606. }
  2607. virtual VALUE inspect() const
  2608. {
  2609. VALUE ret = rb_str_new2("#<");
  2610. ret = rb_str_cat2( ret, rb_obj_classname(_seq) );
  2611. ret = rb_str_cat2( ret, "::const_iterator " );
  2612. VALUE cur = value();
  2613. ret = rb_str_concat( ret, rb_inspect(cur) );
  2614. ret = rb_str_cat2( ret, ">" );
  2615. return ret;
  2616. }
  2617. virtual VALUE to_s() const
  2618. {
  2619. VALUE ret = rb_str_new2( rb_obj_classname(_seq) );
  2620. ret = rb_str_cat2( ret, "::const_iterator " );
  2621. VALUE cur = value();
  2622. ret = rb_str_concat( ret, rb_obj_as_string(cur) );
  2623. return ret;
  2624. }
  2625. protected:
  2626. const_iter current;
  2627. };
  2628. /**
  2629. * Templated base classes for all custom non-const iterators.
  2630. *
  2631. */
  2632. template<typename InOutIterator>
  2633. class Iterator_T : public Iterator
  2634. {
  2635. public:
  2636. typedef InOutIterator nonconst_iter;
  2637. // Make this class iterator STL compatible, by using iterator_traits
  2638. typedef typename std::iterator_traits<nonconst_iter >::iterator_category iterator_category;
  2639. typedef typename std::iterator_traits<nonconst_iter >::value_type value_type;
  2640. typedef typename std::iterator_traits<nonconst_iter >::difference_type difference_type;
  2641. typedef typename std::iterator_traits<nonconst_iter >::pointer pointer;
  2642. typedef typename std::iterator_traits<nonconst_iter >::reference reference;
  2643. typedef Iterator base;
  2644. typedef Iterator_T< nonconst_iter > self_type;
  2645. protected:
  2646. virtual bool equal (const ConstIterator &iter) const
  2647. {
  2648. const self_type *iters = dynamic_cast<const self_type *>(&iter);
  2649. if (iters) {
  2650. return (current == iters->get_current());
  2651. } else {
  2652. throw std::invalid_argument("bad iterator type");
  2653. }
  2654. }
  2655. virtual ptrdiff_t distance(const ConstIterator &iter) const
  2656. {
  2657. const self_type *iters = dynamic_cast<const self_type *>(&iter);
  2658. if (iters) {
  2659. return std::distance(current, iters->get_current());
  2660. } else {
  2661. throw std::invalid_argument("bad iterator type");
  2662. }
  2663. }
  2664. virtual Iterator* advance(ptrdiff_t n)
  2665. {
  2666. std::advance( current, n );
  2667. return this;
  2668. }
  2669. public:
  2670. Iterator_T(nonconst_iter curr, VALUE seq = Qnil)
  2671. : Iterator(seq), current(curr)
  2672. {
  2673. }
  2674. const nonconst_iter& get_current() const
  2675. {
  2676. return current;
  2677. }
  2678. self_type& operator=( const self_type& b )
  2679. {
  2680. base::operator=( b );
  2681. return *this;
  2682. }
  2683. self_type& operator=( const value_type& b )
  2684. {
  2685. *current = b;
  2686. return *this;
  2687. }
  2688. const value_type& operator*() const
  2689. {
  2690. return *current;
  2691. }
  2692. value_type& operator*()
  2693. {
  2694. return *current;
  2695. }
  2696. virtual VALUE inspect() const
  2697. {
  2698. VALUE ret = rb_str_new2("#<");
  2699. ret = rb_str_cat2( ret, rb_obj_classname(_seq) );
  2700. ret = rb_str_cat2( ret, "::iterator " );
  2701. VALUE cur = value();
  2702. ret = rb_str_concat( ret, rb_inspect(cur) );
  2703. ret = rb_str_cat2( ret, ">" );
  2704. return ret;
  2705. }
  2706. virtual VALUE to_s() const
  2707. {
  2708. VALUE ret = rb_str_new2( rb_obj_classname(_seq) );
  2709. ret = rb_str_cat2( ret, "::iterator " );
  2710. VALUE cur = value();
  2711. ret = rb_str_concat( ret, rb_obj_as_string(cur) );
  2712. return ret;
  2713. }
  2714. protected:
  2715. nonconst_iter current;
  2716. };
  2717. /**
  2718. * Auxiliary functor to store the value of a ruby object inside
  2719. * a reference of a compatible C++ type. ie: Ruby -> C++
  2720. *
  2721. */
  2722. template <class ValueType>
  2723. struct asval_oper
  2724. {
  2725. typedef ValueType value_type;
  2726. typedef bool result_type;
  2727. bool operator()(VALUE obj, value_type& v) const
  2728. {
  2729. return ( swig::asval< value_type >(obj, &v) == SWIG_OK );
  2730. }
  2731. };
  2732. /**
  2733. * Auxiliary functor to return a ruby object from a C++ type.
  2734. * ie: C++ -> Ruby
  2735. *
  2736. */
  2737. template <class ValueType>
  2738. struct from_oper
  2739. {
  2740. typedef const ValueType& argument_type;
  2741. typedef VALUE result_type;
  2742. result_type operator()(argument_type v) const
  2743. {
  2744. return swig::from(v);
  2745. }
  2746. };
  2747. /**
  2748. * ConstIterator class for a const_iterator with no end() boundaries.
  2749. *
  2750. */
  2751. template<typename OutConstIterator,
  2752. typename ValueType = typename std::iterator_traits<OutConstIterator>::value_type,
  2753. typename FromOper = from_oper<ValueType> >
  2754. class ConstIteratorOpen_T : public ConstIterator_T<OutConstIterator>
  2755. {
  2756. public:
  2757. FromOper from;
  2758. typedef OutConstIterator const_iter;
  2759. typedef ValueType value_type;
  2760. typedef ConstIterator_T<const_iter> base;
  2761. typedef ConstIteratorOpen_T<OutConstIterator, ValueType, FromOper> self_type;
  2762. ConstIteratorOpen_T(const_iter curr, VALUE seq = Qnil)
  2763. : ConstIterator_T<OutConstIterator>(curr, seq)
  2764. {
  2765. }
  2766. virtual VALUE value() const {
  2767. return from(static_cast<const value_type&>(*(base::current)));
  2768. }
  2769. ConstIterator *dup() const
  2770. {
  2771. return new self_type(*this);
  2772. }
  2773. };
  2774. /**
  2775. * Iterator class for an iterator with no end() boundaries.
  2776. *
  2777. */
  2778. template<typename InOutIterator,
  2779. typename ValueType = typename std::iterator_traits<InOutIterator>::value_type,
  2780. typename FromOper = from_oper<ValueType>,
  2781. typename AsvalOper = asval_oper<ValueType> >
  2782. class IteratorOpen_T : public Iterator_T<InOutIterator>
  2783. {
  2784. public:
  2785. FromOper from;
  2786. AsvalOper asval;
  2787. typedef InOutIterator nonconst_iter;
  2788. typedef ValueType value_type;
  2789. typedef Iterator_T<nonconst_iter> base;
  2790. typedef IteratorOpen_T<InOutIterator, ValueType, FromOper, AsvalOper> self_type;
  2791. public:
  2792. IteratorOpen_T(nonconst_iter curr, VALUE seq = Qnil)
  2793. : Iterator_T<InOutIterator>(curr, seq)
  2794. {
  2795. }
  2796. virtual VALUE value() const {
  2797. return from(static_cast<const value_type&>(*(base::current)));
  2798. }
  2799. virtual VALUE setValue( const VALUE& v )
  2800. {
  2801. value_type& dst = *base::current;
  2802. if ( asval(v, dst) ) return v;
  2803. return Qnil;
  2804. }
  2805. Iterator *dup() const
  2806. {
  2807. return new self_type(*this);
  2808. }
  2809. };
  2810. /**
  2811. * ConstIterator class for a const_iterator where begin() and end() boundaries are known.
  2812. *
  2813. */
  2814. template<typename OutConstIterator,
  2815. typename ValueType = typename std::iterator_traits<OutConstIterator>::value_type,
  2816. typename FromOper = from_oper<ValueType> >
  2817. class ConstIteratorClosed_T : public ConstIterator_T<OutConstIterator>
  2818. {
  2819. public:
  2820. FromOper from;
  2821. typedef OutConstIterator const_iter;
  2822. typedef ValueType value_type;
  2823. typedef ConstIterator_T<const_iter> base;
  2824. typedef ConstIteratorClosed_T<OutConstIterator, ValueType, FromOper> self_type;
  2825. protected:
  2826. virtual ConstIterator* advance(ptrdiff_t n)
  2827. {
  2828. std::advance( base::current, n );
  2829. if ( base::current == end )
  2830. throw stop_iteration();
  2831. return this;
  2832. }
  2833. public:
  2834. ConstIteratorClosed_T(const_iter curr, const_iter first,
  2835. const_iter last, VALUE seq = Qnil)
  2836. : ConstIterator_T<OutConstIterator>(curr, seq), begin(first), end(last)
  2837. {
  2838. }
  2839. virtual VALUE value() const {
  2840. if (base::current == end) {
  2841. throw stop_iteration();
  2842. } else {
  2843. return from(static_cast<const value_type&>(*(base::current)));
  2844. }
  2845. }
  2846. ConstIterator *dup() const
  2847. {
  2848. return new self_type(*this);
  2849. }
  2850. private:
  2851. const_iter begin;
  2852. const_iter end;
  2853. };
  2854. /**
  2855. * Iterator class for a iterator where begin() and end() boundaries are known.
  2856. *
  2857. */
  2858. template<typename InOutIterator,
  2859. typename ValueType = typename std::iterator_traits<InOutIterator>::value_type,
  2860. typename FromOper = from_oper<ValueType>,
  2861. typename AsvalOper = asval_oper<ValueType> >
  2862. class IteratorClosed_T : public Iterator_T<InOutIterator>
  2863. {
  2864. public:
  2865. FromOper from;
  2866. AsvalOper asval;
  2867. typedef InOutIterator nonconst_iter;
  2868. typedef ValueType value_type;
  2869. typedef Iterator_T<nonconst_iter> base;
  2870. typedef IteratorClosed_T<InOutIterator, ValueType, FromOper, AsvalOper> self_type;
  2871. protected:
  2872. virtual Iterator* advance(ptrdiff_t n)
  2873. {
  2874. std::advance( base::current, n );
  2875. if ( base::current == end )
  2876. throw stop_iteration();
  2877. return this;
  2878. }
  2879. public:
  2880. IteratorClosed_T(nonconst_iter curr, nonconst_iter first,
  2881. nonconst_iter last, VALUE seq = Qnil)
  2882. : Iterator_T<InOutIterator>(curr, seq), begin(first), end(last)
  2883. {
  2884. }
  2885. virtual VALUE value() const {
  2886. if (base::current == end) {
  2887. throw stop_iteration();
  2888. } else {
  2889. return from(static_cast<const value_type&>(*(base::current)));
  2890. }
  2891. }
  2892. // Iterator setter method, required by Ruby
  2893. virtual VALUE setValue( const VALUE& v )
  2894. {
  2895. if (base::current == end)
  2896. throw stop_iteration();
  2897. value_type& dst = *base::current;
  2898. if ( asval( v, dst ) ) return v;
  2899. return Qnil;
  2900. }
  2901. Iterator *dup() const
  2902. {
  2903. return new self_type(*this);
  2904. }
  2905. private:
  2906. nonconst_iter begin;
  2907. nonconst_iter end;
  2908. };
  2909. /* Partial specialization for bools which don't allow de-referencing */
  2910. template< typename InOutIterator, typename FromOper, typename AsvalOper >
  2911. class IteratorOpen_T< InOutIterator, bool, FromOper, AsvalOper > :
  2912. public Iterator_T<InOutIterator>
  2913. {
  2914. public:
  2915. FromOper from;
  2916. AsvalOper asval;
  2917. typedef InOutIterator nonconst_iter;
  2918. typedef bool value_type;
  2919. typedef Iterator_T<nonconst_iter> base;
  2920. typedef IteratorOpen_T<InOutIterator, bool, FromOper, AsvalOper> self_type;
  2921. IteratorOpen_T(nonconst_iter curr, VALUE seq = Qnil)
  2922. : Iterator_T<InOutIterator>(curr, seq)
  2923. {
  2924. }
  2925. virtual VALUE value() const {
  2926. return from(static_cast<const value_type&>(*(base::current)));
  2927. }
  2928. virtual VALUE setValue( const VALUE& v )
  2929. {
  2930. bool tmp = *base::current;
  2931. if ( asval( v, tmp ) )
  2932. {
  2933. *base::current = tmp;
  2934. return v;
  2935. }
  2936. return Qnil;
  2937. }
  2938. Iterator *dup() const
  2939. {
  2940. return new self_type(*this);
  2941. }
  2942. };
  2943. /* Partial specialization for bools which don't allow de-referencing */
  2944. template< typename InOutIterator, typename FromOper, typename AsvalOper >
  2945. class IteratorClosed_T< InOutIterator, bool, FromOper, AsvalOper > :
  2946. public Iterator_T<InOutIterator>
  2947. {
  2948. public:
  2949. FromOper from;
  2950. AsvalOper asval;
  2951. typedef InOutIterator nonconst_iter;
  2952. typedef bool value_type;
  2953. typedef Iterator_T<nonconst_iter> base;
  2954. typedef IteratorClosed_T<InOutIterator, bool, FromOper, AsvalOper> self_type;
  2955. protected:
  2956. virtual Iterator* advance(ptrdiff_t n)
  2957. {
  2958. std::advance( base::current, n );
  2959. if ( base::current == end )
  2960. throw stop_iteration();
  2961. return this;
  2962. }
  2963. public:
  2964. IteratorClosed_T(nonconst_iter curr, nonconst_iter first,
  2965. nonconst_iter last, VALUE seq = Qnil)
  2966. : Iterator_T<InOutIterator>(curr, seq), begin(first), end(last)
  2967. {
  2968. }
  2969. virtual VALUE value() const {
  2970. if (base::current == end) {
  2971. throw stop_iteration();
  2972. } else {
  2973. return from(static_cast<const value_type&>(*(base::current)));
  2974. }
  2975. }
  2976. virtual VALUE setValue( const VALUE& v )
  2977. {
  2978. if (base::current == end)
  2979. throw stop_iteration();
  2980. bool tmp = *base::current;
  2981. if ( asval( v, tmp ) )
  2982. {
  2983. *base::current = tmp;
  2984. return v;
  2985. }
  2986. return Qnil;
  2987. }
  2988. Iterator *dup() const
  2989. {
  2990. return new self_type(*this);
  2991. }
  2992. private:
  2993. nonconst_iter begin;
  2994. nonconst_iter end;
  2995. };
  2996. /**
  2997. * Helper function used to wrap a bounded const_iterator. This is to be used in
  2998. * a %typemap(out), for example.
  2999. *
  3000. */
  3001. template<typename InOutIter>
  3002. inline Iterator*
  3003. make_nonconst_iterator(const InOutIter& current, const InOutIter& begin,
  3004. const InOutIter& end, VALUE seq = Qnil)
  3005. {
  3006. return new IteratorClosed_T<InOutIter>(current, begin, end, seq);
  3007. }
  3008. /**
  3009. * Helper function used to wrap an unbounded const_iterator. This is to be used in
  3010. * a %typemap(out), for example.
  3011. *
  3012. */
  3013. template<typename InOutIter>
  3014. inline Iterator*
  3015. make_nonconst_iterator(const InOutIter& current, VALUE seq = Qnil)
  3016. {
  3017. return new IteratorOpen_T<InOutIter>(current, seq);
  3018. }
  3019. /**
  3020. * Helper function used to wrap a bounded const_iterator. This is to be used in
  3021. * a %typemap(out), for example.
  3022. *
  3023. */
  3024. template<typename OutIter>
  3025. inline ConstIterator*
  3026. make_const_iterator(const OutIter& current, const OutIter& begin,
  3027. const OutIter& end, VALUE seq = Qnil)
  3028. {
  3029. return new ConstIteratorClosed_T<OutIter>(current, begin, end, seq);
  3030. }
  3031. /**
  3032. * Helper function used to wrap an unbounded const_iterator. This is to be used in
  3033. * a %typemap(out), for example.
  3034. *
  3035. */
  3036. template<typename OutIter>
  3037. inline ConstIterator*
  3038. make_const_iterator(const OutIter& current, VALUE seq = Qnil)
  3039. {
  3040. return new ConstIteratorOpen_T<OutIter>(current, seq);
  3041. }
  3042. }
  3043. namespace swig
  3044. {
  3045. /**
  3046. * This class is a proxy class for references, used to return and set values
  3047. * of an element of a Ruby Array of stuff.
  3048. * It can be used by RubySequence_InputIterator to make it work with STL
  3049. * algorithms.
  3050. *
  3051. */
  3052. template <class T>
  3053. struct RubySequence_Ref
  3054. {
  3055. RubySequence_Ref(VALUE seq, int index)
  3056. : _seq(seq), _index(index)
  3057. {
  3058. }
  3059. operator T () const
  3060. {
  3061. VALUE item = rb_ary_entry(_seq, _index );
  3062. try {
  3063. return swig::as<T>(item, true);
  3064. } catch (std::exception& e) {
  3065. char msg[1024];
  3066. sprintf(msg, "in sequence element %d ", _index);
  3067. VALUE lastErr = rb_gv_get("$!");
  3068. if ( lastErr == Qnil ) {
  3069. SWIG_Error(SWIG_TypeError, swig::type_name<T>());
  3070. }
  3071. VALUE str = rb_str_new2(msg);
  3072. str = rb_str_cat2( str, e.what() );
  3073. SWIG_Ruby_ExceptionType( NULL, str );
  3074. throw;
  3075. }
  3076. }
  3077. RubySequence_Ref& operator=(const T& v)
  3078. {
  3079. rb_ary_set(_seq, _index, swig::from< T >(v));
  3080. return *this;
  3081. }
  3082. private:
  3083. VALUE _seq;
  3084. int _index;
  3085. };
  3086. /**
  3087. * This class is a proxy to return a pointer to a class, usually
  3088. * RubySequence_Ref.
  3089. * It can be used by RubySequence_InputIterator to make it work with STL
  3090. * algorithms.
  3091. *
  3092. */
  3093. template <class T>
  3094. struct RubySequence_ArrowProxy
  3095. {
  3096. RubySequence_ArrowProxy(const T& x): m_value(x) {}
  3097. const T* operator->() const { return &m_value; }
  3098. operator const T*() const { return &m_value; }
  3099. T m_value;
  3100. };
  3101. /**
  3102. * Input Iterator. This adapator class is a random access iterator that
  3103. * allows you to use STL algorithms with a Ruby class (a Ruby Array by default).
  3104. *
  3105. */
  3106. template <class T, class Reference = RubySequence_Ref< T > >
  3107. struct RubySequence_InputIterator
  3108. {
  3109. typedef RubySequence_InputIterator<T, Reference > self;
  3110. typedef std::random_access_iterator_tag iterator_category;
  3111. typedef Reference reference;
  3112. typedef T value_type;
  3113. typedef T* pointer;
  3114. typedef ptrdiff_t difference_type;
  3115. RubySequence_InputIterator()
  3116. {
  3117. }
  3118. RubySequence_InputIterator(VALUE seq, int index)
  3119. : _seq(seq), _index(index)
  3120. {
  3121. }
  3122. reference operator*() const
  3123. {
  3124. return reference(_seq, _index);
  3125. }
  3126. RubySequence_ArrowProxy<T>
  3127. operator->() const {
  3128. return RubySequence_ArrowProxy<T>(operator*());
  3129. }
  3130. bool operator==(const self& ri) const
  3131. {
  3132. return (_index == ri._index) && (_seq == ri._seq);
  3133. }
  3134. bool operator!=(const self& ri) const
  3135. {
  3136. return !(operator==(ri));
  3137. }
  3138. self& operator ++ ()
  3139. {
  3140. ++_index;
  3141. return *this;
  3142. }
  3143. self& operator -- ()
  3144. {
  3145. --_index;
  3146. return *this;
  3147. }
  3148. self& operator += (difference_type n)
  3149. {
  3150. _index += n;
  3151. return *this;
  3152. }
  3153. self operator +(difference_type n) const
  3154. {
  3155. return self(_seq, _index + n);
  3156. }
  3157. self& operator -= (difference_type n)
  3158. {
  3159. _index -= n;
  3160. return *this;
  3161. }
  3162. self operator -(difference_type n) const
  3163. {
  3164. return self(_seq, _index - n);
  3165. }
  3166. difference_type operator - (const self& ri) const
  3167. {
  3168. return _index - ri._index;
  3169. }
  3170. bool operator < (const self& ri) const
  3171. {
  3172. return _index < ri._index;
  3173. }
  3174. reference
  3175. operator[](difference_type n) const
  3176. {
  3177. return reference(_seq, _index + n);
  3178. }
  3179. private:
  3180. VALUE _seq;
  3181. difference_type _index;
  3182. };
  3183. /**
  3184. * This adaptor class allows you to use a Ruby Array as if it was an STL
  3185. * container, giving it begin(), end(), and iterators.
  3186. *
  3187. */
  3188. template <class T>
  3189. struct RubySequence_Cont
  3190. {
  3191. typedef RubySequence_Ref<T> reference;
  3192. typedef const RubySequence_Ref<T> const_reference;
  3193. typedef T value_type;
  3194. typedef T* pointer;
  3195. typedef int difference_type;
  3196. typedef int size_type;
  3197. typedef const pointer const_pointer;
  3198. typedef RubySequence_InputIterator<T, reference> iterator;
  3199. typedef RubySequence_InputIterator<T, const_reference> const_iterator;
  3200. RubySequence_Cont(VALUE seq) : _seq(0)
  3201. {
  3202. if (!rb_obj_is_kind_of(seq, rb_cArray)) {
  3203. throw std::invalid_argument("an Array is expected");
  3204. }
  3205. _seq = seq;
  3206. }
  3207. ~RubySequence_Cont()
  3208. {
  3209. }
  3210. size_type size() const
  3211. {
  3212. return RARRAY_LEN(_seq);
  3213. }
  3214. bool empty() const
  3215. {
  3216. return size() == 0;
  3217. }
  3218. iterator begin()
  3219. {
  3220. return iterator(_seq, 0);
  3221. }
  3222. const_iterator begin() const
  3223. {
  3224. return const_iterator(_seq, 0);
  3225. }
  3226. iterator end()
  3227. {
  3228. return iterator(_seq, size());
  3229. }
  3230. const_iterator end() const
  3231. {
  3232. return const_iterator(_seq, size());
  3233. }
  3234. reference operator[](difference_type n)
  3235. {
  3236. return reference(_seq, n);
  3237. }
  3238. const_reference operator[](difference_type n) const
  3239. {
  3240. return const_reference(_seq, n);
  3241. }
  3242. bool check(bool set_err = false) const
  3243. {
  3244. int s = (int) size();
  3245. for (int i = 0; i < s; ++i) {
  3246. VALUE item = rb_ary_entry(_seq, i );
  3247. if (!swig::check<value_type>(item)) {
  3248. if (set_err) {
  3249. char msg[1024];
  3250. sprintf(msg, "in sequence element %d", i);
  3251. SWIG_Error(SWIG_RuntimeError, msg);
  3252. }
  3253. return false;
  3254. }
  3255. }
  3256. return true;
  3257. }
  3258. private:
  3259. VALUE _seq;
  3260. };
  3261. }
  3262. namespace swig {
  3263. template <class RubySeq, class Seq>
  3264. inline void
  3265. assign(const RubySeq& rubyseq, Seq* seq) {
  3266. // seq->assign(rubyseq.begin(), rubyseq.end()); // not used as not always implemented
  3267. typedef typename RubySeq::value_type value_type;
  3268. typename RubySeq::const_iterator it = rubyseq.begin();
  3269. for (;it != rubyseq.end(); ++it) {
  3270. seq->insert(seq->end(),(value_type)(*it));
  3271. }
  3272. }
  3273. template <class Seq, class T = typename Seq::value_type >
  3274. struct traits_asptr_stdseq {
  3275. typedef Seq sequence;
  3276. typedef T value_type;
  3277. static int asptr(VALUE obj, sequence **seq) {
  3278. if (rb_obj_is_kind_of(obj, rb_cArray) == Qtrue) {
  3279. try {
  3280. RubySequence_Cont<value_type> rubyseq(obj);
  3281. if (seq) {
  3282. sequence *pseq = new sequence();
  3283. assign(rubyseq, pseq);
  3284. *seq = pseq;
  3285. return SWIG_NEWOBJ;
  3286. } else {
  3287. return rubyseq.check() ? SWIG_OK : SWIG_ERROR;
  3288. }
  3289. } catch (std::exception& e) {
  3290. if (seq) {
  3291. VALUE lastErr = rb_gv_get("$!");
  3292. if (lastErr == Qnil) {
  3293. rb_raise(rb_eTypeError, "%s", e.what());
  3294. }
  3295. }
  3296. return SWIG_ERROR;
  3297. }
  3298. } else {
  3299. sequence *p;
  3300. if (SWIG_ConvertPtr(obj,(void**)&p,
  3301. swig::type_info<sequence>(),0) == SWIG_OK) {
  3302. if (seq) *seq = p;
  3303. return SWIG_OLDOBJ;
  3304. }
  3305. }
  3306. return SWIG_ERROR;
  3307. }
  3308. };
  3309. // Partial specialization for GC_VALUE's. No need to typecheck each
  3310. // element.
  3311. template< class Seq >
  3312. struct traits_asptr_stdseq< Seq, swig::GC_VALUE > {
  3313. typedef Seq sequence;
  3314. typedef swig::GC_VALUE value_type;
  3315. static int asptr(VALUE obj, sequence **seq) {
  3316. if (rb_obj_is_kind_of(obj, rb_cArray) == Qtrue) {
  3317. try {
  3318. if (seq) {
  3319. RubySequence_Cont<value_type> rubyseq(obj);
  3320. sequence *pseq = new sequence();
  3321. assign(rubyseq, pseq);
  3322. *seq = pseq;
  3323. return SWIG_NEWOBJ;
  3324. } else {
  3325. return true;
  3326. }
  3327. } catch (std::exception& e) {
  3328. if (seq) {
  3329. VALUE lastErr = rb_gv_get("$!");
  3330. if (lastErr == Qnil) {
  3331. rb_raise(rb_eTypeError, "%s", e.what());
  3332. }
  3333. }
  3334. return SWIG_ERROR;
  3335. }
  3336. } else {
  3337. sequence *p;
  3338. if (SWIG_ConvertPtr(obj,(void**)&p,
  3339. swig::type_info<sequence>(),0) == SWIG_OK) {
  3340. if (seq) *seq = p;
  3341. return SWIG_OLDOBJ;
  3342. }
  3343. }
  3344. return SWIG_ERROR;
  3345. }
  3346. };
  3347. template <class Seq, class T = typename Seq::value_type >
  3348. struct traits_from_stdseq {
  3349. typedef Seq sequence;
  3350. typedef T value_type;
  3351. typedef typename Seq::size_type size_type;
  3352. typedef typename sequence::const_iterator const_iterator;
  3353. static VALUE from(const sequence& seq) {
  3354. size_type size = seq.size();
  3355. if (size <= (size_type)INT_MAX) {
  3356. VALUE obj = rb_ary_new2((int)size);
  3357. int i = 0;
  3358. for (const_iterator it = seq.begin();
  3359. it != seq.end(); ++it, ++i) {
  3360. rb_ary_push(obj, swig::from< value_type >(*it));
  3361. }
  3362. rb_obj_freeze(obj); // treat as immutable result
  3363. return obj;
  3364. } else {
  3365. rb_raise(rb_eRangeError,"sequence size not valid in ruby");
  3366. return Qnil;
  3367. }
  3368. }
  3369. };
  3370. }
  3371. namespace swig {
  3372. template <class T>
  3373. struct traits_asptr<std::vector<T> > {
  3374. static int asptr(VALUE obj, std::vector<T> **vec) {
  3375. return traits_asptr_stdseq<std::vector<T> >::asptr(obj, vec);
  3376. }
  3377. };
  3378. template <class T>
  3379. struct traits_from<std::vector<T> > {
  3380. static VALUE from(const std::vector<T>& vec) {
  3381. return traits_from_stdseq<std::vector<T> >::from(vec);
  3382. }
  3383. };
  3384. }
  3385. namespace swig {
  3386. template <> struct traits<std::vector<int, std::allocator< int > > > {
  3387. typedef pointer_category category;
  3388. static const char* type_name() {
  3389. return "std::vector<" "int" "," "std::allocator< int >" " >";
  3390. }
  3391. };
  3392. }
  3393. SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg__dup(std::vector< int > *self){
  3394. return new std::vector<int,std::allocator< int > >(*self);
  3395. }
  3396. SWIGINTERN VALUE std_vector_Sl_int_Sg__inspect(std::vector< int > *self){
  3397. std::vector<int,std::allocator< int > >::const_iterator i = self->begin();
  3398. std::vector<int,std::allocator< int > >::const_iterator e = self->end();
  3399. const char *type_name = swig::type_name< std::vector<int,std::allocator< int > > >();
  3400. VALUE str = rb_str_new2(type_name);
  3401. str = rb_str_cat2( str, " [" );
  3402. bool comma = false;
  3403. VALUE tmp;
  3404. for ( ; i != e; ++i, comma = true )
  3405. {
  3406. if (comma) str = rb_str_cat2( str, "," );
  3407. tmp = swig::from< std::vector<int,std::allocator< int > >::value_type >( *i );
  3408. tmp = rb_inspect( tmp );
  3409. str = rb_str_buf_append( str, tmp );
  3410. }
  3411. str = rb_str_cat2( str, "]" );
  3412. return str;
  3413. }
  3414. SWIGINTERN VALUE std_vector_Sl_int_Sg__to_a(std::vector< int > *self){
  3415. std::vector<int,std::allocator< int > >::const_iterator i = self->begin();
  3416. std::vector<int,std::allocator< int > >::const_iterator e = self->end();
  3417. VALUE ary = rb_ary_new2( std::distance( i, e ) );
  3418. VALUE tmp;
  3419. for ( ; i != e; ++i )
  3420. {
  3421. tmp = swig::from< std::vector<int,std::allocator< int > >::value_type >( *i );
  3422. rb_ary_push( ary, tmp );
  3423. }
  3424. return ary;
  3425. }
  3426. SWIGINTERN VALUE std_vector_Sl_int_Sg__to_s(std::vector< int > *self){
  3427. std::vector<int,std::allocator< int > >::iterator i = self->begin();
  3428. std::vector<int,std::allocator< int > >::iterator e = self->end();
  3429. VALUE str = rb_str_new2( "" );
  3430. VALUE tmp;
  3431. for ( ; i != e; ++i )
  3432. {
  3433. tmp = swig::from< std::vector<int,std::allocator< int > >::value_type >( *i );
  3434. tmp = rb_obj_as_string( tmp );
  3435. str = rb_str_buf_append( str, tmp );
  3436. }
  3437. return str;
  3438. }
  3439. SWIGINTERN VALUE std_vector_Sl_int_Sg__slice(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j){
  3440. if ( j <= 0 ) return Qnil;
  3441. std::size_t len = self->size();
  3442. if ( i < 0 ) i = len - i;
  3443. j += i;
  3444. if ( static_cast<std::size_t>(j) >= len ) j = len-1;
  3445. VALUE r = Qnil;
  3446. try {
  3447. r = swig::from< const std::vector<int,std::allocator< int > >* >( swig::getslice(self, i, j) );
  3448. }
  3449. catch( std::out_of_range )
  3450. {
  3451. }
  3452. return r;
  3453. }
  3454. SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg__each(std::vector< int > *self){
  3455. if ( !rb_block_given_p() )
  3456. rb_raise( rb_eArgError, "no block given");
  3457. VALUE r;
  3458. std::vector<int,std::allocator< int > >::const_iterator i = self->begin();
  3459. std::vector<int,std::allocator< int > >::const_iterator e = self->end();
  3460. for ( ; i != e; ++i )
  3461. {
  3462. r = swig::from< std::vector<int,std::allocator< int > >::value_type >(*i);
  3463. rb_yield(r);
  3464. }
  3465. return self;
  3466. }
  3467. SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg__select(std::vector< int > *self){
  3468. if ( !rb_block_given_p() )
  3469. rb_raise( rb_eArgError, "no block given" );
  3470. std::vector<int,std::allocator< int > >* r = new std::vector<int,std::allocator< int > >;
  3471. std::vector<int,std::allocator< int > >::const_iterator i = self->begin();
  3472. std::vector<int,std::allocator< int > >::const_iterator e = self->end();
  3473. for ( ; i != e; ++i )
  3474. {
  3475. VALUE v = swig::from< std::vector<int,std::allocator< int > >::value_type >(*i);
  3476. if ( RTEST( rb_yield(v) ) )
  3477. self->insert( r->end(), *i);
  3478. }
  3479. return r;
  3480. }
  3481. SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg__reject_bang(std::vector< int > *self){
  3482. if ( !rb_block_given_p() )
  3483. rb_raise( rb_eArgError, "no block given" );
  3484. std::vector<int,std::allocator< int > >::iterator i = self->begin();
  3485. std::vector<int,std::allocator< int > >::iterator e = self->end();
  3486. for ( ; i != e; )
  3487. {
  3488. VALUE r = swig::from< std::vector<int,std::allocator< int > >::value_type >(*i);
  3489. if ( RTEST( rb_yield(r) ) ) {
  3490. self->erase(i++);
  3491. e = self->end();
  3492. } else {
  3493. ++i;
  3494. }
  3495. }
  3496. return self;
  3497. }
  3498. SWIGINTERN VALUE std_vector_Sl_int_Sg__delete_at(std::vector< int > *self,std::vector< int >::difference_type i){
  3499. VALUE r = Qnil;
  3500. try {
  3501. std::vector<int,std::allocator< int > >::iterator at = swig::getpos(self, i);
  3502. r = swig::from< std::vector<int,std::allocator< int > >::value_type >( *(at) );
  3503. self->erase(at);
  3504. }
  3505. catch (std::out_of_range)
  3506. {
  3507. }
  3508. return r;
  3509. }
  3510. SWIGINTERN VALUE std_vector_Sl_int_Sg____delete2__(std::vector< int > *self,std::vector< int >::value_type const &i){
  3511. VALUE r = Qnil;
  3512. return r;
  3513. }
  3514. SWIGINTERN VALUE std_vector_Sl_int_Sg__pop(std::vector< int > *self){
  3515. if (self->empty()) return Qnil;
  3516. std::vector<int,std::allocator< int > >::value_type x = self->back();
  3517. self->pop_back();
  3518. return swig::from< std::vector<int,std::allocator< int > >::value_type >( x );
  3519. }
  3520. SWIGINTERN std::vector< int >::value_type const std_vector_Sl_int_Sg__push(std::vector< int > *self,std::vector< int >::value_type const &e){
  3521. self->push_back( e );
  3522. return e;
  3523. }
  3524. SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg__reject(std::vector< int > *self){
  3525. if ( !rb_block_given_p() )
  3526. rb_raise( rb_eArgError, "no block given" );
  3527. std::vector<int,std::allocator< int > >* r = new std::vector<int,std::allocator< int > >;
  3528. std::remove_copy_if( self->begin(), self->end(),
  3529. std::back_inserter(*r),
  3530. swig::yield< std::vector<int,std::allocator< int > >::value_type >() );
  3531. return r;
  3532. }
  3533. SWIGINTERN VALUE std_vector_Sl_int_Sg__at(std::vector< int > const *self,std::vector< int >::difference_type i){
  3534. VALUE r = Qnil;
  3535. try {
  3536. r = swig::from< std::vector<int,std::allocator< int > >::value_type >( *(swig::cgetpos(self, i)) );
  3537. }
  3538. catch( std::out_of_range )
  3539. {
  3540. }
  3541. return r;
  3542. }
  3543. SWIGINTERN VALUE std_vector_Sl_int_Sg____getitem____SWIG_0(std::vector< int > const *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j){
  3544. if ( j <= 0 ) return Qnil;
  3545. std::size_t len = self->size();
  3546. if ( i < 0 ) i = len - i;
  3547. j += i; if ( static_cast<std::size_t>(j) >= len ) j = len-1;
  3548. VALUE r = Qnil;
  3549. try {
  3550. r = swig::from< const std::vector<int,std::allocator< int > >* >( swig::getslice(self, i, j) );
  3551. }
  3552. catch( std::out_of_range )
  3553. {
  3554. }
  3555. return r;
  3556. }
  3557. SWIGINTERN VALUE std_vector_Sl_int_Sg____getitem____SWIG_1(std::vector< int > const *self,std::vector< int >::difference_type i){
  3558. VALUE r = Qnil;
  3559. try {
  3560. r = swig::from< std::vector<int,std::allocator< int > >::value_type >( *(swig::cgetpos(self, i)) );
  3561. }
  3562. catch( std::out_of_range )
  3563. {
  3564. }
  3565. return r;
  3566. }
  3567. SWIGINTERN VALUE std_vector_Sl_int_Sg____getitem____SWIG_2(std::vector< int > const *self,VALUE i){
  3568. if ( rb_obj_is_kind_of( i, rb_cRange ) == Qfalse )
  3569. {
  3570. rb_raise( rb_eTypeError, "not a valid index or range" );
  3571. }
  3572. VALUE r = Qnil;
  3573. static ID id_end = rb_intern("end");
  3574. static ID id_start = rb_intern("begin");
  3575. static ID id_noend = rb_intern("exclude_end?");
  3576. VALUE start = rb_funcall( i, id_start, 0 );
  3577. VALUE end = rb_funcall( i, id_end, 0 );
  3578. bool noend = ( rb_funcall( i, id_noend, 0 ) == Qtrue );
  3579. int len = self->size();
  3580. int s = NUM2INT( start );
  3581. if ( s < 0 ) s = len + s;
  3582. else if ( s >= len ) return Qnil;
  3583. int e = NUM2INT( end );
  3584. if ( e < 0 ) e = len + e;
  3585. if ( e < s ) return Qnil; //std::swap( s, e );
  3586. if ( noend ) e -= 1;
  3587. if ( e >= len ) e = len - 1;
  3588. return swig::from< std::vector<int,std::allocator< int > >* >( swig::getslice(self, s, e+1) );
  3589. }
  3590. SWIGINTERN VALUE std_vector_Sl_int_Sg____setitem____SWIG_0(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::value_type const &x){
  3591. std::size_t len = self->size();
  3592. if ( i < 0 ) i = len - i;
  3593. else if ( static_cast<std::size_t>(i) >= len )
  3594. self->resize( i+1, x );
  3595. else
  3596. *(swig::getpos(self,i)) = x;
  3597. return swig::from< std::vector<int,std::allocator< int > >::value_type >( x );
  3598. }
  3599. SWIGINTERN VALUE std_vector_Sl_int_Sg____setitem____SWIG_1(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j,std::vector< int,std::allocator< int > > const &v){
  3600. if ( j <= 0 ) return Qnil;
  3601. std::size_t len = self->size();
  3602. if ( i < 0 ) i = len - i;
  3603. j += i;
  3604. if ( static_cast<std::size_t>(j) >= len ) {
  3605. self->resize( j+1, *(v.begin()) );
  3606. j = len-1;
  3607. }
  3608. VALUE r = Qnil;
  3609. swig::setslice(self, i, j, v);
  3610. r = swig::from< const std::vector<int,std::allocator< int > >* >( &v );
  3611. return r;
  3612. }
  3613. SWIGINTERN VALUE std_vector_Sl_int_Sg__shift(std::vector< int > *self){
  3614. if (self->empty()) return Qnil;
  3615. std::vector<int,std::allocator< int > >::value_type x = self->front();
  3616. self->erase( self->begin() );
  3617. return swig::from< std::vector<int,std::allocator< int > >::value_type >( x );
  3618. }
  3619. SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg__insert__SWIG_0(std::vector< int > *self,std::vector< int >::difference_type pos,int argc,VALUE *argv,...){
  3620. std::size_t len = self->size();
  3621. std::size_t i = swig::check_index( pos, len, true );
  3622. std::vector<int,std::allocator< int > >::iterator start;
  3623. VALUE elem = argv[0];
  3624. int idx = 0;
  3625. try {
  3626. std::vector<int,std::allocator< int > >::value_type val = swig::as<std::vector<int,std::allocator< int > >::value_type>( elem, true );
  3627. if ( i >= len ) {
  3628. self->resize(i-1, val);
  3629. return self;
  3630. }
  3631. start = self->begin();
  3632. std::advance( start, i );
  3633. self->insert( start++, val );
  3634. for ( ++idx; idx < argc; ++idx )
  3635. {
  3636. elem = argv[idx];
  3637. val = swig::as<std::vector<int,std::allocator< int > >::value_type>( elem );
  3638. self->insert( start++, val );
  3639. }
  3640. }
  3641. catch( std::invalid_argument )
  3642. {
  3643. rb_raise( rb_eArgError, "%s",
  3644. Ruby_Format_TypeError( "",
  3645. swig::type_name<std::vector<int,std::allocator< int > >::value_type>(),
  3646. __FUNCTION__, idx+2, elem ));
  3647. }
  3648. return self;
  3649. }
  3650. SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg__unshift(std::vector< int > *self,int argc,VALUE *argv,...){
  3651. for ( int idx = argc-1; idx >= 0; --idx )
  3652. {
  3653. std::vector<int,std::allocator< int > >::iterator start = self->begin();
  3654. VALUE elem = argv[idx];
  3655. try {
  3656. std::vector<int,std::allocator< int > >::value_type val = swig::as<std::vector<int,std::allocator< int > >::value_type>( elem, true );
  3657. self->insert( start, val );
  3658. }
  3659. catch( std::invalid_argument )
  3660. {
  3661. rb_raise( rb_eArgError, "%s",
  3662. Ruby_Format_TypeError( "",
  3663. swig::type_name<std::vector<int,std::allocator< int > >::value_type>(),
  3664. __FUNCTION__, idx+2, elem ));
  3665. }
  3666. }
  3667. return self;
  3668. }
  3669. SWIGINTERNINLINE VALUE
  3670. SWIG_From_unsigned_SS_long (unsigned long value)
  3671. {
  3672. return ULONG2NUM(value);
  3673. }
  3674. SWIGINTERNINLINE VALUE
  3675. SWIG_From_size_t (size_t value)
  3676. {
  3677. return SWIG_From_unsigned_SS_long (static_cast< unsigned long >(value));
  3678. }
  3679. SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg__map_bang(std::vector< int > *self){
  3680. if ( !rb_block_given_p() )
  3681. rb_raise( rb_eArgError, "No block given" );
  3682. VALUE r = Qnil;
  3683. std::vector< int >::iterator i = self->begin();
  3684. std::vector< int >::iterator e = self->end();
  3685. try {
  3686. for ( ; i != e; ++i )
  3687. {
  3688. r = swig::from< int >( *i );
  3689. r = rb_yield( r );
  3690. *i = swig::as< int >( r );
  3691. }
  3692. }
  3693. catch ( const std::invalid_argument& )
  3694. {
  3695. rb_raise(rb_eTypeError,
  3696. "Yield block did not return a valid element for " "std::vector");
  3697. }
  3698. return self;
  3699. }
  3700. SWIGINTERN VALUE std_vector_Sl_int_Sg____delete__(std::vector< int > *self,int const &val){
  3701. VALUE r = Qnil;
  3702. std::vector<int >::iterator e = self->end();
  3703. std::vector<int >::iterator i = std::remove( self->begin(), e, val );
  3704. // remove dangling elements now
  3705. self->erase( i, e );
  3706. if ( i != e )
  3707. r = swig::from< int >( val );
  3708. else if ( rb_block_given_p() )
  3709. r = rb_yield(Qnil);
  3710. return r;
  3711. }
  3712. SWIGINTERN swig_type_info*
  3713. SWIG_pchar_descriptor(void)
  3714. {
  3715. static int init = 0;
  3716. static swig_type_info* info = 0;
  3717. if (!init) {
  3718. info = SWIG_TypeQuery("_p_char");
  3719. init = 1;
  3720. }
  3721. return info;
  3722. }
  3723. SWIGINTERN int
  3724. SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
  3725. {
  3726. if (TYPE(obj) == T_STRING) {
  3727. #if defined(StringValuePtr)
  3728. char *cstr = StringValuePtr(obj);
  3729. #else
  3730. char *cstr = STR2CSTR(obj);
  3731. #endif
  3732. size_t size = RSTRING_LEN(obj) + 1;
  3733. if (cptr) {
  3734. if (alloc) {
  3735. if (*alloc == SWIG_NEWOBJ) {
  3736. *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
  3737. } else {
  3738. *cptr = cstr;
  3739. *alloc = SWIG_OLDOBJ;
  3740. }
  3741. }
  3742. }
  3743. if (psize) *psize = size;
  3744. return SWIG_OK;
  3745. } else {
  3746. swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
  3747. if (pchar_descriptor) {
  3748. void* vptr = 0;
  3749. if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
  3750. if (cptr) *cptr = (char *)vptr;
  3751. if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
  3752. if (alloc) *alloc = SWIG_OLDOBJ;
  3753. return SWIG_OK;
  3754. }
  3755. }
  3756. }
  3757. return SWIG_TypeError;
  3758. }
  3759. SWIGINTERN int
  3760. SWIG_AsPtr_std_string (VALUE obj, std::string **val)
  3761. {
  3762. char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
  3763. if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
  3764. if (buf) {
  3765. if (val) *val = new std::string(buf, size - 1);
  3766. if (alloc == SWIG_NEWOBJ) delete[] buf;
  3767. return SWIG_NEWOBJ;
  3768. } else {
  3769. if (val) *val = 0;
  3770. return SWIG_OLDOBJ;
  3771. }
  3772. } else {
  3773. static int init = 0;
  3774. static swig_type_info* descriptor = 0;
  3775. if (!init) {
  3776. descriptor = SWIG_TypeQuery("std::string" " *");
  3777. init = 1;
  3778. }
  3779. if (descriptor) {
  3780. std::string *vptr;
  3781. int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
  3782. if (SWIG_IsOK(res) && val) *val = vptr;
  3783. return res;
  3784. }
  3785. }
  3786. return SWIG_ERROR;
  3787. }
  3788. SWIGINTERNINLINE VALUE
  3789. SWIG_FromCharPtrAndSize(const char* carray, size_t size)
  3790. {
  3791. if (carray) {
  3792. if (size > LONG_MAX) {
  3793. swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
  3794. return pchar_descriptor ?
  3795. SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : Qnil;
  3796. } else {
  3797. return rb_str_new(carray, static_cast< long >(size));
  3798. }
  3799. } else {
  3800. return Qnil;
  3801. }
  3802. }
  3803. SWIGINTERNINLINE VALUE
  3804. SWIG_From_std_string (const std::string& s)
  3805. {
  3806. return SWIG_FromCharPtrAndSize(s.data(), s.size());
  3807. }
  3808. #define SWIG_From_double rb_float_new
  3809. SWIGINTERNINLINE VALUE
  3810. SWIG_From_float (float value)
  3811. {
  3812. return SWIG_From_double (value);
  3813. }
  3814. swig_class SwigClassGC_VALUE;
  3815. /*
  3816. Document-method: Uhferret_lib::GC_VALUE.inspect
  3817. call-seq:
  3818. inspect -> VALUE
  3819. Inspect class and its contents.
  3820. */
  3821. SWIGINTERN VALUE
  3822. _wrap_GC_VALUE_inspect(int argc, VALUE *argv, VALUE self) {
  3823. swig::GC_VALUE *arg1 = (swig::GC_VALUE *) 0 ;
  3824. swig::GC_VALUE r1 ;
  3825. VALUE result;
  3826. VALUE vresult = Qnil;
  3827. if ((argc < 0) || (argc > 0)) {
  3828. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  3829. }
  3830. r1 = self; arg1 = &r1;
  3831. result = (VALUE)((swig::GC_VALUE const *)arg1)->inspect();
  3832. vresult = result;
  3833. return vresult;
  3834. fail:
  3835. return Qnil;
  3836. }
  3837. /*
  3838. Document-method: Uhferret_lib::GC_VALUE.to_s
  3839. call-seq:
  3840. to_s -> VALUE
  3841. Convert class to a String representation.
  3842. */
  3843. SWIGINTERN VALUE
  3844. _wrap_GC_VALUE_to_s(int argc, VALUE *argv, VALUE self) {
  3845. swig::GC_VALUE *arg1 = (swig::GC_VALUE *) 0 ;
  3846. swig::GC_VALUE r1 ;
  3847. VALUE result;
  3848. VALUE vresult = Qnil;
  3849. if ((argc < 0) || (argc > 0)) {
  3850. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  3851. }
  3852. r1 = self; arg1 = &r1;
  3853. result = (VALUE)((swig::GC_VALUE const *)arg1)->to_s();
  3854. vresult = result;
  3855. return vresult;
  3856. fail:
  3857. return Qnil;
  3858. }
  3859. swig_class SwigClassConstIterator;
  3860. SWIGINTERN void
  3861. free_swig_ConstIterator(swig::ConstIterator *arg1) {
  3862. delete arg1;
  3863. }
  3864. SWIGINTERN VALUE
  3865. _wrap_ConstIterator_value(int argc, VALUE *argv, VALUE self) {
  3866. swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  3867. void *argp1 = 0 ;
  3868. int res1 = 0 ;
  3869. VALUE result;
  3870. VALUE vresult = Qnil;
  3871. if ((argc < 0) || (argc > 0)) {
  3872. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  3873. }
  3874. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 );
  3875. if (!SWIG_IsOK(res1)) {
  3876. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","value", 1, self ));
  3877. }
  3878. arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  3879. try {
  3880. result = (VALUE)((swig::ConstIterator const *)arg1)->value();
  3881. }
  3882. catch(swig::stop_iteration &_e) {
  3883. {
  3884. (void)_e;
  3885. SWIG_Ruby_ExceptionType(NULL, Qnil);
  3886. SWIG_fail;
  3887. }
  3888. }
  3889. vresult = result;
  3890. return vresult;
  3891. fail:
  3892. return Qnil;
  3893. }
  3894. /*
  3895. Document-method: Uhferret_lib::ConstIterator.dup
  3896. call-seq:
  3897. dup -> ConstIterator
  3898. Create a duplicate of the class and unfreeze it if needed.
  3899. */
  3900. SWIGINTERN VALUE
  3901. _wrap_ConstIterator_dup(int argc, VALUE *argv, VALUE self) {
  3902. swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  3903. void *argp1 = 0 ;
  3904. int res1 = 0 ;
  3905. swig::ConstIterator *result = 0 ;
  3906. VALUE vresult = Qnil;
  3907. if ((argc < 0) || (argc > 0)) {
  3908. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  3909. }
  3910. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 );
  3911. if (!SWIG_IsOK(res1)) {
  3912. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","dup", 1, self ));
  3913. }
  3914. arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  3915. result = (swig::ConstIterator *)((swig::ConstIterator const *)arg1)->dup();
  3916. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN | 0 );
  3917. return vresult;
  3918. fail:
  3919. return Qnil;
  3920. }
  3921. /*
  3922. Document-method: Uhferret_lib::ConstIterator.inspect
  3923. call-seq:
  3924. inspect -> VALUE
  3925. Inspect class and its contents.
  3926. */
  3927. SWIGINTERN VALUE
  3928. _wrap_ConstIterator_inspect(int argc, VALUE *argv, VALUE self) {
  3929. swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  3930. void *argp1 = 0 ;
  3931. int res1 = 0 ;
  3932. VALUE result;
  3933. VALUE vresult = Qnil;
  3934. if ((argc < 0) || (argc > 0)) {
  3935. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  3936. }
  3937. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 );
  3938. if (!SWIG_IsOK(res1)) {
  3939. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","inspect", 1, self ));
  3940. }
  3941. arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  3942. result = (VALUE)((swig::ConstIterator const *)arg1)->inspect();
  3943. vresult = result;
  3944. return vresult;
  3945. fail:
  3946. return Qnil;
  3947. }
  3948. /*
  3949. Document-method: Uhferret_lib::ConstIterator.to_s
  3950. call-seq:
  3951. to_s -> VALUE
  3952. Convert class to a String representation.
  3953. */
  3954. SWIGINTERN VALUE
  3955. _wrap_ConstIterator_to_s(int argc, VALUE *argv, VALUE self) {
  3956. swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  3957. void *argp1 = 0 ;
  3958. int res1 = 0 ;
  3959. VALUE result;
  3960. VALUE vresult = Qnil;
  3961. if ((argc < 0) || (argc > 0)) {
  3962. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  3963. }
  3964. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 );
  3965. if (!SWIG_IsOK(res1)) {
  3966. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","to_s", 1, self ));
  3967. }
  3968. arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  3969. result = (VALUE)((swig::ConstIterator const *)arg1)->to_s();
  3970. vresult = result;
  3971. return vresult;
  3972. fail:
  3973. return Qnil;
  3974. }
  3975. SWIGINTERN VALUE
  3976. _wrap_ConstIterator_next__SWIG_0(int argc, VALUE *argv, VALUE self) {
  3977. swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  3978. size_t arg2 ;
  3979. void *argp1 = 0 ;
  3980. int res1 = 0 ;
  3981. size_t val2 ;
  3982. int ecode2 = 0 ;
  3983. swig::ConstIterator *result = 0 ;
  3984. VALUE vresult = Qnil;
  3985. if ((argc < 1) || (argc > 1)) {
  3986. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  3987. }
  3988. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 );
  3989. if (!SWIG_IsOK(res1)) {
  3990. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator *","next", 1, self ));
  3991. }
  3992. arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  3993. ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  3994. if (!SWIG_IsOK(ecode2)) {
  3995. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","next", 2, argv[0] ));
  3996. }
  3997. arg2 = static_cast< size_t >(val2);
  3998. result = (swig::ConstIterator *)(arg1)->next(arg2);
  3999. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, 0 | 0 );
  4000. return vresult;
  4001. fail:
  4002. return Qnil;
  4003. }
  4004. SWIGINTERN VALUE
  4005. _wrap_ConstIterator_next__SWIG_1(int argc, VALUE *argv, VALUE self) {
  4006. swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  4007. void *argp1 = 0 ;
  4008. int res1 = 0 ;
  4009. swig::ConstIterator *result = 0 ;
  4010. VALUE vresult = Qnil;
  4011. if ((argc < 0) || (argc > 0)) {
  4012. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  4013. }
  4014. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 );
  4015. if (!SWIG_IsOK(res1)) {
  4016. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator *","next", 1, self ));
  4017. }
  4018. arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  4019. try {
  4020. result = (swig::ConstIterator *)(arg1)->next();
  4021. }
  4022. catch(swig::stop_iteration &_e) {
  4023. {
  4024. (void)_e;
  4025. SWIG_Ruby_ExceptionType(NULL, Qnil);
  4026. SWIG_fail;
  4027. }
  4028. }
  4029. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, 0 | 0 );
  4030. return vresult;
  4031. fail:
  4032. return Qnil;
  4033. }
  4034. SWIGINTERN VALUE _wrap_ConstIterator_next(int nargs, VALUE *args, VALUE self) {
  4035. int argc;
  4036. VALUE argv[3];
  4037. int ii;
  4038. argc = nargs + 1;
  4039. argv[0] = self;
  4040. if (argc > 3) SWIG_fail;
  4041. for (ii = 1; (ii < argc); ++ii) {
  4042. argv[ii] = args[ii-1];
  4043. }
  4044. if (argc == 1) {
  4045. int _v;
  4046. void *vptr = 0;
  4047. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
  4048. _v = SWIG_CheckState(res);
  4049. if (_v) {
  4050. return _wrap_ConstIterator_next__SWIG_1(nargs, args, self);
  4051. }
  4052. }
  4053. if (argc == 2) {
  4054. int _v;
  4055. void *vptr = 0;
  4056. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
  4057. _v = SWIG_CheckState(res);
  4058. if (_v) {
  4059. {
  4060. int res = SWIG_AsVal_size_t(argv[1], NULL);
  4061. _v = SWIG_CheckState(res);
  4062. }
  4063. if (_v) {
  4064. return _wrap_ConstIterator_next__SWIG_0(nargs, args, self);
  4065. }
  4066. }
  4067. }
  4068. fail:
  4069. Ruby_Format_OverloadedError( argc, 3, "ConstIterator.next",
  4070. " swig::ConstIterator * ConstIterator.next(size_t n)\n"
  4071. " swig::ConstIterator * ConstIterator.next()\n");
  4072. return Qnil;
  4073. }
  4074. SWIGINTERN VALUE
  4075. _wrap_ConstIterator_previous__SWIG_0(int argc, VALUE *argv, VALUE self) {
  4076. swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  4077. size_t arg2 ;
  4078. void *argp1 = 0 ;
  4079. int res1 = 0 ;
  4080. size_t val2 ;
  4081. int ecode2 = 0 ;
  4082. swig::ConstIterator *result = 0 ;
  4083. VALUE vresult = Qnil;
  4084. if ((argc < 1) || (argc > 1)) {
  4085. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  4086. }
  4087. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 );
  4088. if (!SWIG_IsOK(res1)) {
  4089. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator *","previous", 1, self ));
  4090. }
  4091. arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  4092. ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  4093. if (!SWIG_IsOK(ecode2)) {
  4094. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","previous", 2, argv[0] ));
  4095. }
  4096. arg2 = static_cast< size_t >(val2);
  4097. result = (swig::ConstIterator *)(arg1)->previous(arg2);
  4098. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, 0 | 0 );
  4099. return vresult;
  4100. fail:
  4101. return Qnil;
  4102. }
  4103. SWIGINTERN VALUE
  4104. _wrap_ConstIterator_previous__SWIG_1(int argc, VALUE *argv, VALUE self) {
  4105. swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  4106. void *argp1 = 0 ;
  4107. int res1 = 0 ;
  4108. swig::ConstIterator *result = 0 ;
  4109. VALUE vresult = Qnil;
  4110. if ((argc < 0) || (argc > 0)) {
  4111. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  4112. }
  4113. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 );
  4114. if (!SWIG_IsOK(res1)) {
  4115. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator *","previous", 1, self ));
  4116. }
  4117. arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  4118. try {
  4119. result = (swig::ConstIterator *)(arg1)->previous();
  4120. }
  4121. catch(swig::stop_iteration &_e) {
  4122. {
  4123. (void)_e;
  4124. SWIG_Ruby_ExceptionType(NULL, Qnil);
  4125. SWIG_fail;
  4126. }
  4127. }
  4128. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, 0 | 0 );
  4129. return vresult;
  4130. fail:
  4131. return Qnil;
  4132. }
  4133. SWIGINTERN VALUE _wrap_ConstIterator_previous(int nargs, VALUE *args, VALUE self) {
  4134. int argc;
  4135. VALUE argv[3];
  4136. int ii;
  4137. argc = nargs + 1;
  4138. argv[0] = self;
  4139. if (argc > 3) SWIG_fail;
  4140. for (ii = 1; (ii < argc); ++ii) {
  4141. argv[ii] = args[ii-1];
  4142. }
  4143. if (argc == 1) {
  4144. int _v;
  4145. void *vptr = 0;
  4146. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
  4147. _v = SWIG_CheckState(res);
  4148. if (_v) {
  4149. return _wrap_ConstIterator_previous__SWIG_1(nargs, args, self);
  4150. }
  4151. }
  4152. if (argc == 2) {
  4153. int _v;
  4154. void *vptr = 0;
  4155. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
  4156. _v = SWIG_CheckState(res);
  4157. if (_v) {
  4158. {
  4159. int res = SWIG_AsVal_size_t(argv[1], NULL);
  4160. _v = SWIG_CheckState(res);
  4161. }
  4162. if (_v) {
  4163. return _wrap_ConstIterator_previous__SWIG_0(nargs, args, self);
  4164. }
  4165. }
  4166. }
  4167. fail:
  4168. Ruby_Format_OverloadedError( argc, 3, "ConstIterator.previous",
  4169. " swig::ConstIterator * ConstIterator.previous(size_t n)\n"
  4170. " swig::ConstIterator * ConstIterator.previous()\n");
  4171. return Qnil;
  4172. }
  4173. /*
  4174. Document-method: Uhferret_lib::ConstIterator.==
  4175. call-seq:
  4176. ==(x) -> bool
  4177. Equality comparison operator.
  4178. */
  4179. SWIGINTERN VALUE
  4180. _wrap_ConstIterator___eq__(int argc, VALUE *argv, VALUE self) {
  4181. swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  4182. swig::ConstIterator *arg2 = 0 ;
  4183. void *argp1 = 0 ;
  4184. int res1 = 0 ;
  4185. void *argp2 ;
  4186. int res2 = 0 ;
  4187. bool result;
  4188. VALUE vresult = Qnil;
  4189. if ((argc < 1) || (argc > 1)) {
  4190. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  4191. }
  4192. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 );
  4193. if (!SWIG_IsOK(res1)) {
  4194. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","operator ==", 1, self ));
  4195. }
  4196. arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  4197. res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_swig__ConstIterator, 0 );
  4198. if (!SWIG_IsOK(res2)) {
  4199. SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "swig::ConstIterator const &","operator ==", 2, argv[0] ));
  4200. }
  4201. if (!argp2) {
  4202. SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "swig::ConstIterator const &","operator ==", 2, argv[0]));
  4203. }
  4204. arg2 = reinterpret_cast< swig::ConstIterator * >(argp2);
  4205. result = (bool)((swig::ConstIterator const *)arg1)->operator ==((swig::ConstIterator const &)*arg2);
  4206. vresult = SWIG_From_bool(static_cast< bool >(result));
  4207. return vresult;
  4208. fail:
  4209. return Qnil;
  4210. }
  4211. /*
  4212. Document-method: Uhferret_lib::ConstIterator.+
  4213. call-seq:
  4214. +(n) -> ConstIterator
  4215. Add operator.
  4216. */
  4217. SWIGINTERN VALUE
  4218. _wrap_ConstIterator___add__(int argc, VALUE *argv, VALUE self) {
  4219. swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  4220. ptrdiff_t arg2 ;
  4221. void *argp1 = 0 ;
  4222. int res1 = 0 ;
  4223. ptrdiff_t val2 ;
  4224. int ecode2 = 0 ;
  4225. swig::ConstIterator *result = 0 ;
  4226. VALUE vresult = Qnil;
  4227. if ((argc < 1) || (argc > 1)) {
  4228. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  4229. }
  4230. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 );
  4231. if (!SWIG_IsOK(res1)) {
  4232. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","operator +", 1, self ));
  4233. }
  4234. arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  4235. ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
  4236. if (!SWIG_IsOK(ecode2)) {
  4237. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "ptrdiff_t","operator +", 2, argv[0] ));
  4238. }
  4239. arg2 = static_cast< ptrdiff_t >(val2);
  4240. try {
  4241. result = (swig::ConstIterator *)((swig::ConstIterator const *)arg1)->operator +(arg2);
  4242. }
  4243. catch(swig::stop_iteration &_e) {
  4244. {
  4245. (void)_e;
  4246. SWIG_Ruby_ExceptionType(NULL, Qnil);
  4247. SWIG_fail;
  4248. }
  4249. }
  4250. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN | 0 );
  4251. return vresult;
  4252. fail:
  4253. return Qnil;
  4254. }
  4255. /*
  4256. Document-method: Uhferret_lib::ConstIterator.-
  4257. call-seq:
  4258. -(n) -> ConstIterator
  4259. -(x) -> ptrdiff_t
  4260. Substraction operator.
  4261. */
  4262. SWIGINTERN VALUE
  4263. _wrap_ConstIterator___sub____SWIG_0(int argc, VALUE *argv, VALUE self) {
  4264. swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  4265. ptrdiff_t arg2 ;
  4266. void *argp1 = 0 ;
  4267. int res1 = 0 ;
  4268. ptrdiff_t val2 ;
  4269. int ecode2 = 0 ;
  4270. swig::ConstIterator *result = 0 ;
  4271. VALUE vresult = Qnil;
  4272. if ((argc < 1) || (argc > 1)) {
  4273. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  4274. }
  4275. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 );
  4276. if (!SWIG_IsOK(res1)) {
  4277. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","operator -", 1, self ));
  4278. }
  4279. arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  4280. ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
  4281. if (!SWIG_IsOK(ecode2)) {
  4282. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "ptrdiff_t","operator -", 2, argv[0] ));
  4283. }
  4284. arg2 = static_cast< ptrdiff_t >(val2);
  4285. try {
  4286. result = (swig::ConstIterator *)((swig::ConstIterator const *)arg1)->operator -(arg2);
  4287. }
  4288. catch(swig::stop_iteration &_e) {
  4289. {
  4290. (void)_e;
  4291. SWIG_Ruby_ExceptionType(NULL, Qnil);
  4292. SWIG_fail;
  4293. }
  4294. }
  4295. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN | 0 );
  4296. return vresult;
  4297. fail:
  4298. return Qnil;
  4299. }
  4300. SWIGINTERN VALUE
  4301. _wrap_ConstIterator___sub____SWIG_1(int argc, VALUE *argv, VALUE self) {
  4302. swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  4303. swig::ConstIterator *arg2 = 0 ;
  4304. void *argp1 = 0 ;
  4305. int res1 = 0 ;
  4306. void *argp2 ;
  4307. int res2 = 0 ;
  4308. ptrdiff_t result;
  4309. VALUE vresult = Qnil;
  4310. if ((argc < 1) || (argc > 1)) {
  4311. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  4312. }
  4313. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 | 0 );
  4314. if (!SWIG_IsOK(res1)) {
  4315. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","operator -", 1, self ));
  4316. }
  4317. arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  4318. res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_swig__ConstIterator, 0 );
  4319. if (!SWIG_IsOK(res2)) {
  4320. SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "swig::ConstIterator const &","operator -", 2, argv[0] ));
  4321. }
  4322. if (!argp2) {
  4323. SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "swig::ConstIterator const &","operator -", 2, argv[0]));
  4324. }
  4325. arg2 = reinterpret_cast< swig::ConstIterator * >(argp2);
  4326. result = ((swig::ConstIterator const *)arg1)->operator -((swig::ConstIterator const &)*arg2);
  4327. vresult = SWIG_From_ptrdiff_t(static_cast< ptrdiff_t >(result));
  4328. return vresult;
  4329. fail:
  4330. return Qnil;
  4331. }
  4332. SWIGINTERN VALUE _wrap_ConstIterator___sub__(int nargs, VALUE *args, VALUE self) {
  4333. int argc;
  4334. VALUE argv[3];
  4335. int ii;
  4336. argc = nargs + 1;
  4337. argv[0] = self;
  4338. if (argc > 3) SWIG_fail;
  4339. for (ii = 1; (ii < argc); ++ii) {
  4340. argv[ii] = args[ii-1];
  4341. }
  4342. if (argc == 2) {
  4343. int _v;
  4344. void *vptr = 0;
  4345. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
  4346. _v = SWIG_CheckState(res);
  4347. if (_v) {
  4348. void *vptr = 0;
  4349. int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
  4350. _v = SWIG_CheckState(res);
  4351. if (_v) {
  4352. return _wrap_ConstIterator___sub____SWIG_1(nargs, args, self);
  4353. }
  4354. }
  4355. }
  4356. if (argc == 2) {
  4357. int _v;
  4358. void *vptr = 0;
  4359. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
  4360. _v = SWIG_CheckState(res);
  4361. if (_v) {
  4362. {
  4363. int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
  4364. _v = SWIG_CheckState(res);
  4365. }
  4366. if (_v) {
  4367. return _wrap_ConstIterator___sub____SWIG_0(nargs, args, self);
  4368. }
  4369. }
  4370. }
  4371. fail:
  4372. Ruby_Format_OverloadedError( argc, 3, "__sub__.new",
  4373. " __sub__.new(ptrdiff_t n)\n"
  4374. " __sub__.new(swig::ConstIterator const &x)\n");
  4375. return Qnil;
  4376. }
  4377. swig_class SwigClassIterator;
  4378. SWIGINTERN VALUE
  4379. _wrap_Iterator_valuee___(int argc, VALUE *argv, VALUE self) {
  4380. swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  4381. VALUE *arg2 = 0 ;
  4382. void *argp1 = 0 ;
  4383. int res1 = 0 ;
  4384. VALUE temp2 ;
  4385. VALUE result;
  4386. VALUE vresult = Qnil;
  4387. if ((argc < 1) || (argc > 1)) {
  4388. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  4389. }
  4390. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 );
  4391. if (!SWIG_IsOK(res1)) {
  4392. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","setValue", 1, self ));
  4393. }
  4394. arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  4395. temp2 = static_cast< VALUE >(argv[0]);
  4396. arg2 = &temp2;
  4397. result = (VALUE)(arg1)->setValue((VALUE const &)*arg2);
  4398. vresult = result;
  4399. return vresult;
  4400. fail:
  4401. return Qnil;
  4402. }
  4403. /*
  4404. Document-method: Uhferret_lib::Iterator.dup
  4405. call-seq:
  4406. dup -> Iterator
  4407. Create a duplicate of the class and unfreeze it if needed.
  4408. */
  4409. SWIGINTERN VALUE
  4410. _wrap_Iterator_dup(int argc, VALUE *argv, VALUE self) {
  4411. swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  4412. void *argp1 = 0 ;
  4413. int res1 = 0 ;
  4414. swig::Iterator *result = 0 ;
  4415. VALUE vresult = Qnil;
  4416. if ((argc < 0) || (argc > 0)) {
  4417. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  4418. }
  4419. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 );
  4420. if (!SWIG_IsOK(res1)) {
  4421. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","dup", 1, self ));
  4422. }
  4423. arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  4424. result = (swig::Iterator *)((swig::Iterator const *)arg1)->dup();
  4425. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, SWIG_POINTER_OWN | 0 );
  4426. return vresult;
  4427. fail:
  4428. return Qnil;
  4429. }
  4430. SWIGINTERN VALUE
  4431. _wrap_Iterator_next__SWIG_0(int argc, VALUE *argv, VALUE self) {
  4432. swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  4433. size_t arg2 ;
  4434. void *argp1 = 0 ;
  4435. int res1 = 0 ;
  4436. size_t val2 ;
  4437. int ecode2 = 0 ;
  4438. swig::Iterator *result = 0 ;
  4439. VALUE vresult = Qnil;
  4440. if ((argc < 1) || (argc > 1)) {
  4441. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  4442. }
  4443. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 );
  4444. if (!SWIG_IsOK(res1)) {
  4445. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","next", 1, self ));
  4446. }
  4447. arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  4448. ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  4449. if (!SWIG_IsOK(ecode2)) {
  4450. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","next", 2, argv[0] ));
  4451. }
  4452. arg2 = static_cast< size_t >(val2);
  4453. result = (swig::Iterator *)(arg1)->next(arg2);
  4454. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, 0 | 0 );
  4455. return vresult;
  4456. fail:
  4457. return Qnil;
  4458. }
  4459. SWIGINTERN VALUE
  4460. _wrap_Iterator_next__SWIG_1(int argc, VALUE *argv, VALUE self) {
  4461. swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  4462. void *argp1 = 0 ;
  4463. int res1 = 0 ;
  4464. swig::Iterator *result = 0 ;
  4465. VALUE vresult = Qnil;
  4466. if ((argc < 0) || (argc > 0)) {
  4467. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  4468. }
  4469. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 );
  4470. if (!SWIG_IsOK(res1)) {
  4471. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","next", 1, self ));
  4472. }
  4473. arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  4474. try {
  4475. result = (swig::Iterator *)(arg1)->next();
  4476. }
  4477. catch(swig::stop_iteration &_e) {
  4478. {
  4479. (void)_e;
  4480. SWIG_Ruby_ExceptionType(NULL, Qnil);
  4481. SWIG_fail;
  4482. }
  4483. }
  4484. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, 0 | 0 );
  4485. return vresult;
  4486. fail:
  4487. return Qnil;
  4488. }
  4489. SWIGINTERN VALUE _wrap_Iterator_next(int nargs, VALUE *args, VALUE self) {
  4490. int argc;
  4491. VALUE argv[3];
  4492. int ii;
  4493. argc = nargs + 1;
  4494. argv[0] = self;
  4495. if (argc > 3) SWIG_fail;
  4496. for (ii = 1; (ii < argc); ++ii) {
  4497. argv[ii] = args[ii-1];
  4498. }
  4499. if (argc == 1) {
  4500. int _v;
  4501. void *vptr = 0;
  4502. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
  4503. _v = SWIG_CheckState(res);
  4504. if (_v) {
  4505. return _wrap_Iterator_next__SWIG_1(nargs, args, self);
  4506. }
  4507. }
  4508. if (argc == 2) {
  4509. int _v;
  4510. void *vptr = 0;
  4511. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
  4512. _v = SWIG_CheckState(res);
  4513. if (_v) {
  4514. {
  4515. int res = SWIG_AsVal_size_t(argv[1], NULL);
  4516. _v = SWIG_CheckState(res);
  4517. }
  4518. if (_v) {
  4519. return _wrap_Iterator_next__SWIG_0(nargs, args, self);
  4520. }
  4521. }
  4522. }
  4523. fail:
  4524. Ruby_Format_OverloadedError( argc, 3, "Iterator.next",
  4525. " swig::Iterator * Iterator.next(size_t n)\n"
  4526. " swig::Iterator * Iterator.next()\n");
  4527. return Qnil;
  4528. }
  4529. SWIGINTERN VALUE
  4530. _wrap_Iterator_previous__SWIG_0(int argc, VALUE *argv, VALUE self) {
  4531. swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  4532. size_t arg2 ;
  4533. void *argp1 = 0 ;
  4534. int res1 = 0 ;
  4535. size_t val2 ;
  4536. int ecode2 = 0 ;
  4537. swig::Iterator *result = 0 ;
  4538. VALUE vresult = Qnil;
  4539. if ((argc < 1) || (argc > 1)) {
  4540. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  4541. }
  4542. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 );
  4543. if (!SWIG_IsOK(res1)) {
  4544. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","previous", 1, self ));
  4545. }
  4546. arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  4547. ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  4548. if (!SWIG_IsOK(ecode2)) {
  4549. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","previous", 2, argv[0] ));
  4550. }
  4551. arg2 = static_cast< size_t >(val2);
  4552. result = (swig::Iterator *)(arg1)->previous(arg2);
  4553. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, 0 | 0 );
  4554. return vresult;
  4555. fail:
  4556. return Qnil;
  4557. }
  4558. SWIGINTERN VALUE
  4559. _wrap_Iterator_previous__SWIG_1(int argc, VALUE *argv, VALUE self) {
  4560. swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  4561. void *argp1 = 0 ;
  4562. int res1 = 0 ;
  4563. swig::Iterator *result = 0 ;
  4564. VALUE vresult = Qnil;
  4565. if ((argc < 0) || (argc > 0)) {
  4566. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  4567. }
  4568. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 );
  4569. if (!SWIG_IsOK(res1)) {
  4570. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","previous", 1, self ));
  4571. }
  4572. arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  4573. try {
  4574. result = (swig::Iterator *)(arg1)->previous();
  4575. }
  4576. catch(swig::stop_iteration &_e) {
  4577. {
  4578. (void)_e;
  4579. SWIG_Ruby_ExceptionType(NULL, Qnil);
  4580. SWIG_fail;
  4581. }
  4582. }
  4583. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, 0 | 0 );
  4584. return vresult;
  4585. fail:
  4586. return Qnil;
  4587. }
  4588. SWIGINTERN VALUE _wrap_Iterator_previous(int nargs, VALUE *args, VALUE self) {
  4589. int argc;
  4590. VALUE argv[3];
  4591. int ii;
  4592. argc = nargs + 1;
  4593. argv[0] = self;
  4594. if (argc > 3) SWIG_fail;
  4595. for (ii = 1; (ii < argc); ++ii) {
  4596. argv[ii] = args[ii-1];
  4597. }
  4598. if (argc == 1) {
  4599. int _v;
  4600. void *vptr = 0;
  4601. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
  4602. _v = SWIG_CheckState(res);
  4603. if (_v) {
  4604. return _wrap_Iterator_previous__SWIG_1(nargs, args, self);
  4605. }
  4606. }
  4607. if (argc == 2) {
  4608. int _v;
  4609. void *vptr = 0;
  4610. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
  4611. _v = SWIG_CheckState(res);
  4612. if (_v) {
  4613. {
  4614. int res = SWIG_AsVal_size_t(argv[1], NULL);
  4615. _v = SWIG_CheckState(res);
  4616. }
  4617. if (_v) {
  4618. return _wrap_Iterator_previous__SWIG_0(nargs, args, self);
  4619. }
  4620. }
  4621. }
  4622. fail:
  4623. Ruby_Format_OverloadedError( argc, 3, "Iterator.previous",
  4624. " swig::Iterator * Iterator.previous(size_t n)\n"
  4625. " swig::Iterator * Iterator.previous()\n");
  4626. return Qnil;
  4627. }
  4628. /*
  4629. Document-method: Uhferret_lib::Iterator.inspect
  4630. call-seq:
  4631. inspect -> VALUE
  4632. Inspect class and its contents.
  4633. */
  4634. SWIGINTERN VALUE
  4635. _wrap_Iterator_inspect(int argc, VALUE *argv, VALUE self) {
  4636. swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  4637. void *argp1 = 0 ;
  4638. int res1 = 0 ;
  4639. VALUE result;
  4640. VALUE vresult = Qnil;
  4641. if ((argc < 0) || (argc > 0)) {
  4642. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  4643. }
  4644. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 );
  4645. if (!SWIG_IsOK(res1)) {
  4646. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","inspect", 1, self ));
  4647. }
  4648. arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  4649. result = (VALUE)((swig::Iterator const *)arg1)->inspect();
  4650. vresult = result;
  4651. return vresult;
  4652. fail:
  4653. return Qnil;
  4654. }
  4655. /*
  4656. Document-method: Uhferret_lib::Iterator.to_s
  4657. call-seq:
  4658. to_s -> VALUE
  4659. Convert class to a String representation.
  4660. */
  4661. SWIGINTERN VALUE
  4662. _wrap_Iterator_to_s(int argc, VALUE *argv, VALUE self) {
  4663. swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  4664. void *argp1 = 0 ;
  4665. int res1 = 0 ;
  4666. VALUE result;
  4667. VALUE vresult = Qnil;
  4668. if ((argc < 0) || (argc > 0)) {
  4669. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  4670. }
  4671. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 );
  4672. if (!SWIG_IsOK(res1)) {
  4673. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","to_s", 1, self ));
  4674. }
  4675. arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  4676. result = (VALUE)((swig::Iterator const *)arg1)->to_s();
  4677. vresult = result;
  4678. return vresult;
  4679. fail:
  4680. return Qnil;
  4681. }
  4682. /*
  4683. Document-method: Uhferret_lib::Iterator.==
  4684. call-seq:
  4685. ==(x) -> bool
  4686. Equality comparison operator.
  4687. */
  4688. SWIGINTERN VALUE
  4689. _wrap_Iterator___eq__(int argc, VALUE *argv, VALUE self) {
  4690. swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  4691. swig::Iterator *arg2 = 0 ;
  4692. void *argp1 = 0 ;
  4693. int res1 = 0 ;
  4694. void *argp2 ;
  4695. int res2 = 0 ;
  4696. bool result;
  4697. VALUE vresult = Qnil;
  4698. if ((argc < 1) || (argc > 1)) {
  4699. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  4700. }
  4701. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 );
  4702. if (!SWIG_IsOK(res1)) {
  4703. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","operator ==", 1, self ));
  4704. }
  4705. arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  4706. res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_swig__Iterator, 0 );
  4707. if (!SWIG_IsOK(res2)) {
  4708. SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "swig::Iterator const &","operator ==", 2, argv[0] ));
  4709. }
  4710. if (!argp2) {
  4711. SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "swig::Iterator const &","operator ==", 2, argv[0]));
  4712. }
  4713. arg2 = reinterpret_cast< swig::Iterator * >(argp2);
  4714. result = (bool)((swig::Iterator const *)arg1)->operator ==((swig::Iterator const &)*arg2);
  4715. vresult = SWIG_From_bool(static_cast< bool >(result));
  4716. return vresult;
  4717. fail:
  4718. return Qnil;
  4719. }
  4720. /*
  4721. Document-method: Uhferret_lib::Iterator.+
  4722. call-seq:
  4723. +(n) -> Iterator
  4724. Add operator.
  4725. */
  4726. SWIGINTERN VALUE
  4727. _wrap_Iterator___add__(int argc, VALUE *argv, VALUE self) {
  4728. swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  4729. ptrdiff_t arg2 ;
  4730. void *argp1 = 0 ;
  4731. int res1 = 0 ;
  4732. ptrdiff_t val2 ;
  4733. int ecode2 = 0 ;
  4734. swig::Iterator *result = 0 ;
  4735. VALUE vresult = Qnil;
  4736. if ((argc < 1) || (argc > 1)) {
  4737. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  4738. }
  4739. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 );
  4740. if (!SWIG_IsOK(res1)) {
  4741. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","operator +", 1, self ));
  4742. }
  4743. arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  4744. ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
  4745. if (!SWIG_IsOK(ecode2)) {
  4746. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "ptrdiff_t","operator +", 2, argv[0] ));
  4747. }
  4748. arg2 = static_cast< ptrdiff_t >(val2);
  4749. try {
  4750. result = (swig::Iterator *)((swig::Iterator const *)arg1)->operator +(arg2);
  4751. }
  4752. catch(swig::stop_iteration &_e) {
  4753. {
  4754. (void)_e;
  4755. SWIG_Ruby_ExceptionType(NULL, Qnil);
  4756. SWIG_fail;
  4757. }
  4758. }
  4759. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, SWIG_POINTER_OWN | 0 );
  4760. return vresult;
  4761. fail:
  4762. return Qnil;
  4763. }
  4764. /*
  4765. Document-method: Uhferret_lib::Iterator.-
  4766. call-seq:
  4767. -(n) -> Iterator
  4768. -(x) -> ptrdiff_t
  4769. Substraction operator.
  4770. */
  4771. SWIGINTERN VALUE
  4772. _wrap_Iterator___sub____SWIG_0(int argc, VALUE *argv, VALUE self) {
  4773. swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  4774. ptrdiff_t arg2 ;
  4775. void *argp1 = 0 ;
  4776. int res1 = 0 ;
  4777. ptrdiff_t val2 ;
  4778. int ecode2 = 0 ;
  4779. swig::Iterator *result = 0 ;
  4780. VALUE vresult = Qnil;
  4781. if ((argc < 1) || (argc > 1)) {
  4782. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  4783. }
  4784. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 );
  4785. if (!SWIG_IsOK(res1)) {
  4786. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","operator -", 1, self ));
  4787. }
  4788. arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  4789. ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
  4790. if (!SWIG_IsOK(ecode2)) {
  4791. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "ptrdiff_t","operator -", 2, argv[0] ));
  4792. }
  4793. arg2 = static_cast< ptrdiff_t >(val2);
  4794. try {
  4795. result = (swig::Iterator *)((swig::Iterator const *)arg1)->operator -(arg2);
  4796. }
  4797. catch(swig::stop_iteration &_e) {
  4798. {
  4799. (void)_e;
  4800. SWIG_Ruby_ExceptionType(NULL, Qnil);
  4801. SWIG_fail;
  4802. }
  4803. }
  4804. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, SWIG_POINTER_OWN | 0 );
  4805. return vresult;
  4806. fail:
  4807. return Qnil;
  4808. }
  4809. SWIGINTERN VALUE
  4810. _wrap_Iterator___sub____SWIG_1(int argc, VALUE *argv, VALUE self) {
  4811. swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  4812. swig::Iterator *arg2 = 0 ;
  4813. void *argp1 = 0 ;
  4814. int res1 = 0 ;
  4815. void *argp2 ;
  4816. int res2 = 0 ;
  4817. ptrdiff_t result;
  4818. VALUE vresult = Qnil;
  4819. if ((argc < 1) || (argc > 1)) {
  4820. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  4821. }
  4822. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 | 0 );
  4823. if (!SWIG_IsOK(res1)) {
  4824. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","operator -", 1, self ));
  4825. }
  4826. arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  4827. res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_swig__Iterator, 0 );
  4828. if (!SWIG_IsOK(res2)) {
  4829. SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "swig::Iterator const &","operator -", 2, argv[0] ));
  4830. }
  4831. if (!argp2) {
  4832. SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "swig::Iterator const &","operator -", 2, argv[0]));
  4833. }
  4834. arg2 = reinterpret_cast< swig::Iterator * >(argp2);
  4835. result = ((swig::Iterator const *)arg1)->operator -((swig::Iterator const &)*arg2);
  4836. vresult = SWIG_From_ptrdiff_t(static_cast< ptrdiff_t >(result));
  4837. return vresult;
  4838. fail:
  4839. return Qnil;
  4840. }
  4841. SWIGINTERN VALUE _wrap_Iterator___sub__(int nargs, VALUE *args, VALUE self) {
  4842. int argc;
  4843. VALUE argv[3];
  4844. int ii;
  4845. argc = nargs + 1;
  4846. argv[0] = self;
  4847. if (argc > 3) SWIG_fail;
  4848. for (ii = 1; (ii < argc); ++ii) {
  4849. argv[ii] = args[ii-1];
  4850. }
  4851. if (argc == 2) {
  4852. int _v;
  4853. void *vptr = 0;
  4854. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
  4855. _v = SWIG_CheckState(res);
  4856. if (_v) {
  4857. void *vptr = 0;
  4858. int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_swig__Iterator, 0);
  4859. _v = SWIG_CheckState(res);
  4860. if (_v) {
  4861. return _wrap_Iterator___sub____SWIG_1(nargs, args, self);
  4862. }
  4863. }
  4864. }
  4865. if (argc == 2) {
  4866. int _v;
  4867. void *vptr = 0;
  4868. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
  4869. _v = SWIG_CheckState(res);
  4870. if (_v) {
  4871. {
  4872. int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
  4873. _v = SWIG_CheckState(res);
  4874. }
  4875. if (_v) {
  4876. return _wrap_Iterator___sub____SWIG_0(nargs, args, self);
  4877. }
  4878. }
  4879. }
  4880. fail:
  4881. Ruby_Format_OverloadedError( argc, 3, "__sub__.new",
  4882. " __sub__.new(ptrdiff_t n)\n"
  4883. " __sub__.new(swig::Iterator const &x)\n");
  4884. return Qnil;
  4885. }
  4886. SWIGINTERN void
  4887. free_swig_Iterator(swig::Iterator *arg1) {
  4888. delete arg1;
  4889. }
  4890. swig_class SwigClassIntVector;
  4891. /*
  4892. Document-method: Uhferret_lib::IntVector.dup
  4893. call-seq:
  4894. dup -> IntVector
  4895. Create a duplicate of the class and unfreeze it if needed.
  4896. */
  4897. SWIGINTERN VALUE
  4898. _wrap_IntVector_dup(int argc, VALUE *argv, VALUE self) {
  4899. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  4900. void *argp1 = 0 ;
  4901. int res1 = 0 ;
  4902. std::vector< int,std::allocator< int > > *result = 0 ;
  4903. VALUE vresult = Qnil;
  4904. if ((argc < 0) || (argc > 0)) {
  4905. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  4906. }
  4907. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  4908. if (!SWIG_IsOK(res1)) {
  4909. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","dup", 1, self ));
  4910. }
  4911. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  4912. result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg__dup(arg1);
  4913. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_OWN | 0 );
  4914. return vresult;
  4915. fail:
  4916. return Qnil;
  4917. }
  4918. /*
  4919. Document-method: Uhferret_lib::IntVector.inspect
  4920. call-seq:
  4921. inspect -> VALUE
  4922. Inspect class and its contents.
  4923. */
  4924. SWIGINTERN VALUE
  4925. _wrap_IntVector_inspect(int argc, VALUE *argv, VALUE self) {
  4926. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  4927. void *argp1 = 0 ;
  4928. int res1 = 0 ;
  4929. VALUE result;
  4930. VALUE vresult = Qnil;
  4931. if ((argc < 0) || (argc > 0)) {
  4932. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  4933. }
  4934. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  4935. if (!SWIG_IsOK(res1)) {
  4936. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","inspect", 1, self ));
  4937. }
  4938. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  4939. result = (VALUE)std_vector_Sl_int_Sg__inspect(arg1);
  4940. vresult = result;
  4941. return vresult;
  4942. fail:
  4943. return Qnil;
  4944. }
  4945. /*
  4946. Document-method: Uhferret_lib::IntVector.to_a
  4947. call-seq:
  4948. to_a -> VALUE
  4949. Convert IntVector to an Array.
  4950. */
  4951. SWIGINTERN VALUE
  4952. _wrap_IntVector_to_a(int argc, VALUE *argv, VALUE self) {
  4953. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  4954. void *argp1 = 0 ;
  4955. int res1 = 0 ;
  4956. VALUE result;
  4957. VALUE vresult = Qnil;
  4958. if ((argc < 0) || (argc > 0)) {
  4959. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  4960. }
  4961. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  4962. if (!SWIG_IsOK(res1)) {
  4963. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","to_a", 1, self ));
  4964. }
  4965. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  4966. result = (VALUE)std_vector_Sl_int_Sg__to_a(arg1);
  4967. vresult = result;
  4968. return vresult;
  4969. fail:
  4970. return Qnil;
  4971. }
  4972. /*
  4973. Document-method: Uhferret_lib::IntVector.to_s
  4974. call-seq:
  4975. to_s -> VALUE
  4976. Convert class to a String representation.
  4977. */
  4978. SWIGINTERN VALUE
  4979. _wrap_IntVector_to_s(int argc, VALUE *argv, VALUE self) {
  4980. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  4981. void *argp1 = 0 ;
  4982. int res1 = 0 ;
  4983. VALUE result;
  4984. VALUE vresult = Qnil;
  4985. if ((argc < 0) || (argc > 0)) {
  4986. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  4987. }
  4988. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  4989. if (!SWIG_IsOK(res1)) {
  4990. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","to_s", 1, self ));
  4991. }
  4992. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  4993. result = (VALUE)std_vector_Sl_int_Sg__to_s(arg1);
  4994. vresult = result;
  4995. return vresult;
  4996. fail:
  4997. return Qnil;
  4998. }
  4999. /*
  5000. Document-method: Uhferret_lib::IntVector.slice
  5001. call-seq:
  5002. slice(i, j) -> VALUE
  5003. Return a slice (portion of) the IntVector.
  5004. */
  5005. SWIGINTERN VALUE
  5006. _wrap_IntVector_slice(int argc, VALUE *argv, VALUE self) {
  5007. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5008. std::vector< int >::difference_type arg2 ;
  5009. std::vector< int >::difference_type arg3 ;
  5010. void *argp1 = 0 ;
  5011. int res1 = 0 ;
  5012. ptrdiff_t val2 ;
  5013. int ecode2 = 0 ;
  5014. ptrdiff_t val3 ;
  5015. int ecode3 = 0 ;
  5016. VALUE result;
  5017. VALUE vresult = Qnil;
  5018. if ((argc < 2) || (argc > 2)) {
  5019. rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  5020. }
  5021. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5022. if (!SWIG_IsOK(res1)) {
  5023. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","slice", 1, self ));
  5024. }
  5025. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5026. ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
  5027. if (!SWIG_IsOK(ecode2)) {
  5028. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","slice", 2, argv[0] ));
  5029. }
  5030. arg2 = static_cast< std::vector< int >::difference_type >(val2);
  5031. ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3);
  5032. if (!SWIG_IsOK(ecode3)) {
  5033. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","slice", 3, argv[1] ));
  5034. }
  5035. arg3 = static_cast< std::vector< int >::difference_type >(val3);
  5036. result = (VALUE)std_vector_Sl_int_Sg__slice(arg1,arg2,arg3);
  5037. vresult = result;
  5038. return vresult;
  5039. fail:
  5040. return Qnil;
  5041. }
  5042. /*
  5043. Document-method: Uhferret_lib::IntVector.each
  5044. call-seq:
  5045. each -> IntVector
  5046. Iterate thru each element in the IntVector. A block must be provided.
  5047. */
  5048. SWIGINTERN VALUE
  5049. _wrap_IntVector_each(int argc, VALUE *argv, VALUE self) {
  5050. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5051. void *argp1 = 0 ;
  5052. int res1 = 0 ;
  5053. std::vector< int,std::allocator< int > > *result = 0 ;
  5054. VALUE vresult = Qnil;
  5055. if ((argc < 0) || (argc > 0)) {
  5056. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  5057. }
  5058. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5059. if (!SWIG_IsOK(res1)) {
  5060. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","each", 1, self ));
  5061. }
  5062. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5063. result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg__each(arg1);
  5064. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5065. return vresult;
  5066. fail:
  5067. return Qnil;
  5068. }
  5069. /*
  5070. Document-method: Uhferret_lib::IntVector.select
  5071. call-seq:
  5072. select -> IntVector
  5073. Iterate thru each element in the IntVector and select those that match a condition. A block must be provided.
  5074. */
  5075. SWIGINTERN VALUE
  5076. _wrap_IntVector_select(int argc, VALUE *argv, VALUE self) {
  5077. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5078. void *argp1 = 0 ;
  5079. int res1 = 0 ;
  5080. std::vector< int,std::allocator< int > > *result = 0 ;
  5081. VALUE vresult = Qnil;
  5082. if ((argc < 0) || (argc > 0)) {
  5083. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  5084. }
  5085. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5086. if (!SWIG_IsOK(res1)) {
  5087. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","select", 1, self ));
  5088. }
  5089. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5090. result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg__select(arg1);
  5091. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_OWN | 0 );
  5092. return vresult;
  5093. fail:
  5094. return Qnil;
  5095. }
  5096. /*
  5097. Document-method: Uhferret_lib::IntVector.reject!
  5098. call-seq:
  5099. reject! -> IntVector
  5100. Iterate thru each element in the IntVector and reject those that fail a condition. A block must be provided. IntVector is modified in place.
  5101. */
  5102. SWIGINTERN VALUE
  5103. _wrap_IntVector_rejectN___(int argc, VALUE *argv, VALUE self) {
  5104. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5105. void *argp1 = 0 ;
  5106. int res1 = 0 ;
  5107. std::vector< int,std::allocator< int > > *result = 0 ;
  5108. VALUE vresult = Qnil;
  5109. if ((argc < 0) || (argc > 0)) {
  5110. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  5111. }
  5112. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5113. if (!SWIG_IsOK(res1)) {
  5114. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","reject_bang", 1, self ));
  5115. }
  5116. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5117. result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg__reject_bang(arg1);
  5118. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5119. return vresult;
  5120. fail:
  5121. return Qnil;
  5122. }
  5123. /*
  5124. Document-method: Uhferret_lib::IntVector.delete_at
  5125. call-seq:
  5126. delete_at(i) -> VALUE
  5127. Delete an element at a certain index.
  5128. */
  5129. SWIGINTERN VALUE
  5130. _wrap_IntVector_delete_at(int argc, VALUE *argv, VALUE self) {
  5131. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5132. std::vector< int >::difference_type arg2 ;
  5133. void *argp1 = 0 ;
  5134. int res1 = 0 ;
  5135. ptrdiff_t val2 ;
  5136. int ecode2 = 0 ;
  5137. VALUE result;
  5138. VALUE vresult = Qnil;
  5139. if ((argc < 1) || (argc > 1)) {
  5140. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  5141. }
  5142. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5143. if (!SWIG_IsOK(res1)) {
  5144. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","delete_at", 1, self ));
  5145. }
  5146. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5147. ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
  5148. if (!SWIG_IsOK(ecode2)) {
  5149. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","delete_at", 2, argv[0] ));
  5150. }
  5151. arg2 = static_cast< std::vector< int >::difference_type >(val2);
  5152. result = (VALUE)std_vector_Sl_int_Sg__delete_at(arg1,arg2);
  5153. vresult = result;
  5154. return vresult;
  5155. fail:
  5156. return Qnil;
  5157. }
  5158. SWIGINTERN VALUE
  5159. _wrap_IntVector___delete2__(int argc, VALUE *argv, VALUE self) {
  5160. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5161. std::vector< int >::value_type *arg2 = 0 ;
  5162. void *argp1 = 0 ;
  5163. int res1 = 0 ;
  5164. std::vector< int >::value_type temp2 ;
  5165. int val2 ;
  5166. int ecode2 = 0 ;
  5167. VALUE result;
  5168. VALUE vresult = Qnil;
  5169. if ((argc < 1) || (argc > 1)) {
  5170. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  5171. }
  5172. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5173. if (!SWIG_IsOK(res1)) {
  5174. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","__delete2__", 1, self ));
  5175. }
  5176. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5177. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  5178. if (!SWIG_IsOK(ecode2)) {
  5179. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::value_type","__delete2__", 2, argv[0] ));
  5180. }
  5181. temp2 = static_cast< std::vector< int >::value_type >(val2);
  5182. arg2 = &temp2;
  5183. result = (VALUE)std_vector_Sl_int_Sg____delete2__(arg1,(int const &)*arg2);
  5184. vresult = result;
  5185. return vresult;
  5186. fail:
  5187. return Qnil;
  5188. }
  5189. /*
  5190. Document-method: Uhferret_lib::IntVector.pop
  5191. call-seq:
  5192. pop -> VALUE
  5193. Remove and return element at the end of the IntVector.
  5194. */
  5195. SWIGINTERN VALUE
  5196. _wrap_IntVector_pop(int argc, VALUE *argv, VALUE self) {
  5197. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5198. void *argp1 = 0 ;
  5199. int res1 = 0 ;
  5200. VALUE result;
  5201. VALUE vresult = Qnil;
  5202. if ((argc < 0) || (argc > 0)) {
  5203. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  5204. }
  5205. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5206. if (!SWIG_IsOK(res1)) {
  5207. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","pop", 1, self ));
  5208. }
  5209. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5210. result = (VALUE)std_vector_Sl_int_Sg__pop(arg1);
  5211. vresult = result;
  5212. return vresult;
  5213. fail:
  5214. return Qnil;
  5215. }
  5216. /*
  5217. Document-method: Uhferret_lib::IntVector.push
  5218. call-seq:
  5219. push(e) -> value_type
  5220. Add an element at the end of the IntVector.
  5221. */
  5222. SWIGINTERN VALUE
  5223. _wrap_IntVector_push(int argc, VALUE *argv, VALUE self) {
  5224. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5225. std::vector< int >::value_type *arg2 = 0 ;
  5226. void *argp1 = 0 ;
  5227. int res1 = 0 ;
  5228. std::vector< int >::value_type temp2 ;
  5229. int val2 ;
  5230. int ecode2 = 0 ;
  5231. std::vector< int >::value_type result;
  5232. VALUE vresult = Qnil;
  5233. if ((argc < 1) || (argc > 1)) {
  5234. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  5235. }
  5236. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5237. if (!SWIG_IsOK(res1)) {
  5238. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","push", 1, self ));
  5239. }
  5240. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5241. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  5242. if (!SWIG_IsOK(ecode2)) {
  5243. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::value_type","push", 2, argv[0] ));
  5244. }
  5245. temp2 = static_cast< std::vector< int >::value_type >(val2);
  5246. arg2 = &temp2;
  5247. result = (std::vector< int >::value_type)std_vector_Sl_int_Sg__push(arg1,(int const &)*arg2);
  5248. vresult = SWIG_From_int(static_cast< int >(result));
  5249. return vresult;
  5250. fail:
  5251. return Qnil;
  5252. }
  5253. /*
  5254. Document-method: Uhferret_lib::IntVector.reject
  5255. call-seq:
  5256. reject -> IntVector
  5257. Iterate thru each element in the IntVector and reject those that fail a condition returning a new IntVector. A block must be provided.
  5258. */
  5259. SWIGINTERN VALUE
  5260. _wrap_IntVector_reject(int argc, VALUE *argv, VALUE self) {
  5261. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5262. void *argp1 = 0 ;
  5263. int res1 = 0 ;
  5264. std::vector< int,std::allocator< int > > *result = 0 ;
  5265. VALUE vresult = Qnil;
  5266. if ((argc < 0) || (argc > 0)) {
  5267. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  5268. }
  5269. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5270. if (!SWIG_IsOK(res1)) {
  5271. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","reject", 1, self ));
  5272. }
  5273. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5274. result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg__reject(arg1);
  5275. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_OWN | 0 );
  5276. return vresult;
  5277. fail:
  5278. return Qnil;
  5279. }
  5280. /*
  5281. Document-method: Uhferret_lib::IntVector.at
  5282. call-seq:
  5283. at(i) -> VALUE
  5284. Return element at a certain index.
  5285. */
  5286. SWIGINTERN VALUE
  5287. _wrap_IntVector_at(int argc, VALUE *argv, VALUE self) {
  5288. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5289. std::vector< int >::difference_type arg2 ;
  5290. void *argp1 = 0 ;
  5291. int res1 = 0 ;
  5292. ptrdiff_t val2 ;
  5293. int ecode2 = 0 ;
  5294. VALUE result;
  5295. VALUE vresult = Qnil;
  5296. if ((argc < 1) || (argc > 1)) {
  5297. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  5298. }
  5299. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5300. if (!SWIG_IsOK(res1)) {
  5301. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","at", 1, self ));
  5302. }
  5303. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5304. ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
  5305. if (!SWIG_IsOK(ecode2)) {
  5306. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","at", 2, argv[0] ));
  5307. }
  5308. arg2 = static_cast< std::vector< int >::difference_type >(val2);
  5309. result = (VALUE)std_vector_Sl_int_Sg__at((std::vector< int > const *)arg1,arg2);
  5310. vresult = result;
  5311. return vresult;
  5312. fail:
  5313. return Qnil;
  5314. }
  5315. /*
  5316. Document-method: Uhferret_lib::IntVector.[]
  5317. call-seq:
  5318. [](i, j) -> VALUE
  5319. [](i) -> VALUE
  5320. [](i) -> VALUE
  5321. Element accessor/slicing.
  5322. */
  5323. SWIGINTERN VALUE
  5324. _wrap_IntVector___getitem____SWIG_0(int argc, VALUE *argv, VALUE self) {
  5325. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5326. std::vector< int >::difference_type arg2 ;
  5327. std::vector< int >::difference_type arg3 ;
  5328. void *argp1 = 0 ;
  5329. int res1 = 0 ;
  5330. ptrdiff_t val2 ;
  5331. int ecode2 = 0 ;
  5332. ptrdiff_t val3 ;
  5333. int ecode3 = 0 ;
  5334. VALUE result;
  5335. VALUE vresult = Qnil;
  5336. if ((argc < 2) || (argc > 2)) {
  5337. rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  5338. }
  5339. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5340. if (!SWIG_IsOK(res1)) {
  5341. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","__getitem__", 1, self ));
  5342. }
  5343. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5344. ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
  5345. if (!SWIG_IsOK(ecode2)) {
  5346. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","__getitem__", 2, argv[0] ));
  5347. }
  5348. arg2 = static_cast< std::vector< int >::difference_type >(val2);
  5349. ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3);
  5350. if (!SWIG_IsOK(ecode3)) {
  5351. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","__getitem__", 3, argv[1] ));
  5352. }
  5353. arg3 = static_cast< std::vector< int >::difference_type >(val3);
  5354. result = (VALUE)std_vector_Sl_int_Sg____getitem____SWIG_0((std::vector< int > const *)arg1,arg2,arg3);
  5355. vresult = result;
  5356. return vresult;
  5357. fail:
  5358. return Qnil;
  5359. }
  5360. SWIGINTERN VALUE
  5361. _wrap_IntVector___getitem____SWIG_1(int argc, VALUE *argv, VALUE self) {
  5362. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5363. std::vector< int >::difference_type arg2 ;
  5364. void *argp1 = 0 ;
  5365. int res1 = 0 ;
  5366. ptrdiff_t val2 ;
  5367. int ecode2 = 0 ;
  5368. VALUE result;
  5369. VALUE vresult = Qnil;
  5370. if ((argc < 1) || (argc > 1)) {
  5371. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  5372. }
  5373. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5374. if (!SWIG_IsOK(res1)) {
  5375. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","__getitem__", 1, self ));
  5376. }
  5377. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5378. ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
  5379. if (!SWIG_IsOK(ecode2)) {
  5380. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","__getitem__", 2, argv[0] ));
  5381. }
  5382. arg2 = static_cast< std::vector< int >::difference_type >(val2);
  5383. result = (VALUE)std_vector_Sl_int_Sg____getitem____SWIG_1((std::vector< int > const *)arg1,arg2);
  5384. vresult = result;
  5385. return vresult;
  5386. fail:
  5387. return Qnil;
  5388. }
  5389. SWIGINTERN VALUE
  5390. _wrap_IntVector___getitem____SWIG_2(int argc, VALUE *argv, VALUE self) {
  5391. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5392. VALUE arg2 = (VALUE) 0 ;
  5393. void *argp1 = 0 ;
  5394. int res1 = 0 ;
  5395. VALUE result;
  5396. VALUE vresult = Qnil;
  5397. if ((argc < 1) || (argc > 1)) {
  5398. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  5399. }
  5400. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5401. if (!SWIG_IsOK(res1)) {
  5402. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","__getitem__", 1, self ));
  5403. }
  5404. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5405. arg2 = argv[0];
  5406. result = (VALUE)std_vector_Sl_int_Sg____getitem____SWIG_2((std::vector< int > const *)arg1,arg2);
  5407. vresult = result;
  5408. return vresult;
  5409. fail:
  5410. return Qnil;
  5411. }
  5412. SWIGINTERN VALUE _wrap_IntVector___getitem__(int nargs, VALUE *args, VALUE self) {
  5413. int argc;
  5414. VALUE argv[4];
  5415. int ii;
  5416. argc = nargs + 1;
  5417. argv[0] = self;
  5418. if (argc > 4) SWIG_fail;
  5419. for (ii = 1; (ii < argc); ++ii) {
  5420. argv[ii] = args[ii-1];
  5421. }
  5422. if (argc == 2) {
  5423. int _v;
  5424. int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
  5425. _v = SWIG_CheckState(res);
  5426. if (_v) {
  5427. {
  5428. int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
  5429. _v = SWIG_CheckState(res);
  5430. }
  5431. if (_v) {
  5432. return _wrap_IntVector___getitem____SWIG_1(nargs, args, self);
  5433. }
  5434. }
  5435. }
  5436. if (argc == 2) {
  5437. int _v;
  5438. int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
  5439. _v = SWIG_CheckState(res);
  5440. if (_v) {
  5441. _v = (argv[1] != 0);
  5442. if (_v) {
  5443. return _wrap_IntVector___getitem____SWIG_2(nargs, args, self);
  5444. }
  5445. }
  5446. }
  5447. if (argc == 3) {
  5448. int _v;
  5449. int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
  5450. _v = SWIG_CheckState(res);
  5451. if (_v) {
  5452. {
  5453. int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
  5454. _v = SWIG_CheckState(res);
  5455. }
  5456. if (_v) {
  5457. {
  5458. int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL);
  5459. _v = SWIG_CheckState(res);
  5460. }
  5461. if (_v) {
  5462. return _wrap_IntVector___getitem____SWIG_0(nargs, args, self);
  5463. }
  5464. }
  5465. }
  5466. }
  5467. fail:
  5468. Ruby_Format_OverloadedError( argc, 4, "__getitem__",
  5469. " VALUE __getitem__(std::vector< int >::difference_type i, std::vector< int >::difference_type j)\n"
  5470. " VALUE __getitem__(std::vector< int >::difference_type i)\n"
  5471. " VALUE __getitem__(VALUE i)\n");
  5472. return Qnil;
  5473. }
  5474. /*
  5475. Document-method: Uhferret_lib::IntVector.[]=
  5476. call-seq:
  5477. []=(i, x) -> VALUE
  5478. []=(i, j, v) -> VALUE
  5479. Element setter/slicing.
  5480. */
  5481. SWIGINTERN VALUE
  5482. _wrap_IntVector___setitem____SWIG_0(int argc, VALUE *argv, VALUE self) {
  5483. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5484. std::vector< int >::difference_type arg2 ;
  5485. std::vector< int >::value_type *arg3 = 0 ;
  5486. void *argp1 = 0 ;
  5487. int res1 = 0 ;
  5488. ptrdiff_t val2 ;
  5489. int ecode2 = 0 ;
  5490. std::vector< int >::value_type temp3 ;
  5491. int val3 ;
  5492. int ecode3 = 0 ;
  5493. VALUE result;
  5494. VALUE vresult = Qnil;
  5495. if ((argc < 2) || (argc > 2)) {
  5496. rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  5497. }
  5498. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5499. if (!SWIG_IsOK(res1)) {
  5500. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","__setitem__", 1, self ));
  5501. }
  5502. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5503. ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
  5504. if (!SWIG_IsOK(ecode2)) {
  5505. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","__setitem__", 2, argv[0] ));
  5506. }
  5507. arg2 = static_cast< std::vector< int >::difference_type >(val2);
  5508. ecode3 = SWIG_AsVal_int(argv[1], &val3);
  5509. if (!SWIG_IsOK(ecode3)) {
  5510. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< int >::value_type","__setitem__", 3, argv[1] ));
  5511. }
  5512. temp3 = static_cast< std::vector< int >::value_type >(val3);
  5513. arg3 = &temp3;
  5514. result = (VALUE)std_vector_Sl_int_Sg____setitem____SWIG_0(arg1,arg2,(int const &)*arg3);
  5515. vresult = result;
  5516. return vresult;
  5517. fail:
  5518. return Qnil;
  5519. }
  5520. SWIGINTERN VALUE
  5521. _wrap_IntVector___setitem____SWIG_1(int argc, VALUE *argv, VALUE self) {
  5522. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5523. std::vector< int >::difference_type arg2 ;
  5524. std::vector< int >::difference_type arg3 ;
  5525. std::vector< int,std::allocator< int > > *arg4 = 0 ;
  5526. void *argp1 = 0 ;
  5527. int res1 = 0 ;
  5528. ptrdiff_t val2 ;
  5529. int ecode2 = 0 ;
  5530. ptrdiff_t val3 ;
  5531. int ecode3 = 0 ;
  5532. int res4 = SWIG_OLDOBJ ;
  5533. VALUE result;
  5534. VALUE vresult = Qnil;
  5535. if ((argc < 3) || (argc > 3)) {
  5536. rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  5537. }
  5538. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5539. if (!SWIG_IsOK(res1)) {
  5540. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","__setitem__", 1, self ));
  5541. }
  5542. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5543. ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
  5544. if (!SWIG_IsOK(ecode2)) {
  5545. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","__setitem__", 2, argv[0] ));
  5546. }
  5547. arg2 = static_cast< std::vector< int >::difference_type >(val2);
  5548. ecode3 = SWIG_AsVal_ptrdiff_t(argv[1], &val3);
  5549. if (!SWIG_IsOK(ecode3)) {
  5550. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","__setitem__", 3, argv[1] ));
  5551. }
  5552. arg3 = static_cast< std::vector< int >::difference_type >(val3);
  5553. {
  5554. std::vector<int,std::allocator< int > > *ptr = (std::vector<int,std::allocator< int > > *)0;
  5555. res4 = swig::asptr(argv[2], &ptr);
  5556. if (!SWIG_IsOK(res4)) {
  5557. SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "std::vector< int,std::allocator< int > > const &","__setitem__", 4, argv[2] ));
  5558. }
  5559. if (!ptr) {
  5560. SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< int,std::allocator< int > > const &","__setitem__", 4, argv[2]));
  5561. }
  5562. arg4 = ptr;
  5563. }
  5564. try {
  5565. result = (VALUE)std_vector_Sl_int_Sg____setitem____SWIG_1(arg1,arg2,arg3,(std::vector< int,std::allocator< int > > const &)*arg4);
  5566. }
  5567. catch(std::invalid_argument &_e) {
  5568. SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
  5569. }
  5570. vresult = result;
  5571. if (SWIG_IsNewObj(res4)) delete arg4;
  5572. return vresult;
  5573. fail:
  5574. if (SWIG_IsNewObj(res4)) delete arg4;
  5575. return Qnil;
  5576. }
  5577. SWIGINTERN VALUE _wrap_IntVector___setitem__(int nargs, VALUE *args, VALUE self) {
  5578. int argc;
  5579. VALUE argv[5];
  5580. int ii;
  5581. argc = nargs + 1;
  5582. argv[0] = self;
  5583. if (argc > 5) SWIG_fail;
  5584. for (ii = 1; (ii < argc); ++ii) {
  5585. argv[ii] = args[ii-1];
  5586. }
  5587. if (argc == 3) {
  5588. int _v;
  5589. int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
  5590. _v = SWIG_CheckState(res);
  5591. if (_v) {
  5592. {
  5593. int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
  5594. _v = SWIG_CheckState(res);
  5595. }
  5596. if (_v) {
  5597. {
  5598. int res = SWIG_AsVal_int(argv[2], NULL);
  5599. _v = SWIG_CheckState(res);
  5600. }
  5601. if (_v) {
  5602. return _wrap_IntVector___setitem____SWIG_0(nargs, args, self);
  5603. }
  5604. }
  5605. }
  5606. }
  5607. if (argc == 4) {
  5608. int _v;
  5609. int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
  5610. _v = SWIG_CheckState(res);
  5611. if (_v) {
  5612. {
  5613. int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
  5614. _v = SWIG_CheckState(res);
  5615. }
  5616. if (_v) {
  5617. {
  5618. int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL);
  5619. _v = SWIG_CheckState(res);
  5620. }
  5621. if (_v) {
  5622. int res = swig::asptr(argv[3], (std::vector<int,std::allocator< int > >**)(0));
  5623. _v = SWIG_CheckState(res);
  5624. if (_v) {
  5625. return _wrap_IntVector___setitem____SWIG_1(nargs, args, self);
  5626. }
  5627. }
  5628. }
  5629. }
  5630. }
  5631. fail:
  5632. Ruby_Format_OverloadedError( argc, 5, "__setitem__",
  5633. " VALUE __setitem__(std::vector< int >::difference_type i, std::vector< int >::value_type const &x)\n"
  5634. " VALUE __setitem__(std::vector< int >::difference_type i, std::vector< int >::difference_type j, std::vector< int,std::allocator< int > > const &v)\n");
  5635. return Qnil;
  5636. }
  5637. /*
  5638. Document-method: Uhferret_lib::IntVector.shift
  5639. call-seq:
  5640. shift -> VALUE
  5641. Remove and return element at the beginning of the IntVector.
  5642. */
  5643. SWIGINTERN VALUE
  5644. _wrap_IntVector_shift(int argc, VALUE *argv, VALUE self) {
  5645. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5646. void *argp1 = 0 ;
  5647. int res1 = 0 ;
  5648. VALUE result;
  5649. VALUE vresult = Qnil;
  5650. if ((argc < 0) || (argc > 0)) {
  5651. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  5652. }
  5653. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5654. if (!SWIG_IsOK(res1)) {
  5655. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","shift", 1, self ));
  5656. }
  5657. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5658. result = (VALUE)std_vector_Sl_int_Sg__shift(arg1);
  5659. vresult = result;
  5660. return vresult;
  5661. fail:
  5662. return Qnil;
  5663. }
  5664. /*
  5665. Document-method: Uhferret_lib::IntVector.insert
  5666. call-seq:
  5667. insert(pos, argc, ?) -> IntVector
  5668. insert(pos, x) -> iterator
  5669. insert(pos, n, x)
  5670. Insert one or more new elements in the IntVector.
  5671. */
  5672. SWIGINTERN VALUE
  5673. _wrap_IntVector_insert__SWIG_0(int argc, VALUE *argv, VALUE self) {
  5674. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5675. std::vector< int >::difference_type arg2 ;
  5676. int arg3 ;
  5677. VALUE *arg4 = (VALUE *) 0 ;
  5678. void *arg5 = 0 ;
  5679. void *argp1 = 0 ;
  5680. int res1 = 0 ;
  5681. ptrdiff_t val2 ;
  5682. int ecode2 = 0 ;
  5683. std::vector< int,std::allocator< int > > *result = 0 ;
  5684. VALUE vresult = Qnil;
  5685. if (argc < 2) {
  5686. rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  5687. }
  5688. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5689. if (!SWIG_IsOK(res1)) {
  5690. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","insert", 1, self ));
  5691. }
  5692. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5693. ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
  5694. if (!SWIG_IsOK(ecode2)) {
  5695. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::difference_type","insert", 2, argv[0] ));
  5696. }
  5697. arg2 = static_cast< std::vector< int >::difference_type >(val2);
  5698. {
  5699. arg3 = argc - 1;
  5700. arg4 = argv + 1;
  5701. }
  5702. result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg__insert__SWIG_0(arg1,arg2,arg3,arg4,arg5);
  5703. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5704. return vresult;
  5705. fail:
  5706. return Qnil;
  5707. }
  5708. /*
  5709. Document-method: Uhferret_lib::IntVector.unshift
  5710. call-seq:
  5711. unshift(argc, ?) -> IntVector
  5712. Add one or more elements at the beginning of the IntVector.
  5713. */
  5714. SWIGINTERN VALUE
  5715. _wrap_IntVector_unshift(int argc, VALUE *argv, VALUE self) {
  5716. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5717. int arg2 ;
  5718. VALUE *arg3 = (VALUE *) 0 ;
  5719. void *arg4 = 0 ;
  5720. void *argp1 = 0 ;
  5721. int res1 = 0 ;
  5722. std::vector< int,std::allocator< int > > *result = 0 ;
  5723. VALUE vresult = Qnil;
  5724. if (argc < 1) {
  5725. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  5726. }
  5727. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5728. if (!SWIG_IsOK(res1)) {
  5729. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","unshift", 1, self ));
  5730. }
  5731. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5732. {
  5733. arg2 = argc;
  5734. arg3 = argv;
  5735. }
  5736. result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg__unshift(arg1,arg2,arg3,arg4);
  5737. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5738. return vresult;
  5739. fail:
  5740. return Qnil;
  5741. }
  5742. SWIGINTERN VALUE
  5743. _wrap_new_IntVector__SWIG_0(int argc, VALUE *argv, VALUE self) {
  5744. std::vector< int > *result = 0 ;
  5745. if ((argc < 0) || (argc > 0)) {
  5746. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  5747. }
  5748. result = (std::vector< int > *)new std::vector< int >();
  5749. DATA_PTR(self) = result;
  5750. return self;
  5751. fail:
  5752. return Qnil;
  5753. }
  5754. SWIGINTERN VALUE
  5755. _wrap_new_IntVector__SWIG_1(int argc, VALUE *argv, VALUE self) {
  5756. std::vector< int > *arg1 = 0 ;
  5757. int res1 = SWIG_OLDOBJ ;
  5758. std::vector< int > *result = 0 ;
  5759. if ((argc < 1) || (argc > 1)) {
  5760. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  5761. }
  5762. {
  5763. std::vector<int,std::allocator< int > > *ptr = (std::vector<int,std::allocator< int > > *)0;
  5764. res1 = swig::asptr(argv[0], &ptr);
  5765. if (!SWIG_IsOK(res1)) {
  5766. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const &","std::vector<(int)>", 1, argv[0] ));
  5767. }
  5768. if (!ptr) {
  5769. SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< int > const &","std::vector<(int)>", 1, argv[0]));
  5770. }
  5771. arg1 = ptr;
  5772. }
  5773. result = (std::vector< int > *)new std::vector< int >((std::vector< int > const &)*arg1);
  5774. DATA_PTR(self) = result;
  5775. if (SWIG_IsNewObj(res1)) delete arg1;
  5776. return self;
  5777. fail:
  5778. if (SWIG_IsNewObj(res1)) delete arg1;
  5779. return Qnil;
  5780. }
  5781. /*
  5782. Document-method: Uhferret_lib::IntVector.empty?
  5783. call-seq:
  5784. empty? -> bool
  5785. Check if the IntVector is empty or not.
  5786. */
  5787. SWIGINTERN VALUE
  5788. _wrap_IntVector_emptyq___(int argc, VALUE *argv, VALUE self) {
  5789. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5790. void *argp1 = 0 ;
  5791. int res1 = 0 ;
  5792. bool result;
  5793. VALUE vresult = Qnil;
  5794. if ((argc < 0) || (argc > 0)) {
  5795. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  5796. }
  5797. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5798. if (!SWIG_IsOK(res1)) {
  5799. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","empty", 1, self ));
  5800. }
  5801. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5802. result = (bool)((std::vector< int > const *)arg1)->empty();
  5803. vresult = SWIG_From_bool(static_cast< bool >(result));
  5804. return vresult;
  5805. fail:
  5806. return Qnil;
  5807. }
  5808. /*
  5809. Document-method: Uhferret_lib::IntVector.size
  5810. call-seq:
  5811. size -> size_type
  5812. Size or Length of the IntVector.
  5813. */
  5814. SWIGINTERN VALUE
  5815. _wrap_IntVector_size(int argc, VALUE *argv, VALUE self) {
  5816. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5817. void *argp1 = 0 ;
  5818. int res1 = 0 ;
  5819. std::vector< int >::size_type result;
  5820. VALUE vresult = Qnil;
  5821. if ((argc < 0) || (argc > 0)) {
  5822. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  5823. }
  5824. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5825. if (!SWIG_IsOK(res1)) {
  5826. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","size", 1, self ));
  5827. }
  5828. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5829. result = ((std::vector< int > const *)arg1)->size();
  5830. vresult = SWIG_From_size_t(static_cast< size_t >(result));
  5831. return vresult;
  5832. fail:
  5833. return Qnil;
  5834. }
  5835. /*
  5836. Document-method: Uhferret_lib::IntVector.clear
  5837. call-seq:
  5838. clear
  5839. Clear IntVector contents.
  5840. */
  5841. SWIGINTERN VALUE
  5842. _wrap_IntVector_clear(int argc, VALUE *argv, VALUE self) {
  5843. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5844. void *argp1 = 0 ;
  5845. int res1 = 0 ;
  5846. if ((argc < 0) || (argc > 0)) {
  5847. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  5848. }
  5849. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5850. if (!SWIG_IsOK(res1)) {
  5851. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","clear", 1, self ));
  5852. }
  5853. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5854. (arg1)->clear();
  5855. return Qnil;
  5856. fail:
  5857. return Qnil;
  5858. }
  5859. SWIGINTERN VALUE
  5860. _wrap_IntVector_swap(int argc, VALUE *argv, VALUE self) {
  5861. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5862. std::vector< int > *arg2 = 0 ;
  5863. void *argp1 = 0 ;
  5864. int res1 = 0 ;
  5865. void *argp2 = 0 ;
  5866. int res2 = 0 ;
  5867. if ((argc < 1) || (argc > 1)) {
  5868. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  5869. }
  5870. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5871. if (!SWIG_IsOK(res1)) {
  5872. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","swap", 1, self ));
  5873. }
  5874. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5875. res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 );
  5876. if (!SWIG_IsOK(res2)) {
  5877. SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::vector< int > &","swap", 2, argv[0] ));
  5878. }
  5879. if (!argp2) {
  5880. SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::vector< int > &","swap", 2, argv[0]));
  5881. }
  5882. arg2 = reinterpret_cast< std::vector< int > * >(argp2);
  5883. (arg1)->swap(*arg2);
  5884. return Qnil;
  5885. fail:
  5886. return Qnil;
  5887. }
  5888. SWIGINTERN VALUE
  5889. _wrap_IntVector_get_allocator(int argc, VALUE *argv, VALUE self) {
  5890. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5891. void *argp1 = 0 ;
  5892. int res1 = 0 ;
  5893. SwigValueWrapper< std::allocator< int > > result;
  5894. VALUE vresult = Qnil;
  5895. if ((argc < 0) || (argc > 0)) {
  5896. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  5897. }
  5898. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5899. if (!SWIG_IsOK(res1)) {
  5900. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","get_allocator", 1, self ));
  5901. }
  5902. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5903. result = ((std::vector< int > const *)arg1)->get_allocator();
  5904. vresult = SWIG_NewPointerObj((new std::vector< int >::allocator_type(static_cast< const std::vector< int >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_int_t, SWIG_POINTER_OWN | 0 );
  5905. return vresult;
  5906. fail:
  5907. return Qnil;
  5908. }
  5909. /*
  5910. Document-method: Uhferret_lib::IntVector.begin
  5911. call-seq:
  5912. begin -> iterator
  5913. Return an iterator to the beginning of the IntVector.
  5914. */
  5915. SWIGINTERN VALUE
  5916. _wrap_IntVector_begin(int argc, VALUE *argv, VALUE self) {
  5917. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5918. void *argp1 = 0 ;
  5919. int res1 = 0 ;
  5920. std::vector< int >::iterator result;
  5921. VALUE vresult = Qnil;
  5922. if ((argc < 0) || (argc > 0)) {
  5923. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  5924. }
  5925. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5926. if (!SWIG_IsOK(res1)) {
  5927. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","begin", 1, self ));
  5928. }
  5929. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5930. result = (arg1)->begin();
  5931. vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< int >::iterator & >(result),
  5932. self),
  5933. swig::Iterator::descriptor(),SWIG_POINTER_OWN);
  5934. return vresult;
  5935. fail:
  5936. return Qnil;
  5937. }
  5938. /*
  5939. Document-method: Uhferret_lib::IntVector.end
  5940. call-seq:
  5941. end -> iterator
  5942. Return an iterator to past the end of the IntVector.
  5943. */
  5944. SWIGINTERN VALUE
  5945. _wrap_IntVector_end(int argc, VALUE *argv, VALUE self) {
  5946. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5947. void *argp1 = 0 ;
  5948. int res1 = 0 ;
  5949. std::vector< int >::iterator result;
  5950. VALUE vresult = Qnil;
  5951. if ((argc < 0) || (argc > 0)) {
  5952. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  5953. }
  5954. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5955. if (!SWIG_IsOK(res1)) {
  5956. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","end", 1, self ));
  5957. }
  5958. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5959. result = (arg1)->end();
  5960. vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< int >::iterator & >(result),
  5961. self),
  5962. swig::Iterator::descriptor(),SWIG_POINTER_OWN);
  5963. return vresult;
  5964. fail:
  5965. return Qnil;
  5966. }
  5967. /*
  5968. Document-method: Uhferret_lib::IntVector.rbegin
  5969. call-seq:
  5970. rbegin -> reverse_iterator
  5971. Return a reverse iterator to the beginning (the end) of the IntVector.
  5972. */
  5973. SWIGINTERN VALUE
  5974. _wrap_IntVector_rbegin(int argc, VALUE *argv, VALUE self) {
  5975. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  5976. void *argp1 = 0 ;
  5977. int res1 = 0 ;
  5978. std::vector< int >::reverse_iterator result;
  5979. VALUE vresult = Qnil;
  5980. if ((argc < 0) || (argc > 0)) {
  5981. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  5982. }
  5983. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  5984. if (!SWIG_IsOK(res1)) {
  5985. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","rbegin", 1, self ));
  5986. }
  5987. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  5988. result = (arg1)->rbegin();
  5989. vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< int >::reverse_iterator & >(result),
  5990. self),
  5991. swig::Iterator::descriptor(),SWIG_POINTER_OWN);
  5992. return vresult;
  5993. fail:
  5994. return Qnil;
  5995. }
  5996. /*
  5997. Document-method: Uhferret_lib::IntVector.rend
  5998. call-seq:
  5999. rend -> reverse_iterator
  6000. Return a reverse iterator to past the end (past the beginning) of the IntVector.
  6001. */
  6002. SWIGINTERN VALUE
  6003. _wrap_IntVector_rend(int argc, VALUE *argv, VALUE self) {
  6004. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  6005. void *argp1 = 0 ;
  6006. int res1 = 0 ;
  6007. std::vector< int >::reverse_iterator result;
  6008. VALUE vresult = Qnil;
  6009. if ((argc < 0) || (argc > 0)) {
  6010. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  6011. }
  6012. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  6013. if (!SWIG_IsOK(res1)) {
  6014. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","rend", 1, self ));
  6015. }
  6016. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  6017. result = (arg1)->rend();
  6018. vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< int >::reverse_iterator & >(result),
  6019. self),
  6020. swig::Iterator::descriptor(),SWIG_POINTER_OWN);
  6021. return vresult;
  6022. fail:
  6023. return Qnil;
  6024. }
  6025. SWIGINTERN VALUE
  6026. _wrap_new_IntVector__SWIG_2(int argc, VALUE *argv, VALUE self) {
  6027. std::vector< int >::size_type arg1 ;
  6028. size_t val1 ;
  6029. int ecode1 = 0 ;
  6030. std::vector< int > *result = 0 ;
  6031. if ((argc < 1) || (argc > 1)) {
  6032. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  6033. }
  6034. ecode1 = SWIG_AsVal_size_t(argv[0], &val1);
  6035. if (!SWIG_IsOK(ecode1)) {
  6036. SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "std::vector< int >::size_type","std::vector<(int)>", 1, argv[0] ));
  6037. }
  6038. arg1 = static_cast< std::vector< int >::size_type >(val1);
  6039. result = (std::vector< int > *)new std::vector< int >(arg1);
  6040. DATA_PTR(self) = result;
  6041. return self;
  6042. fail:
  6043. return Qnil;
  6044. }
  6045. /*
  6046. Document-method: Uhferret_lib::IntVector.resize
  6047. call-seq:
  6048. resize(new_size)
  6049. resize(new_size, x)
  6050. Resize the size of the IntVector.
  6051. */
  6052. SWIGINTERN VALUE
  6053. _wrap_IntVector_resize__SWIG_0(int argc, VALUE *argv, VALUE self) {
  6054. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  6055. std::vector< int >::size_type arg2 ;
  6056. void *argp1 = 0 ;
  6057. int res1 = 0 ;
  6058. size_t val2 ;
  6059. int ecode2 = 0 ;
  6060. if ((argc < 1) || (argc > 1)) {
  6061. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  6062. }
  6063. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  6064. if (!SWIG_IsOK(res1)) {
  6065. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","resize", 1, self ));
  6066. }
  6067. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  6068. ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  6069. if (!SWIG_IsOK(ecode2)) {
  6070. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::size_type","resize", 2, argv[0] ));
  6071. }
  6072. arg2 = static_cast< std::vector< int >::size_type >(val2);
  6073. (arg1)->resize(arg2);
  6074. return Qnil;
  6075. fail:
  6076. return Qnil;
  6077. }
  6078. /*
  6079. Document-method: Uhferret_lib::IntVector.erase
  6080. call-seq:
  6081. erase(pos) -> iterator
  6082. erase(first, last) -> iterator
  6083. Delete a portion of the IntVector.
  6084. */
  6085. SWIGINTERN VALUE
  6086. _wrap_IntVector_erase__SWIG_0(int argc, VALUE *argv, VALUE self) {
  6087. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  6088. std::vector< int >::iterator arg2 ;
  6089. void *argp1 = 0 ;
  6090. int res1 = 0 ;
  6091. swig::Iterator *iter2 = 0 ;
  6092. int res2 ;
  6093. std::vector< int >::iterator result;
  6094. VALUE vresult = Qnil;
  6095. if ((argc < 1) || (argc > 1)) {
  6096. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  6097. }
  6098. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  6099. if (!SWIG_IsOK(res1)) {
  6100. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","erase", 1, self ));
  6101. }
  6102. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  6103. res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0);
  6104. if (!SWIG_IsOK(res2) || !iter2) {
  6105. SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","erase", 2, argv[0] ));
  6106. } else {
  6107. swig::Iterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter2);
  6108. if (iter_t) {
  6109. arg2 = iter_t->get_current();
  6110. } else {
  6111. SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","erase", 2, argv[0] ));
  6112. }
  6113. }
  6114. result = (arg1)->erase(arg2);
  6115. vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< int >::iterator & >(result),
  6116. self),
  6117. swig::Iterator::descriptor(),SWIG_POINTER_OWN);
  6118. return vresult;
  6119. fail:
  6120. return Qnil;
  6121. }
  6122. SWIGINTERN VALUE
  6123. _wrap_IntVector_erase__SWIG_1(int argc, VALUE *argv, VALUE self) {
  6124. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  6125. std::vector< int >::iterator arg2 ;
  6126. std::vector< int >::iterator arg3 ;
  6127. void *argp1 = 0 ;
  6128. int res1 = 0 ;
  6129. swig::Iterator *iter2 = 0 ;
  6130. int res2 ;
  6131. swig::Iterator *iter3 = 0 ;
  6132. int res3 ;
  6133. std::vector< int >::iterator result;
  6134. VALUE vresult = Qnil;
  6135. if ((argc < 2) || (argc > 2)) {
  6136. rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  6137. }
  6138. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  6139. if (!SWIG_IsOK(res1)) {
  6140. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","erase", 1, self ));
  6141. }
  6142. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  6143. res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0);
  6144. if (!SWIG_IsOK(res2) || !iter2) {
  6145. SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","erase", 2, argv[0] ));
  6146. } else {
  6147. swig::Iterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter2);
  6148. if (iter_t) {
  6149. arg2 = iter_t->get_current();
  6150. } else {
  6151. SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","erase", 2, argv[0] ));
  6152. }
  6153. }
  6154. res3 = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter3), swig::Iterator::descriptor(), 0);
  6155. if (!SWIG_IsOK(res3) || !iter3) {
  6156. SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","erase", 3, argv[1] ));
  6157. } else {
  6158. swig::Iterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter3);
  6159. if (iter_t) {
  6160. arg3 = iter_t->get_current();
  6161. } else {
  6162. SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","erase", 3, argv[1] ));
  6163. }
  6164. }
  6165. result = (arg1)->erase(arg2,arg3);
  6166. vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< int >::iterator & >(result),
  6167. self),
  6168. swig::Iterator::descriptor(),SWIG_POINTER_OWN);
  6169. return vresult;
  6170. fail:
  6171. return Qnil;
  6172. }
  6173. SWIGINTERN VALUE _wrap_IntVector_erase(int nargs, VALUE *args, VALUE self) {
  6174. int argc;
  6175. VALUE argv[4];
  6176. int ii;
  6177. argc = nargs + 1;
  6178. argv[0] = self;
  6179. if (argc > 4) SWIG_fail;
  6180. for (ii = 1; (ii < argc); ++ii) {
  6181. argv[ii] = args[ii-1];
  6182. }
  6183. if (argc == 2) {
  6184. int _v;
  6185. int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
  6186. _v = SWIG_CheckState(res);
  6187. if (_v) {
  6188. swig::ConstIterator *iter = 0;
  6189. int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter),
  6190. swig::Iterator::descriptor(), 0);
  6191. _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter) != 0));
  6192. if (_v) {
  6193. return _wrap_IntVector_erase__SWIG_0(nargs, args, self);
  6194. }
  6195. }
  6196. }
  6197. if (argc == 3) {
  6198. int _v;
  6199. int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
  6200. _v = SWIG_CheckState(res);
  6201. if (_v) {
  6202. swig::ConstIterator *iter = 0;
  6203. int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter),
  6204. swig::Iterator::descriptor(), 0);
  6205. _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter) != 0));
  6206. if (_v) {
  6207. swig::ConstIterator *iter = 0;
  6208. int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter),
  6209. swig::Iterator::descriptor(), 0);
  6210. _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter) != 0));
  6211. if (_v) {
  6212. return _wrap_IntVector_erase__SWIG_1(nargs, args, self);
  6213. }
  6214. }
  6215. }
  6216. }
  6217. fail:
  6218. Ruby_Format_OverloadedError( argc, 4, "IntVector.erase",
  6219. " std::vector< int >::iterator IntVector.erase(std::vector< int >::iterator pos)\n"
  6220. " std::vector< int >::iterator IntVector.erase(std::vector< int >::iterator first, std::vector< int >::iterator last)\n");
  6221. return Qnil;
  6222. }
  6223. #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
  6224. SWIGINTERN VALUE
  6225. _wrap_IntVector_allocate(VALUE self) {
  6226. #else
  6227. SWIGINTERN VALUE
  6228. _wrap_IntVector_allocate(int argc, VALUE *argv, VALUE self) {
  6229. #endif
  6230. VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t);
  6231. #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
  6232. rb_obj_call_init(vresult, argc, argv);
  6233. #endif
  6234. return vresult;
  6235. }
  6236. SWIGINTERN VALUE
  6237. _wrap_new_IntVector__SWIG_3(int argc, VALUE *argv, VALUE self) {
  6238. std::vector< int >::size_type arg1 ;
  6239. std::vector< int >::value_type *arg2 = 0 ;
  6240. size_t val1 ;
  6241. int ecode1 = 0 ;
  6242. std::vector< int >::value_type temp2 ;
  6243. int val2 ;
  6244. int ecode2 = 0 ;
  6245. std::vector< int > *result = 0 ;
  6246. if ((argc < 2) || (argc > 2)) {
  6247. rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  6248. }
  6249. ecode1 = SWIG_AsVal_size_t(argv[0], &val1);
  6250. if (!SWIG_IsOK(ecode1)) {
  6251. SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "std::vector< int >::size_type","std::vector<(int)>", 1, argv[0] ));
  6252. }
  6253. arg1 = static_cast< std::vector< int >::size_type >(val1);
  6254. ecode2 = SWIG_AsVal_int(argv[1], &val2);
  6255. if (!SWIG_IsOK(ecode2)) {
  6256. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::value_type","std::vector<(int)>", 2, argv[1] ));
  6257. }
  6258. temp2 = static_cast< std::vector< int >::value_type >(val2);
  6259. arg2 = &temp2;
  6260. result = (std::vector< int > *)new std::vector< int >(arg1,(std::vector< int >::value_type const &)*arg2);
  6261. DATA_PTR(self) = result;
  6262. return self;
  6263. fail:
  6264. return Qnil;
  6265. }
  6266. SWIGINTERN VALUE _wrap_new_IntVector(int nargs, VALUE *args, VALUE self) {
  6267. int argc;
  6268. VALUE argv[2];
  6269. int ii;
  6270. argc = nargs;
  6271. if (argc > 2) SWIG_fail;
  6272. for (ii = 0; (ii < argc); ++ii) {
  6273. argv[ii] = args[ii];
  6274. }
  6275. if (argc == 0) {
  6276. return _wrap_new_IntVector__SWIG_0(nargs, args, self);
  6277. }
  6278. if (argc == 1) {
  6279. int _v;
  6280. {
  6281. int res = SWIG_AsVal_size_t(argv[0], NULL);
  6282. _v = SWIG_CheckState(res);
  6283. }
  6284. if (_v) {
  6285. return _wrap_new_IntVector__SWIG_2(nargs, args, self);
  6286. }
  6287. }
  6288. if (argc == 1) {
  6289. int _v;
  6290. int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
  6291. _v = SWIG_CheckState(res);
  6292. if (_v) {
  6293. return _wrap_new_IntVector__SWIG_1(nargs, args, self);
  6294. }
  6295. }
  6296. if (argc == 2) {
  6297. int _v;
  6298. {
  6299. int res = SWIG_AsVal_size_t(argv[0], NULL);
  6300. _v = SWIG_CheckState(res);
  6301. }
  6302. if (_v) {
  6303. {
  6304. int res = SWIG_AsVal_int(argv[1], NULL);
  6305. _v = SWIG_CheckState(res);
  6306. }
  6307. if (_v) {
  6308. return _wrap_new_IntVector__SWIG_3(nargs, args, self);
  6309. }
  6310. }
  6311. }
  6312. fail:
  6313. Ruby_Format_OverloadedError( argc, 2, "IntVector.new",
  6314. " IntVector.new()\n"
  6315. " IntVector.new(std::vector< int > const &)\n"
  6316. " IntVector.new(std::vector< int >::size_type size)\n"
  6317. " IntVector.new(std::vector< int >::size_type size, std::vector< int >::value_type const &value)\n");
  6318. return Qnil;
  6319. }
  6320. /*
  6321. Document-method: Uhferret_lib::IntVector.front
  6322. call-seq:
  6323. front -> value_type
  6324. Return the first element in IntVector.
  6325. */
  6326. SWIGINTERN VALUE
  6327. _wrap_IntVector_front(int argc, VALUE *argv, VALUE self) {
  6328. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  6329. void *argp1 = 0 ;
  6330. int res1 = 0 ;
  6331. std::vector< int >::value_type *result = 0 ;
  6332. VALUE vresult = Qnil;
  6333. if ((argc < 0) || (argc > 0)) {
  6334. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  6335. }
  6336. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  6337. if (!SWIG_IsOK(res1)) {
  6338. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","front", 1, self ));
  6339. }
  6340. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  6341. result = (std::vector< int >::value_type *) &((std::vector< int > const *)arg1)->front();
  6342. vresult = SWIG_From_int(static_cast< int >(*result));
  6343. return vresult;
  6344. fail:
  6345. return Qnil;
  6346. }
  6347. /*
  6348. Document-method: Uhferret_lib::IntVector.back
  6349. call-seq:
  6350. back -> value_type
  6351. Return the last element in IntVector.
  6352. */
  6353. SWIGINTERN VALUE
  6354. _wrap_IntVector_back(int argc, VALUE *argv, VALUE self) {
  6355. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  6356. void *argp1 = 0 ;
  6357. int res1 = 0 ;
  6358. std::vector< int >::value_type *result = 0 ;
  6359. VALUE vresult = Qnil;
  6360. if ((argc < 0) || (argc > 0)) {
  6361. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  6362. }
  6363. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  6364. if (!SWIG_IsOK(res1)) {
  6365. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","back", 1, self ));
  6366. }
  6367. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  6368. result = (std::vector< int >::value_type *) &((std::vector< int > const *)arg1)->back();
  6369. vresult = SWIG_From_int(static_cast< int >(*result));
  6370. return vresult;
  6371. fail:
  6372. return Qnil;
  6373. }
  6374. /*
  6375. Document-method: Uhferret_lib::IntVector.assign
  6376. call-seq:
  6377. assign(n, x)
  6378. Assign a new IntVector or portion of it.
  6379. */
  6380. SWIGINTERN VALUE
  6381. _wrap_IntVector_assign(int argc, VALUE *argv, VALUE self) {
  6382. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  6383. std::vector< int >::size_type arg2 ;
  6384. std::vector< int >::value_type *arg3 = 0 ;
  6385. void *argp1 = 0 ;
  6386. int res1 = 0 ;
  6387. size_t val2 ;
  6388. int ecode2 = 0 ;
  6389. std::vector< int >::value_type temp3 ;
  6390. int val3 ;
  6391. int ecode3 = 0 ;
  6392. if ((argc < 2) || (argc > 2)) {
  6393. rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  6394. }
  6395. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  6396. if (!SWIG_IsOK(res1)) {
  6397. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","assign", 1, self ));
  6398. }
  6399. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  6400. ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  6401. if (!SWIG_IsOK(ecode2)) {
  6402. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::size_type","assign", 2, argv[0] ));
  6403. }
  6404. arg2 = static_cast< std::vector< int >::size_type >(val2);
  6405. ecode3 = SWIG_AsVal_int(argv[1], &val3);
  6406. if (!SWIG_IsOK(ecode3)) {
  6407. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< int >::value_type","assign", 3, argv[1] ));
  6408. }
  6409. temp3 = static_cast< std::vector< int >::value_type >(val3);
  6410. arg3 = &temp3;
  6411. (arg1)->assign(arg2,(std::vector< int >::value_type const &)*arg3);
  6412. return Qnil;
  6413. fail:
  6414. return Qnil;
  6415. }
  6416. /*
  6417. Document-method: Uhferret_lib::IntVector.resize
  6418. call-seq:
  6419. resize(new_size)
  6420. resize(new_size, x)
  6421. Resize the size of the IntVector.
  6422. */
  6423. SWIGINTERN VALUE
  6424. _wrap_IntVector_resize__SWIG_1(int argc, VALUE *argv, VALUE self) {
  6425. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  6426. std::vector< int >::size_type arg2 ;
  6427. std::vector< int >::value_type *arg3 = 0 ;
  6428. void *argp1 = 0 ;
  6429. int res1 = 0 ;
  6430. size_t val2 ;
  6431. int ecode2 = 0 ;
  6432. std::vector< int >::value_type temp3 ;
  6433. int val3 ;
  6434. int ecode3 = 0 ;
  6435. if ((argc < 2) || (argc > 2)) {
  6436. rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  6437. }
  6438. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  6439. if (!SWIG_IsOK(res1)) {
  6440. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","resize", 1, self ));
  6441. }
  6442. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  6443. ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  6444. if (!SWIG_IsOK(ecode2)) {
  6445. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::size_type","resize", 2, argv[0] ));
  6446. }
  6447. arg2 = static_cast< std::vector< int >::size_type >(val2);
  6448. ecode3 = SWIG_AsVal_int(argv[1], &val3);
  6449. if (!SWIG_IsOK(ecode3)) {
  6450. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< int >::value_type","resize", 3, argv[1] ));
  6451. }
  6452. temp3 = static_cast< std::vector< int >::value_type >(val3);
  6453. arg3 = &temp3;
  6454. (arg1)->resize(arg2,(std::vector< int >::value_type const &)*arg3);
  6455. return Qnil;
  6456. fail:
  6457. return Qnil;
  6458. }
  6459. SWIGINTERN VALUE _wrap_IntVector_resize(int nargs, VALUE *args, VALUE self) {
  6460. int argc;
  6461. VALUE argv[4];
  6462. int ii;
  6463. argc = nargs + 1;
  6464. argv[0] = self;
  6465. if (argc > 4) SWIG_fail;
  6466. for (ii = 1; (ii < argc); ++ii) {
  6467. argv[ii] = args[ii-1];
  6468. }
  6469. if (argc == 2) {
  6470. int _v;
  6471. int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
  6472. _v = SWIG_CheckState(res);
  6473. if (_v) {
  6474. {
  6475. int res = SWIG_AsVal_size_t(argv[1], NULL);
  6476. _v = SWIG_CheckState(res);
  6477. }
  6478. if (_v) {
  6479. return _wrap_IntVector_resize__SWIG_0(nargs, args, self);
  6480. }
  6481. }
  6482. }
  6483. if (argc == 3) {
  6484. int _v;
  6485. int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
  6486. _v = SWIG_CheckState(res);
  6487. if (_v) {
  6488. {
  6489. int res = SWIG_AsVal_size_t(argv[1], NULL);
  6490. _v = SWIG_CheckState(res);
  6491. }
  6492. if (_v) {
  6493. {
  6494. int res = SWIG_AsVal_int(argv[2], NULL);
  6495. _v = SWIG_CheckState(res);
  6496. }
  6497. if (_v) {
  6498. return _wrap_IntVector_resize__SWIG_1(nargs, args, self);
  6499. }
  6500. }
  6501. }
  6502. }
  6503. fail:
  6504. Ruby_Format_OverloadedError( argc, 4, "IntVector.resize",
  6505. " void IntVector.resize(std::vector< int >::size_type new_size)\n"
  6506. " void IntVector.resize(std::vector< int >::size_type new_size, std::vector< int >::value_type const &x)\n");
  6507. return Qnil;
  6508. }
  6509. /*
  6510. Document-method: Uhferret_lib::IntVector.insert
  6511. call-seq:
  6512. insert(pos, argc, ?) -> IntVector
  6513. insert(pos, x) -> iterator
  6514. insert(pos, n, x)
  6515. Insert one or more new elements in the IntVector.
  6516. */
  6517. SWIGINTERN VALUE
  6518. _wrap_IntVector_insert__SWIG_1(int argc, VALUE *argv, VALUE self) {
  6519. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  6520. std::vector< int >::iterator arg2 ;
  6521. std::vector< int >::value_type *arg3 = 0 ;
  6522. void *argp1 = 0 ;
  6523. int res1 = 0 ;
  6524. swig::Iterator *iter2 = 0 ;
  6525. int res2 ;
  6526. std::vector< int >::value_type temp3 ;
  6527. int val3 ;
  6528. int ecode3 = 0 ;
  6529. std::vector< int >::iterator result;
  6530. VALUE vresult = Qnil;
  6531. if ((argc < 2) || (argc > 2)) {
  6532. rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  6533. }
  6534. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  6535. if (!SWIG_IsOK(res1)) {
  6536. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","insert", 1, self ));
  6537. }
  6538. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  6539. res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0);
  6540. if (!SWIG_IsOK(res2) || !iter2) {
  6541. SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","insert", 2, argv[0] ));
  6542. } else {
  6543. swig::Iterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter2);
  6544. if (iter_t) {
  6545. arg2 = iter_t->get_current();
  6546. } else {
  6547. SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","insert", 2, argv[0] ));
  6548. }
  6549. }
  6550. ecode3 = SWIG_AsVal_int(argv[1], &val3);
  6551. if (!SWIG_IsOK(ecode3)) {
  6552. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< int >::value_type","insert", 3, argv[1] ));
  6553. }
  6554. temp3 = static_cast< std::vector< int >::value_type >(val3);
  6555. arg3 = &temp3;
  6556. result = (arg1)->insert(arg2,(std::vector< int >::value_type const &)*arg3);
  6557. vresult = SWIG_NewPointerObj(swig::make_nonconst_iterator(static_cast< const std::vector< int >::iterator & >(result),
  6558. self),
  6559. swig::Iterator::descriptor(),SWIG_POINTER_OWN);
  6560. return vresult;
  6561. fail:
  6562. return Qnil;
  6563. }
  6564. SWIGINTERN VALUE
  6565. _wrap_IntVector_insert__SWIG_2(int argc, VALUE *argv, VALUE self) {
  6566. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  6567. std::vector< int >::iterator arg2 ;
  6568. std::vector< int >::size_type arg3 ;
  6569. std::vector< int >::value_type *arg4 = 0 ;
  6570. void *argp1 = 0 ;
  6571. int res1 = 0 ;
  6572. swig::Iterator *iter2 = 0 ;
  6573. int res2 ;
  6574. size_t val3 ;
  6575. int ecode3 = 0 ;
  6576. std::vector< int >::value_type temp4 ;
  6577. int val4 ;
  6578. int ecode4 = 0 ;
  6579. if ((argc < 3) || (argc > 3)) {
  6580. rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  6581. }
  6582. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  6583. if (!SWIG_IsOK(res1)) {
  6584. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","insert", 1, self ));
  6585. }
  6586. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  6587. res2 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&iter2), swig::Iterator::descriptor(), 0);
  6588. if (!SWIG_IsOK(res2) || !iter2) {
  6589. SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","insert", 2, argv[0] ));
  6590. } else {
  6591. swig::Iterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter2);
  6592. if (iter_t) {
  6593. arg2 = iter_t->get_current();
  6594. } else {
  6595. SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), Ruby_Format_TypeError( "", "std::vector< int >::iterator","insert", 2, argv[0] ));
  6596. }
  6597. }
  6598. ecode3 = SWIG_AsVal_size_t(argv[1], &val3);
  6599. if (!SWIG_IsOK(ecode3)) {
  6600. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::vector< int >::size_type","insert", 3, argv[1] ));
  6601. }
  6602. arg3 = static_cast< std::vector< int >::size_type >(val3);
  6603. ecode4 = SWIG_AsVal_int(argv[2], &val4);
  6604. if (!SWIG_IsOK(ecode4)) {
  6605. SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "std::vector< int >::value_type","insert", 4, argv[2] ));
  6606. }
  6607. temp4 = static_cast< std::vector< int >::value_type >(val4);
  6608. arg4 = &temp4;
  6609. (arg1)->insert(arg2,arg3,(std::vector< int >::value_type const &)*arg4);
  6610. return Qnil;
  6611. fail:
  6612. return Qnil;
  6613. }
  6614. SWIGINTERN VALUE _wrap_IntVector_insert(int nargs, VALUE *args, VALUE self) {
  6615. int argc;
  6616. VALUE argv[5];
  6617. int ii;
  6618. argc = nargs + 1;
  6619. argv[0] = self;
  6620. if (argc > 5) SWIG_fail;
  6621. for (ii = 1; (ii < argc); ++ii) {
  6622. argv[ii] = args[ii-1];
  6623. }
  6624. if (argc == 3) {
  6625. int _v;
  6626. int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
  6627. _v = SWIG_CheckState(res);
  6628. if (_v) {
  6629. swig::ConstIterator *iter = 0;
  6630. int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter),
  6631. swig::Iterator::descriptor(), 0);
  6632. _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter) != 0));
  6633. if (_v) {
  6634. {
  6635. int res = SWIG_AsVal_int(argv[2], NULL);
  6636. _v = SWIG_CheckState(res);
  6637. }
  6638. if (_v) {
  6639. return _wrap_IntVector_insert__SWIG_1(nargs, args, self);
  6640. }
  6641. }
  6642. }
  6643. }
  6644. if (argc == 3) {
  6645. int _v;
  6646. int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
  6647. _v = SWIG_CheckState(res);
  6648. if (_v) {
  6649. {
  6650. int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
  6651. _v = SWIG_CheckState(res);
  6652. }
  6653. if (_v) {
  6654. {
  6655. int res = SWIG_AsVal_int(argv[2], NULL);
  6656. _v = SWIG_CheckState(res);
  6657. }
  6658. if (_v) {
  6659. if (argc <= 3) {
  6660. return _wrap_IntVector_insert__SWIG_0(nargs, args, self);
  6661. }
  6662. return _wrap_IntVector_insert__SWIG_0(nargs, args, self);
  6663. }
  6664. }
  6665. }
  6666. }
  6667. if (argc == 4) {
  6668. int _v;
  6669. int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
  6670. _v = SWIG_CheckState(res);
  6671. if (_v) {
  6672. swig::ConstIterator *iter = 0;
  6673. int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter),
  6674. swig::Iterator::descriptor(), 0);
  6675. _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<std::vector< int >::iterator > *>(iter) != 0));
  6676. if (_v) {
  6677. {
  6678. int res = SWIG_AsVal_size_t(argv[2], NULL);
  6679. _v = SWIG_CheckState(res);
  6680. }
  6681. if (_v) {
  6682. {
  6683. int res = SWIG_AsVal_int(argv[3], NULL);
  6684. _v = SWIG_CheckState(res);
  6685. }
  6686. if (_v) {
  6687. return _wrap_IntVector_insert__SWIG_2(nargs, args, self);
  6688. }
  6689. }
  6690. }
  6691. }
  6692. }
  6693. fail:
  6694. Ruby_Format_OverloadedError( argc, 5, "insert",
  6695. " void insert(std::vector< int >::difference_type pos, int argc, VALUE *argv, ...)\n"
  6696. " void insert(std::vector< int >::iterator pos, std::vector< int >::value_type const &x)\n"
  6697. " void insert(std::vector< int >::iterator pos, std::vector< int >::size_type n, std::vector< int >::value_type const &x)\n");
  6698. return Qnil;
  6699. }
  6700. /*
  6701. Document-method: Uhferret_lib::IntVector.reserve
  6702. call-seq:
  6703. reserve(n)
  6704. Reserve memory in the IntVector for a number of elements.
  6705. */
  6706. SWIGINTERN VALUE
  6707. _wrap_IntVector_reserve(int argc, VALUE *argv, VALUE self) {
  6708. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  6709. std::vector< int >::size_type arg2 ;
  6710. void *argp1 = 0 ;
  6711. int res1 = 0 ;
  6712. size_t val2 ;
  6713. int ecode2 = 0 ;
  6714. if ((argc < 1) || (argc > 1)) {
  6715. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  6716. }
  6717. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  6718. if (!SWIG_IsOK(res1)) {
  6719. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","reserve", 1, self ));
  6720. }
  6721. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  6722. ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  6723. if (!SWIG_IsOK(ecode2)) {
  6724. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::vector< int >::size_type","reserve", 2, argv[0] ));
  6725. }
  6726. arg2 = static_cast< std::vector< int >::size_type >(val2);
  6727. (arg1)->reserve(arg2);
  6728. return Qnil;
  6729. fail:
  6730. return Qnil;
  6731. }
  6732. /*
  6733. Document-method: Uhferret_lib::IntVector.capacity
  6734. call-seq:
  6735. capacity -> size_type
  6736. Reserved capacity of the IntVector.
  6737. */
  6738. SWIGINTERN VALUE
  6739. _wrap_IntVector_capacity(int argc, VALUE *argv, VALUE self) {
  6740. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  6741. void *argp1 = 0 ;
  6742. int res1 = 0 ;
  6743. std::vector< int >::size_type result;
  6744. VALUE vresult = Qnil;
  6745. if ((argc < 0) || (argc > 0)) {
  6746. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  6747. }
  6748. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  6749. if (!SWIG_IsOK(res1)) {
  6750. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > const *","capacity", 1, self ));
  6751. }
  6752. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  6753. result = ((std::vector< int > const *)arg1)->capacity();
  6754. vresult = SWIG_From_size_t(static_cast< size_t >(result));
  6755. return vresult;
  6756. fail:
  6757. return Qnil;
  6758. }
  6759. SWIGINTERN VALUE
  6760. _wrap_IntVector_map_bang(int argc, VALUE *argv, VALUE self) {
  6761. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  6762. void *argp1 = 0 ;
  6763. int res1 = 0 ;
  6764. std::vector< int,std::allocator< int > > *result = 0 ;
  6765. VALUE vresult = Qnil;
  6766. if ((argc < 0) || (argc > 0)) {
  6767. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  6768. }
  6769. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  6770. if (!SWIG_IsOK(res1)) {
  6771. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","map_bang", 1, self ));
  6772. }
  6773. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  6774. result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg__map_bang(arg1);
  6775. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  6776. return vresult;
  6777. fail:
  6778. return Qnil;
  6779. }
  6780. /*
  6781. Document-method: Uhferret_lib::IntVector.__delete__
  6782. call-seq:
  6783. __delete__(val) -> VALUE
  6784. Delete a matching element.
  6785. */
  6786. SWIGINTERN VALUE
  6787. _wrap_IntVector___delete__(int argc, VALUE *argv, VALUE self) {
  6788. std::vector< int > *arg1 = (std::vector< int > *) 0 ;
  6789. int *arg2 = 0 ;
  6790. void *argp1 = 0 ;
  6791. int res1 = 0 ;
  6792. int temp2 ;
  6793. int val2 ;
  6794. int ecode2 = 0 ;
  6795. VALUE result;
  6796. VALUE vresult = Qnil;
  6797. if ((argc < 1) || (argc > 1)) {
  6798. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  6799. }
  6800. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  6801. if (!SWIG_IsOK(res1)) {
  6802. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::vector< int > *","__delete__", 1, self ));
  6803. }
  6804. arg1 = reinterpret_cast< std::vector< int > * >(argp1);
  6805. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  6806. if (!SWIG_IsOK(ecode2)) {
  6807. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","__delete__", 2, argv[0] ));
  6808. }
  6809. temp2 = static_cast< int >(val2);
  6810. arg2 = &temp2;
  6811. result = (VALUE)std_vector_Sl_int_Sg____delete__(arg1,(int const &)*arg2);
  6812. vresult = result;
  6813. return vresult;
  6814. fail:
  6815. return Qnil;
  6816. }
  6817. SWIGINTERN void
  6818. free_std_vector_Sl_int_Sg_(std::vector< int > *arg1) {
  6819. delete arg1;
  6820. }
  6821. swig_class SwigClassDocument;
  6822. SWIGINTERN VALUE
  6823. _wrap_new_Document__SWIG_0(int argc, VALUE *argv, VALUE self) {
  6824. std::string arg1 ;
  6825. Document::DocumentType arg2 ;
  6826. int arg3 ;
  6827. int val2 ;
  6828. int ecode2 = 0 ;
  6829. int val3 ;
  6830. int ecode3 = 0 ;
  6831. Document *result = 0 ;
  6832. if ((argc < 3) || (argc > 3)) {
  6833. rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  6834. }
  6835. {
  6836. std::string *ptr = (std::string *)0;
  6837. int res = SWIG_AsPtr_std_string(argv[0], &ptr);
  6838. if (!SWIG_IsOK(res) || !ptr) {
  6839. SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), Ruby_Format_TypeError( "", "std::string","Document", 1, argv[0] ));
  6840. }
  6841. arg1 = *ptr;
  6842. if (SWIG_IsNewObj(res)) delete ptr;
  6843. }
  6844. ecode2 = SWIG_AsVal_int(argv[1], &val2);
  6845. if (!SWIG_IsOK(ecode2)) {
  6846. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Document::DocumentType","Document", 2, argv[1] ));
  6847. }
  6848. arg2 = static_cast< Document::DocumentType >(val2);
  6849. ecode3 = SWIG_AsVal_int(argv[2], &val3);
  6850. if (!SWIG_IsOK(ecode3)) {
  6851. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","Document", 3, argv[2] ));
  6852. }
  6853. arg3 = static_cast< int >(val3);
  6854. result = (Document *)new Document(arg1,arg2,arg3);
  6855. DATA_PTR(self) = result;
  6856. return self;
  6857. fail:
  6858. return Qnil;
  6859. }
  6860. SWIGINTERN VALUE
  6861. _wrap_new_Document__SWIG_1(int argc, VALUE *argv, VALUE self) {
  6862. std::string arg1 ;
  6863. Document::DocumentType arg2 ;
  6864. int val2 ;
  6865. int ecode2 = 0 ;
  6866. Document *result = 0 ;
  6867. if ((argc < 2) || (argc > 2)) {
  6868. rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  6869. }
  6870. {
  6871. std::string *ptr = (std::string *)0;
  6872. int res = SWIG_AsPtr_std_string(argv[0], &ptr);
  6873. if (!SWIG_IsOK(res) || !ptr) {
  6874. SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), Ruby_Format_TypeError( "", "std::string","Document", 1, argv[0] ));
  6875. }
  6876. arg1 = *ptr;
  6877. if (SWIG_IsNewObj(res)) delete ptr;
  6878. }
  6879. ecode2 = SWIG_AsVal_int(argv[1], &val2);
  6880. if (!SWIG_IsOK(ecode2)) {
  6881. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Document::DocumentType","Document", 2, argv[1] ));
  6882. }
  6883. arg2 = static_cast< Document::DocumentType >(val2);
  6884. result = (Document *)new Document(arg1,arg2);
  6885. DATA_PTR(self) = result;
  6886. return self;
  6887. fail:
  6888. return Qnil;
  6889. }
  6890. SWIGINTERN VALUE
  6891. _wrap_new_Document__SWIG_2(int argc, VALUE *argv, VALUE self) {
  6892. std::string arg1 ;
  6893. Document *result = 0 ;
  6894. if ((argc < 1) || (argc > 1)) {
  6895. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  6896. }
  6897. {
  6898. std::string *ptr = (std::string *)0;
  6899. int res = SWIG_AsPtr_std_string(argv[0], &ptr);
  6900. if (!SWIG_IsOK(res) || !ptr) {
  6901. SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), Ruby_Format_TypeError( "", "std::string","Document", 1, argv[0] ));
  6902. }
  6903. arg1 = *ptr;
  6904. if (SWIG_IsNewObj(res)) delete ptr;
  6905. }
  6906. result = (Document *)new Document(arg1);
  6907. DATA_PTR(self) = result;
  6908. return self;
  6909. fail:
  6910. return Qnil;
  6911. }
  6912. #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
  6913. SWIGINTERN VALUE
  6914. _wrap_Document_allocate(VALUE self) {
  6915. #else
  6916. SWIGINTERN VALUE
  6917. _wrap_Document_allocate(int argc, VALUE *argv, VALUE self) {
  6918. #endif
  6919. VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Document);
  6920. #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
  6921. rb_obj_call_init(vresult, argc, argv);
  6922. #endif
  6923. return vresult;
  6924. }
  6925. SWIGINTERN VALUE
  6926. _wrap_new_Document__SWIG_3(int argc, VALUE *argv, VALUE self) {
  6927. Document *arg1 = (Document *) 0 ;
  6928. void *argp1 = 0 ;
  6929. int res1 = 0 ;
  6930. Document *result = 0 ;
  6931. if ((argc < 1) || (argc > 1)) {
  6932. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  6933. }
  6934. res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_Document, 0 | 0 );
  6935. if (!SWIG_IsOK(res1)) {
  6936. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document *","Document", 1, argv[0] ));
  6937. }
  6938. arg1 = reinterpret_cast< Document * >(argp1);
  6939. result = (Document *)new Document(arg1);
  6940. DATA_PTR(self) = result;
  6941. return self;
  6942. fail:
  6943. return Qnil;
  6944. }
  6945. SWIGINTERN VALUE _wrap_new_Document(int nargs, VALUE *args, VALUE self) {
  6946. int argc;
  6947. VALUE argv[3];
  6948. int ii;
  6949. argc = nargs;
  6950. if (argc > 3) SWIG_fail;
  6951. for (ii = 0; (ii < argc); ++ii) {
  6952. argv[ii] = args[ii];
  6953. }
  6954. if (argc == 1) {
  6955. int _v;
  6956. void *vptr = 0;
  6957. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Document, 0);
  6958. _v = SWIG_CheckState(res);
  6959. if (_v) {
  6960. return _wrap_new_Document__SWIG_3(nargs, args, self);
  6961. }
  6962. }
  6963. if (argc == 1) {
  6964. int _v;
  6965. int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
  6966. _v = SWIG_CheckState(res);
  6967. if (_v) {
  6968. return _wrap_new_Document__SWIG_2(nargs, args, self);
  6969. }
  6970. }
  6971. if (argc == 2) {
  6972. int _v;
  6973. int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
  6974. _v = SWIG_CheckState(res);
  6975. if (_v) {
  6976. {
  6977. int res = SWIG_AsVal_int(argv[1], NULL);
  6978. _v = SWIG_CheckState(res);
  6979. }
  6980. if (_v) {
  6981. return _wrap_new_Document__SWIG_1(nargs, args, self);
  6982. }
  6983. }
  6984. }
  6985. if (argc == 3) {
  6986. int _v;
  6987. int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
  6988. _v = SWIG_CheckState(res);
  6989. if (_v) {
  6990. {
  6991. int res = SWIG_AsVal_int(argv[1], NULL);
  6992. _v = SWIG_CheckState(res);
  6993. }
  6994. if (_v) {
  6995. {
  6996. int res = SWIG_AsVal_int(argv[2], NULL);
  6997. _v = SWIG_CheckState(res);
  6998. }
  6999. if (_v) {
  7000. return _wrap_new_Document__SWIG_0(nargs, args, self);
  7001. }
  7002. }
  7003. }
  7004. }
  7005. fail:
  7006. Ruby_Format_OverloadedError( argc, 3, "Document.new",
  7007. " Document.new(std::string pathname, Document::DocumentType type, int id)\n"
  7008. " Document.new(std::string pathname, Document::DocumentType type)\n"
  7009. " Document.new(std::string pathname)\n"
  7010. " Document.new(Document *document)\n");
  7011. return Qnil;
  7012. }
  7013. SWIGINTERN VALUE
  7014. _wrap_Document_SetType(int argc, VALUE *argv, VALUE self) {
  7015. Document *arg1 = (Document *) 0 ;
  7016. Document::DocumentType arg2 ;
  7017. void *argp1 = 0 ;
  7018. int res1 = 0 ;
  7019. int val2 ;
  7020. int ecode2 = 0 ;
  7021. if ((argc < 1) || (argc > 1)) {
  7022. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  7023. }
  7024. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7025. if (!SWIG_IsOK(res1)) {
  7026. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document *","SetType", 1, self ));
  7027. }
  7028. arg1 = reinterpret_cast< Document * >(argp1);
  7029. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  7030. if (!SWIG_IsOK(ecode2)) {
  7031. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Document::DocumentType","SetType", 2, argv[0] ));
  7032. }
  7033. arg2 = static_cast< Document::DocumentType >(val2);
  7034. (arg1)->SetType(arg2);
  7035. return Qnil;
  7036. fail:
  7037. return Qnil;
  7038. }
  7039. SWIGINTERN VALUE
  7040. _wrap_Document_IsTextType(int argc, VALUE *argv, VALUE self) {
  7041. Document *arg1 = (Document *) 0 ;
  7042. void *argp1 = 0 ;
  7043. int res1 = 0 ;
  7044. bool result;
  7045. VALUE vresult = Qnil;
  7046. if ((argc < 0) || (argc > 0)) {
  7047. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7048. }
  7049. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7050. if (!SWIG_IsOK(res1)) {
  7051. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document const *","IsTextType", 1, self ));
  7052. }
  7053. arg1 = reinterpret_cast< Document * >(argp1);
  7054. result = (bool)((Document const *)arg1)->IsTextType();
  7055. vresult = SWIG_From_bool(static_cast< bool >(result));
  7056. return vresult;
  7057. fail:
  7058. return Qnil;
  7059. }
  7060. SWIGINTERN VALUE
  7061. _wrap_Document_GetPathname(int argc, VALUE *argv, VALUE self) {
  7062. Document *arg1 = (Document *) 0 ;
  7063. void *argp1 = 0 ;
  7064. int res1 = 0 ;
  7065. std::string result;
  7066. VALUE vresult = Qnil;
  7067. if ((argc < 0) || (argc > 0)) {
  7068. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7069. }
  7070. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7071. if (!SWIG_IsOK(res1)) {
  7072. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document const *","GetPathname", 1, self ));
  7073. }
  7074. arg1 = reinterpret_cast< Document * >(argp1);
  7075. result = ((Document const *)arg1)->GetPathname();
  7076. vresult = SWIG_From_std_string(static_cast< std::string >(result));
  7077. return vresult;
  7078. fail:
  7079. return Qnil;
  7080. }
  7081. SWIGINTERN VALUE
  7082. _wrap_Document_SetPathname(int argc, VALUE *argv, VALUE self) {
  7083. Document *arg1 = (Document *) 0 ;
  7084. std::string arg2 ;
  7085. void *argp1 = 0 ;
  7086. int res1 = 0 ;
  7087. if ((argc < 1) || (argc > 1)) {
  7088. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  7089. }
  7090. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7091. if (!SWIG_IsOK(res1)) {
  7092. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document *","SetPathname", 1, self ));
  7093. }
  7094. arg1 = reinterpret_cast< Document * >(argp1);
  7095. {
  7096. std::string *ptr = (std::string *)0;
  7097. int res = SWIG_AsPtr_std_string(argv[0], &ptr);
  7098. if (!SWIG_IsOK(res) || !ptr) {
  7099. SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), Ruby_Format_TypeError( "", "std::string","SetPathname", 2, argv[0] ));
  7100. }
  7101. arg2 = *ptr;
  7102. if (SWIG_IsNewObj(res)) delete ptr;
  7103. }
  7104. (arg1)->SetPathname(arg2);
  7105. return Qnil;
  7106. fail:
  7107. return Qnil;
  7108. }
  7109. SWIGINTERN VALUE
  7110. _wrap_Document_GetGroupId(int argc, VALUE *argv, VALUE self) {
  7111. Document *arg1 = (Document *) 0 ;
  7112. void *argp1 = 0 ;
  7113. int res1 = 0 ;
  7114. int result;
  7115. VALUE vresult = Qnil;
  7116. if ((argc < 0) || (argc > 0)) {
  7117. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7118. }
  7119. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7120. if (!SWIG_IsOK(res1)) {
  7121. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document const *","GetGroupId", 1, self ));
  7122. }
  7123. arg1 = reinterpret_cast< Document * >(argp1);
  7124. result = (int)((Document const *)arg1)->GetGroupId();
  7125. vresult = SWIG_From_int(static_cast< int >(result));
  7126. return vresult;
  7127. fail:
  7128. return Qnil;
  7129. }
  7130. SWIGINTERN VALUE
  7131. _wrap_Document_SetGroupId(int argc, VALUE *argv, VALUE self) {
  7132. Document *arg1 = (Document *) 0 ;
  7133. int arg2 ;
  7134. void *argp1 = 0 ;
  7135. int res1 = 0 ;
  7136. int val2 ;
  7137. int ecode2 = 0 ;
  7138. if ((argc < 1) || (argc > 1)) {
  7139. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  7140. }
  7141. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7142. if (!SWIG_IsOK(res1)) {
  7143. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document *","SetGroupId", 1, self ));
  7144. }
  7145. arg1 = reinterpret_cast< Document * >(argp1);
  7146. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  7147. if (!SWIG_IsOK(ecode2)) {
  7148. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","SetGroupId", 2, argv[0] ));
  7149. }
  7150. arg2 = static_cast< int >(val2);
  7151. (arg1)->SetGroupId(arg2);
  7152. return Qnil;
  7153. fail:
  7154. return Qnil;
  7155. }
  7156. SWIGINTERN VALUE
  7157. _wrap_Document_GetTrigramCount(int argc, VALUE *argv, VALUE self) {
  7158. Document *arg1 = (Document *) 0 ;
  7159. void *argp1 = 0 ;
  7160. int res1 = 0 ;
  7161. int result;
  7162. VALUE vresult = Qnil;
  7163. if ((argc < 0) || (argc > 0)) {
  7164. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7165. }
  7166. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7167. if (!SWIG_IsOK(res1)) {
  7168. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document const *","GetTrigramCount", 1, self ));
  7169. }
  7170. arg1 = reinterpret_cast< Document * >(argp1);
  7171. result = (int)((Document const *)arg1)->GetTrigramCount();
  7172. vresult = SWIG_From_int(static_cast< int >(result));
  7173. return vresult;
  7174. fail:
  7175. return Qnil;
  7176. }
  7177. SWIGINTERN VALUE
  7178. _wrap_Document_SetTrigramCount(int argc, VALUE *argv, VALUE self) {
  7179. Document *arg1 = (Document *) 0 ;
  7180. int arg2 ;
  7181. void *argp1 = 0 ;
  7182. int res1 = 0 ;
  7183. int val2 ;
  7184. int ecode2 = 0 ;
  7185. if ((argc < 1) || (argc > 1)) {
  7186. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  7187. }
  7188. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7189. if (!SWIG_IsOK(res1)) {
  7190. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document *","SetTrigramCount", 1, self ));
  7191. }
  7192. arg1 = reinterpret_cast< Document * >(argp1);
  7193. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  7194. if (!SWIG_IsOK(ecode2)) {
  7195. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","SetTrigramCount", 2, argv[0] ));
  7196. }
  7197. arg2 = static_cast< int >(val2);
  7198. (arg1)->SetTrigramCount(arg2);
  7199. return Qnil;
  7200. fail:
  7201. return Qnil;
  7202. }
  7203. SWIGINTERN VALUE
  7204. _wrap_Document_ResetTrigramCount(int argc, VALUE *argv, VALUE self) {
  7205. Document *arg1 = (Document *) 0 ;
  7206. void *argp1 = 0 ;
  7207. int res1 = 0 ;
  7208. if ((argc < 0) || (argc > 0)) {
  7209. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7210. }
  7211. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7212. if (!SWIG_IsOK(res1)) {
  7213. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document *","ResetTrigramCount", 1, self ));
  7214. }
  7215. arg1 = reinterpret_cast< Document * >(argp1);
  7216. (arg1)->ResetTrigramCount();
  7217. return Qnil;
  7218. fail:
  7219. return Qnil;
  7220. }
  7221. SWIGINTERN VALUE
  7222. _wrap_Document_IncrementTrigramCount(int argc, VALUE *argv, VALUE self) {
  7223. Document *arg1 = (Document *) 0 ;
  7224. void *argp1 = 0 ;
  7225. int res1 = 0 ;
  7226. if ((argc < 0) || (argc > 0)) {
  7227. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7228. }
  7229. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7230. if (!SWIG_IsOK(res1)) {
  7231. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document *","IncrementTrigramCount", 1, self ));
  7232. }
  7233. arg1 = reinterpret_cast< Document * >(argp1);
  7234. (arg1)->IncrementTrigramCount();
  7235. return Qnil;
  7236. fail:
  7237. return Qnil;
  7238. }
  7239. SWIGINTERN VALUE
  7240. _wrap_Document_StartInput__SWIG_0(int argc, VALUE *argv, VALUE self) {
  7241. Document *arg1 = (Document *) 0 ;
  7242. TokenSet *arg2 = 0 ;
  7243. void *argp1 = 0 ;
  7244. int res1 = 0 ;
  7245. void *argp2 = 0 ;
  7246. int res2 = 0 ;
  7247. bool result;
  7248. VALUE vresult = Qnil;
  7249. if ((argc < 1) || (argc > 1)) {
  7250. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  7251. }
  7252. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7253. if (!SWIG_IsOK(res1)) {
  7254. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document *","StartInput", 1, self ));
  7255. }
  7256. arg1 = reinterpret_cast< Document * >(argp1);
  7257. res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_TokenSet, 0 );
  7258. if (!SWIG_IsOK(res2)) {
  7259. SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "TokenSet &","StartInput", 2, argv[0] ));
  7260. }
  7261. if (!argp2) {
  7262. SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "TokenSet &","StartInput", 2, argv[0]));
  7263. }
  7264. arg2 = reinterpret_cast< TokenSet * >(argp2);
  7265. result = (bool)(arg1)->StartInput(*arg2);
  7266. vresult = SWIG_From_bool(static_cast< bool >(result));
  7267. return vresult;
  7268. fail:
  7269. return Qnil;
  7270. }
  7271. SWIGINTERN VALUE
  7272. _wrap_Document_StartInput__SWIG_1(int argc, VALUE *argv, VALUE self) {
  7273. Document *arg1 = (Document *) 0 ;
  7274. std::istream *arg2 = 0 ;
  7275. TokenSet *arg3 = 0 ;
  7276. void *argp1 = 0 ;
  7277. int res1 = 0 ;
  7278. void *argp2 = 0 ;
  7279. int res2 = 0 ;
  7280. void *argp3 = 0 ;
  7281. int res3 = 0 ;
  7282. bool result;
  7283. VALUE vresult = Qnil;
  7284. if ((argc < 2) || (argc > 2)) {
  7285. rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  7286. }
  7287. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7288. if (!SWIG_IsOK(res1)) {
  7289. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document *","StartInput", 1, self ));
  7290. }
  7291. arg1 = reinterpret_cast< Document * >(argp1);
  7292. res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__istream, 0 );
  7293. if (!SWIG_IsOK(res2)) {
  7294. SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::istream &","StartInput", 2, argv[0] ));
  7295. }
  7296. if (!argp2) {
  7297. SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::istream &","StartInput", 2, argv[0]));
  7298. }
  7299. arg2 = reinterpret_cast< std::istream * >(argp2);
  7300. res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_TokenSet, 0 );
  7301. if (!SWIG_IsOK(res3)) {
  7302. SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "TokenSet &","StartInput", 3, argv[1] ));
  7303. }
  7304. if (!argp3) {
  7305. SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "TokenSet &","StartInput", 3, argv[1]));
  7306. }
  7307. arg3 = reinterpret_cast< TokenSet * >(argp3);
  7308. result = (bool)(arg1)->StartInput(*arg2,*arg3);
  7309. vresult = SWIG_From_bool(static_cast< bool >(result));
  7310. return vresult;
  7311. fail:
  7312. return Qnil;
  7313. }
  7314. SWIGINTERN VALUE _wrap_Document_StartInput(int nargs, VALUE *args, VALUE self) {
  7315. int argc;
  7316. VALUE argv[4];
  7317. int ii;
  7318. argc = nargs + 1;
  7319. argv[0] = self;
  7320. if (argc > 4) SWIG_fail;
  7321. for (ii = 1; (ii < argc); ++ii) {
  7322. argv[ii] = args[ii-1];
  7323. }
  7324. if (argc == 2) {
  7325. int _v;
  7326. void *vptr = 0;
  7327. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Document, 0);
  7328. _v = SWIG_CheckState(res);
  7329. if (_v) {
  7330. void *vptr = 0;
  7331. int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_TokenSet, 0);
  7332. _v = SWIG_CheckState(res);
  7333. if (_v) {
  7334. return _wrap_Document_StartInput__SWIG_0(nargs, args, self);
  7335. }
  7336. }
  7337. }
  7338. if (argc == 3) {
  7339. int _v;
  7340. void *vptr = 0;
  7341. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Document, 0);
  7342. _v = SWIG_CheckState(res);
  7343. if (_v) {
  7344. void *vptr = 0;
  7345. int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__istream, 0);
  7346. _v = SWIG_CheckState(res);
  7347. if (_v) {
  7348. void *vptr = 0;
  7349. int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_TokenSet, 0);
  7350. _v = SWIG_CheckState(res);
  7351. if (_v) {
  7352. return _wrap_Document_StartInput__SWIG_1(nargs, args, self);
  7353. }
  7354. }
  7355. }
  7356. }
  7357. fail:
  7358. Ruby_Format_OverloadedError( argc, 4, "Document.StartInput",
  7359. " bool Document.StartInput(TokenSet &tokenset)\n"
  7360. " bool Document.StartInput(std::istream &input, TokenSet &tokenset)\n");
  7361. return Qnil;
  7362. }
  7363. SWIGINTERN VALUE
  7364. _wrap_Document_ReadTrigram(int argc, VALUE *argv, VALUE self) {
  7365. Document *arg1 = (Document *) 0 ;
  7366. TokenSet *arg2 = 0 ;
  7367. void *argp1 = 0 ;
  7368. int res1 = 0 ;
  7369. void *argp2 = 0 ;
  7370. int res2 = 0 ;
  7371. bool result;
  7372. VALUE vresult = Qnil;
  7373. if ((argc < 1) || (argc > 1)) {
  7374. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  7375. }
  7376. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7377. if (!SWIG_IsOK(res1)) {
  7378. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document *","ReadTrigram", 1, self ));
  7379. }
  7380. arg1 = reinterpret_cast< Document * >(argp1);
  7381. res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_TokenSet, 0 );
  7382. if (!SWIG_IsOK(res2)) {
  7383. SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "TokenSet &","ReadTrigram", 2, argv[0] ));
  7384. }
  7385. if (!argp2) {
  7386. SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "TokenSet &","ReadTrigram", 2, argv[0]));
  7387. }
  7388. arg2 = reinterpret_cast< TokenSet * >(argp2);
  7389. result = (bool)(arg1)->ReadTrigram(*arg2);
  7390. vresult = SWIG_From_bool(static_cast< bool >(result));
  7391. return vresult;
  7392. fail:
  7393. return Qnil;
  7394. }
  7395. SWIGINTERN VALUE
  7396. _wrap_Document_GetToken(int argc, VALUE *argv, VALUE self) {
  7397. Document *arg1 = (Document *) 0 ;
  7398. int arg2 ;
  7399. void *argp1 = 0 ;
  7400. int res1 = 0 ;
  7401. int val2 ;
  7402. int ecode2 = 0 ;
  7403. std::size_t result;
  7404. VALUE vresult = Qnil;
  7405. if ((argc < 1) || (argc > 1)) {
  7406. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  7407. }
  7408. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7409. if (!SWIG_IsOK(res1)) {
  7410. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document const *","GetToken", 1, self ));
  7411. }
  7412. arg1 = reinterpret_cast< Document * >(argp1);
  7413. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  7414. if (!SWIG_IsOK(ecode2)) {
  7415. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","GetToken", 2, argv[0] ));
  7416. }
  7417. arg2 = static_cast< int >(val2);
  7418. result = ((Document const *)arg1)->GetToken(arg2);
  7419. vresult = SWIG_From_size_t(static_cast< size_t >(result));
  7420. return vresult;
  7421. fail:
  7422. return Qnil;
  7423. }
  7424. SWIGINTERN VALUE
  7425. _wrap_Document_GetTrigramStart__SWIG_0(int argc, VALUE *argv, VALUE self) {
  7426. Document *arg1 = (Document *) 0 ;
  7427. void *argp1 = 0 ;
  7428. int res1 = 0 ;
  7429. std::size_t result;
  7430. VALUE vresult = Qnil;
  7431. if ((argc < 0) || (argc > 0)) {
  7432. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7433. }
  7434. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7435. if (!SWIG_IsOK(res1)) {
  7436. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document const *","GetTrigramStart", 1, self ));
  7437. }
  7438. arg1 = reinterpret_cast< Document * >(argp1);
  7439. result = ((Document const *)arg1)->GetTrigramStart();
  7440. vresult = SWIG_From_size_t(static_cast< size_t >(result));
  7441. return vresult;
  7442. fail:
  7443. return Qnil;
  7444. }
  7445. SWIGINTERN VALUE
  7446. _wrap_Document_GetTrigramStart__SWIG_1(int argc, VALUE *argv, VALUE self) {
  7447. Document *arg1 = (Document *) 0 ;
  7448. int arg2 ;
  7449. void *argp1 = 0 ;
  7450. int res1 = 0 ;
  7451. int val2 ;
  7452. int ecode2 = 0 ;
  7453. std::size_t result;
  7454. VALUE vresult = Qnil;
  7455. if ((argc < 1) || (argc > 1)) {
  7456. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  7457. }
  7458. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7459. if (!SWIG_IsOK(res1)) {
  7460. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document const *","GetTrigramStart", 1, self ));
  7461. }
  7462. arg1 = reinterpret_cast< Document * >(argp1);
  7463. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  7464. if (!SWIG_IsOK(ecode2)) {
  7465. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","GetTrigramStart", 2, argv[0] ));
  7466. }
  7467. arg2 = static_cast< int >(val2);
  7468. result = ((Document const *)arg1)->GetTrigramStart(arg2);
  7469. vresult = SWIG_From_size_t(static_cast< size_t >(result));
  7470. return vresult;
  7471. fail:
  7472. return Qnil;
  7473. }
  7474. SWIGINTERN VALUE _wrap_Document_GetTrigramStart(int nargs, VALUE *args, VALUE self) {
  7475. int argc;
  7476. VALUE argv[3];
  7477. int ii;
  7478. argc = nargs + 1;
  7479. argv[0] = self;
  7480. if (argc > 3) SWIG_fail;
  7481. for (ii = 1; (ii < argc); ++ii) {
  7482. argv[ii] = args[ii-1];
  7483. }
  7484. if (argc == 1) {
  7485. int _v;
  7486. void *vptr = 0;
  7487. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Document, 0);
  7488. _v = SWIG_CheckState(res);
  7489. if (_v) {
  7490. return _wrap_Document_GetTrigramStart__SWIG_0(nargs, args, self);
  7491. }
  7492. }
  7493. if (argc == 2) {
  7494. int _v;
  7495. void *vptr = 0;
  7496. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Document, 0);
  7497. _v = SWIG_CheckState(res);
  7498. if (_v) {
  7499. {
  7500. int res = SWIG_AsVal_int(argv[1], NULL);
  7501. _v = SWIG_CheckState(res);
  7502. }
  7503. if (_v) {
  7504. return _wrap_Document_GetTrigramStart__SWIG_1(nargs, args, self);
  7505. }
  7506. }
  7507. }
  7508. fail:
  7509. Ruby_Format_OverloadedError( argc, 3, "Document.GetTrigramStart",
  7510. " std::size_t Document.GetTrigramStart()\n"
  7511. " std::size_t Document.GetTrigramStart(int i)\n");
  7512. return Qnil;
  7513. }
  7514. SWIGINTERN VALUE
  7515. _wrap_Document_GetTrigramEnd(int argc, VALUE *argv, VALUE self) {
  7516. Document *arg1 = (Document *) 0 ;
  7517. void *argp1 = 0 ;
  7518. int res1 = 0 ;
  7519. std::size_t result;
  7520. VALUE vresult = Qnil;
  7521. if ((argc < 0) || (argc > 0)) {
  7522. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7523. }
  7524. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7525. if (!SWIG_IsOK(res1)) {
  7526. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document const *","GetTrigramEnd", 1, self ));
  7527. }
  7528. arg1 = reinterpret_cast< Document * >(argp1);
  7529. result = ((Document const *)arg1)->GetTrigramEnd();
  7530. vresult = SWIG_From_size_t(static_cast< size_t >(result));
  7531. return vresult;
  7532. fail:
  7533. return Qnil;
  7534. }
  7535. SWIGINTERN VALUE
  7536. _wrap_Document_CloseInput(int argc, VALUE *argv, VALUE self) {
  7537. Document *arg1 = (Document *) 0 ;
  7538. void *argp1 = 0 ;
  7539. int res1 = 0 ;
  7540. if ((argc < 0) || (argc > 0)) {
  7541. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7542. }
  7543. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7544. if (!SWIG_IsOK(res1)) {
  7545. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document *","CloseInput", 1, self ));
  7546. }
  7547. arg1 = reinterpret_cast< Document * >(argp1);
  7548. (arg1)->CloseInput();
  7549. return Qnil;
  7550. fail:
  7551. return Qnil;
  7552. }
  7553. SWIGINTERN VALUE
  7554. _wrap_Document_IsCodeType(int argc, VALUE *argv, VALUE self) {
  7555. Document *arg1 = (Document *) 0 ;
  7556. void *argp1 = 0 ;
  7557. int res1 = 0 ;
  7558. bool result;
  7559. VALUE vresult = Qnil;
  7560. if ((argc < 0) || (argc > 0)) {
  7561. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7562. }
  7563. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7564. if (!SWIG_IsOK(res1)) {
  7565. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document const *","IsCodeType", 1, self ));
  7566. }
  7567. arg1 = reinterpret_cast< Document * >(argp1);
  7568. result = (bool)((Document const *)arg1)->IsCodeType();
  7569. vresult = SWIG_From_bool(static_cast< bool >(result));
  7570. return vresult;
  7571. fail:
  7572. return Qnil;
  7573. }
  7574. SWIGINTERN VALUE
  7575. _wrap_Document_IsTxtType(int argc, VALUE *argv, VALUE self) {
  7576. Document *arg1 = (Document *) 0 ;
  7577. void *argp1 = 0 ;
  7578. int res1 = 0 ;
  7579. bool result;
  7580. VALUE vresult = Qnil;
  7581. if ((argc < 0) || (argc > 0)) {
  7582. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7583. }
  7584. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7585. if (!SWIG_IsOK(res1)) {
  7586. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document const *","IsTxtType", 1, self ));
  7587. }
  7588. arg1 = reinterpret_cast< Document * >(argp1);
  7589. result = (bool)((Document const *)arg1)->IsTxtType();
  7590. vresult = SWIG_From_bool(static_cast< bool >(result));
  7591. return vresult;
  7592. fail:
  7593. return Qnil;
  7594. }
  7595. SWIGINTERN VALUE
  7596. _wrap_Document_IsUnknownType(int argc, VALUE *argv, VALUE self) {
  7597. Document *arg1 = (Document *) 0 ;
  7598. void *argp1 = 0 ;
  7599. int res1 = 0 ;
  7600. bool result;
  7601. VALUE vresult = Qnil;
  7602. if ((argc < 0) || (argc > 0)) {
  7603. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7604. }
  7605. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Document, 0 | 0 );
  7606. if (!SWIG_IsOK(res1)) {
  7607. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Document const *","IsUnknownType", 1, self ));
  7608. }
  7609. arg1 = reinterpret_cast< Document * >(argp1);
  7610. result = (bool)((Document const *)arg1)->IsUnknownType();
  7611. vresult = SWIG_From_bool(static_cast< bool >(result));
  7612. return vresult;
  7613. fail:
  7614. return Qnil;
  7615. }
  7616. SWIGINTERN void
  7617. free_Document(Document *arg1) {
  7618. delete arg1;
  7619. }
  7620. swig_class SwigClassDocumentList;
  7621. #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
  7622. SWIGINTERN VALUE
  7623. _wrap_DocumentList_allocate(VALUE self) {
  7624. #else
  7625. SWIGINTERN VALUE
  7626. _wrap_DocumentList_allocate(int argc, VALUE *argv, VALUE self) {
  7627. #endif
  7628. VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_DocumentList);
  7629. #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
  7630. rb_obj_call_init(vresult, argc, argv);
  7631. #endif
  7632. return vresult;
  7633. }
  7634. SWIGINTERN VALUE
  7635. _wrap_new_DocumentList(int argc, VALUE *argv, VALUE self) {
  7636. DocumentList *result = 0 ;
  7637. if ((argc < 0) || (argc > 0)) {
  7638. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7639. }
  7640. result = (DocumentList *)new DocumentList();
  7641. DATA_PTR(self) = result;
  7642. return self;
  7643. fail:
  7644. return Qnil;
  7645. }
  7646. SWIGINTERN void
  7647. free_DocumentList(DocumentList *arg1) {
  7648. delete arg1;
  7649. }
  7650. SWIGINTERN VALUE
  7651. _wrap_DocumentList_AddDocument__SWIG_0(int argc, VALUE *argv, VALUE self) {
  7652. DocumentList *arg1 = (DocumentList *) 0 ;
  7653. std::string arg2 ;
  7654. Document::DocumentType arg3 ;
  7655. void *argp1 = 0 ;
  7656. int res1 = 0 ;
  7657. int val3 ;
  7658. int ecode3 = 0 ;
  7659. if ((argc < 2) || (argc > 2)) {
  7660. rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  7661. }
  7662. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  7663. if (!SWIG_IsOK(res1)) {
  7664. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","AddDocument", 1, self ));
  7665. }
  7666. arg1 = reinterpret_cast< DocumentList * >(argp1);
  7667. {
  7668. std::string *ptr = (std::string *)0;
  7669. int res = SWIG_AsPtr_std_string(argv[0], &ptr);
  7670. if (!SWIG_IsOK(res) || !ptr) {
  7671. SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), Ruby_Format_TypeError( "", "std::string","AddDocument", 2, argv[0] ));
  7672. }
  7673. arg2 = *ptr;
  7674. if (SWIG_IsNewObj(res)) delete ptr;
  7675. }
  7676. ecode3 = SWIG_AsVal_int(argv[1], &val3);
  7677. if (!SWIG_IsOK(ecode3)) {
  7678. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Document::DocumentType","AddDocument", 3, argv[1] ));
  7679. }
  7680. arg3 = static_cast< Document::DocumentType >(val3);
  7681. (arg1)->AddDocument(arg2,arg3);
  7682. return Qnil;
  7683. fail:
  7684. return Qnil;
  7685. }
  7686. SWIGINTERN VALUE
  7687. _wrap_DocumentList_AddDocument__SWIG_1(int argc, VALUE *argv, VALUE self) {
  7688. DocumentList *arg1 = (DocumentList *) 0 ;
  7689. std::string arg2 ;
  7690. void *argp1 = 0 ;
  7691. int res1 = 0 ;
  7692. if ((argc < 1) || (argc > 1)) {
  7693. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  7694. }
  7695. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  7696. if (!SWIG_IsOK(res1)) {
  7697. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","AddDocument", 1, self ));
  7698. }
  7699. arg1 = reinterpret_cast< DocumentList * >(argp1);
  7700. {
  7701. std::string *ptr = (std::string *)0;
  7702. int res = SWIG_AsPtr_std_string(argv[0], &ptr);
  7703. if (!SWIG_IsOK(res) || !ptr) {
  7704. SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), Ruby_Format_TypeError( "", "std::string","AddDocument", 2, argv[0] ));
  7705. }
  7706. arg2 = *ptr;
  7707. if (SWIG_IsNewObj(res)) delete ptr;
  7708. }
  7709. (arg1)->AddDocument(arg2);
  7710. return Qnil;
  7711. fail:
  7712. return Qnil;
  7713. }
  7714. SWIGINTERN VALUE
  7715. _wrap_DocumentList_AddDocument__SWIG_2(int argc, VALUE *argv, VALUE self) {
  7716. DocumentList *arg1 = (DocumentList *) 0 ;
  7717. std::string arg2 ;
  7718. Document::DocumentType arg3 ;
  7719. int arg4 ;
  7720. void *argp1 = 0 ;
  7721. int res1 = 0 ;
  7722. int val3 ;
  7723. int ecode3 = 0 ;
  7724. int val4 ;
  7725. int ecode4 = 0 ;
  7726. if ((argc < 3) || (argc > 3)) {
  7727. rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  7728. }
  7729. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  7730. if (!SWIG_IsOK(res1)) {
  7731. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","AddDocument", 1, self ));
  7732. }
  7733. arg1 = reinterpret_cast< DocumentList * >(argp1);
  7734. {
  7735. std::string *ptr = (std::string *)0;
  7736. int res = SWIG_AsPtr_std_string(argv[0], &ptr);
  7737. if (!SWIG_IsOK(res) || !ptr) {
  7738. SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), Ruby_Format_TypeError( "", "std::string","AddDocument", 2, argv[0] ));
  7739. }
  7740. arg2 = *ptr;
  7741. if (SWIG_IsNewObj(res)) delete ptr;
  7742. }
  7743. ecode3 = SWIG_AsVal_int(argv[1], &val3);
  7744. if (!SWIG_IsOK(ecode3)) {
  7745. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Document::DocumentType","AddDocument", 3, argv[1] ));
  7746. }
  7747. arg3 = static_cast< Document::DocumentType >(val3);
  7748. ecode4 = SWIG_AsVal_int(argv[2], &val4);
  7749. if (!SWIG_IsOK(ecode4)) {
  7750. SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","AddDocument", 4, argv[2] ));
  7751. }
  7752. arg4 = static_cast< int >(val4);
  7753. (arg1)->AddDocument(arg2,arg3,arg4);
  7754. return Qnil;
  7755. fail:
  7756. return Qnil;
  7757. }
  7758. SWIGINTERN VALUE _wrap_DocumentList_AddDocument(int nargs, VALUE *args, VALUE self) {
  7759. int argc;
  7760. VALUE argv[5];
  7761. int ii;
  7762. argc = nargs + 1;
  7763. argv[0] = self;
  7764. if (argc > 5) SWIG_fail;
  7765. for (ii = 1; (ii < argc); ++ii) {
  7766. argv[ii] = args[ii-1];
  7767. }
  7768. if (argc == 2) {
  7769. int _v;
  7770. void *vptr = 0;
  7771. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_DocumentList, 0);
  7772. _v = SWIG_CheckState(res);
  7773. if (_v) {
  7774. int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
  7775. _v = SWIG_CheckState(res);
  7776. if (_v) {
  7777. return _wrap_DocumentList_AddDocument__SWIG_1(nargs, args, self);
  7778. }
  7779. }
  7780. }
  7781. if (argc == 3) {
  7782. int _v;
  7783. void *vptr = 0;
  7784. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_DocumentList, 0);
  7785. _v = SWIG_CheckState(res);
  7786. if (_v) {
  7787. int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
  7788. _v = SWIG_CheckState(res);
  7789. if (_v) {
  7790. {
  7791. int res = SWIG_AsVal_int(argv[2], NULL);
  7792. _v = SWIG_CheckState(res);
  7793. }
  7794. if (_v) {
  7795. return _wrap_DocumentList_AddDocument__SWIG_0(nargs, args, self);
  7796. }
  7797. }
  7798. }
  7799. }
  7800. if (argc == 4) {
  7801. int _v;
  7802. void *vptr = 0;
  7803. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_DocumentList, 0);
  7804. _v = SWIG_CheckState(res);
  7805. if (_v) {
  7806. int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
  7807. _v = SWIG_CheckState(res);
  7808. if (_v) {
  7809. {
  7810. int res = SWIG_AsVal_int(argv[2], NULL);
  7811. _v = SWIG_CheckState(res);
  7812. }
  7813. if (_v) {
  7814. {
  7815. int res = SWIG_AsVal_int(argv[3], NULL);
  7816. _v = SWIG_CheckState(res);
  7817. }
  7818. if (_v) {
  7819. return _wrap_DocumentList_AddDocument__SWIG_2(nargs, args, self);
  7820. }
  7821. }
  7822. }
  7823. }
  7824. }
  7825. fail:
  7826. Ruby_Format_OverloadedError( argc, 5, "DocumentList.AddDocument",
  7827. " void DocumentList.AddDocument(std::string pathname, Document::DocumentType type)\n"
  7828. " void DocumentList.AddDocument(std::string pathname)\n"
  7829. " void DocumentList.AddDocument(std::string pathname, Document::DocumentType type, int id)\n");
  7830. return Qnil;
  7831. }
  7832. SWIGINTERN VALUE
  7833. _wrap_DocumentList_getDocument(int argc, VALUE *argv, VALUE self) {
  7834. DocumentList *arg1 = (DocumentList *) 0 ;
  7835. std::size_t arg2 ;
  7836. void *argp1 = 0 ;
  7837. int res1 = 0 ;
  7838. size_t val2 ;
  7839. int ecode2 = 0 ;
  7840. Document *result = 0 ;
  7841. VALUE vresult = Qnil;
  7842. if ((argc < 1) || (argc > 1)) {
  7843. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  7844. }
  7845. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  7846. if (!SWIG_IsOK(res1)) {
  7847. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList const *","getDocument", 1, self ));
  7848. }
  7849. arg1 = reinterpret_cast< DocumentList * >(argp1);
  7850. ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  7851. if (!SWIG_IsOK(ecode2)) {
  7852. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::size_t","getDocument", 2, argv[0] ));
  7853. }
  7854. arg2 = static_cast< std::size_t >(val2);
  7855. result = (Document *)((DocumentList const *)arg1)->getDocument(arg2);
  7856. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Document, 0 | 0 );
  7857. return vresult;
  7858. fail:
  7859. return Qnil;
  7860. }
  7861. SWIGINTERN VALUE
  7862. _wrap_DocumentList_RemoveDocument(int argc, VALUE *argv, VALUE self) {
  7863. DocumentList *arg1 = (DocumentList *) 0 ;
  7864. Document *arg2 = (Document *) 0 ;
  7865. void *argp1 = 0 ;
  7866. int res1 = 0 ;
  7867. void *argp2 = 0 ;
  7868. int res2 = 0 ;
  7869. if ((argc < 1) || (argc > 1)) {
  7870. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  7871. }
  7872. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  7873. if (!SWIG_IsOK(res1)) {
  7874. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","RemoveDocument", 1, self ));
  7875. }
  7876. arg1 = reinterpret_cast< DocumentList * >(argp1);
  7877. res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_Document, 0 | 0 );
  7878. if (!SWIG_IsOK(res2)) {
  7879. SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Document *","RemoveDocument", 2, argv[0] ));
  7880. }
  7881. arg2 = reinterpret_cast< Document * >(argp2);
  7882. (arg1)->RemoveDocument(arg2);
  7883. return Qnil;
  7884. fail:
  7885. return Qnil;
  7886. }
  7887. SWIGINTERN VALUE
  7888. _wrap_DocumentList_GetTokenSet(int argc, VALUE *argv, VALUE self) {
  7889. DocumentList *arg1 = (DocumentList *) 0 ;
  7890. void *argp1 = 0 ;
  7891. int res1 = 0 ;
  7892. TokenSet *result = 0 ;
  7893. VALUE vresult = Qnil;
  7894. if ((argc < 0) || (argc > 0)) {
  7895. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7896. }
  7897. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  7898. if (!SWIG_IsOK(res1)) {
  7899. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","GetTokenSet", 1, self ));
  7900. }
  7901. arg1 = reinterpret_cast< DocumentList * >(argp1);
  7902. result = (TokenSet *) &(arg1)->GetTokenSet();
  7903. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_TokenSet, 0 | 0 );
  7904. return vresult;
  7905. fail:
  7906. return Qnil;
  7907. }
  7908. SWIGINTERN VALUE
  7909. _wrap_DocumentList_GetTupleSet(int argc, VALUE *argv, VALUE self) {
  7910. DocumentList *arg1 = (DocumentList *) 0 ;
  7911. void *argp1 = 0 ;
  7912. int res1 = 0 ;
  7913. TupleSet *result = 0 ;
  7914. VALUE vresult = Qnil;
  7915. if ((argc < 0) || (argc > 0)) {
  7916. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7917. }
  7918. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  7919. if (!SWIG_IsOK(res1)) {
  7920. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","GetTupleSet", 1, self ));
  7921. }
  7922. arg1 = reinterpret_cast< DocumentList * >(argp1);
  7923. result = (TupleSet *) &(arg1)->GetTupleSet();
  7924. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_TupleSet, 0 | 0 );
  7925. return vresult;
  7926. fail:
  7927. return Qnil;
  7928. }
  7929. SWIGINTERN VALUE
  7930. _wrap_DocumentList_Clear(int argc, VALUE *argv, VALUE self) {
  7931. DocumentList *arg1 = (DocumentList *) 0 ;
  7932. void *argp1 = 0 ;
  7933. int res1 = 0 ;
  7934. if ((argc < 0) || (argc > 0)) {
  7935. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7936. }
  7937. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  7938. if (!SWIG_IsOK(res1)) {
  7939. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","Clear", 1, self ));
  7940. }
  7941. arg1 = reinterpret_cast< DocumentList * >(argp1);
  7942. (arg1)->Clear();
  7943. return Qnil;
  7944. fail:
  7945. return Qnil;
  7946. }
  7947. SWIGINTERN VALUE
  7948. _wrap_DocumentList_GetNewGroupId(int argc, VALUE *argv, VALUE self) {
  7949. DocumentList *arg1 = (DocumentList *) 0 ;
  7950. void *argp1 = 0 ;
  7951. int res1 = 0 ;
  7952. int result;
  7953. VALUE vresult = Qnil;
  7954. if ((argc < 0) || (argc > 0)) {
  7955. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7956. }
  7957. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  7958. if (!SWIG_IsOK(res1)) {
  7959. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","GetNewGroupId", 1, self ));
  7960. }
  7961. arg1 = reinterpret_cast< DocumentList * >(argp1);
  7962. result = (int)(arg1)->GetNewGroupId();
  7963. vresult = SWIG_From_int(static_cast< int >(result));
  7964. return vresult;
  7965. fail:
  7966. return Qnil;
  7967. }
  7968. SWIGINTERN VALUE
  7969. _wrap_DocumentList_ResetReading(int argc, VALUE *argv, VALUE self) {
  7970. DocumentList *arg1 = (DocumentList *) 0 ;
  7971. void *argp1 = 0 ;
  7972. int res1 = 0 ;
  7973. if ((argc < 0) || (argc > 0)) {
  7974. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7975. }
  7976. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  7977. if (!SWIG_IsOK(res1)) {
  7978. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","ResetReading", 1, self ));
  7979. }
  7980. arg1 = reinterpret_cast< DocumentList * >(argp1);
  7981. (arg1)->ResetReading();
  7982. return Qnil;
  7983. fail:
  7984. return Qnil;
  7985. }
  7986. SWIGINTERN VALUE
  7987. _wrap_DocumentList_Size(int argc, VALUE *argv, VALUE self) {
  7988. DocumentList *arg1 = (DocumentList *) 0 ;
  7989. void *argp1 = 0 ;
  7990. int res1 = 0 ;
  7991. int result;
  7992. VALUE vresult = Qnil;
  7993. if ((argc < 0) || (argc > 0)) {
  7994. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  7995. }
  7996. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  7997. if (!SWIG_IsOK(res1)) {
  7998. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList const *","Size", 1, self ));
  7999. }
  8000. arg1 = reinterpret_cast< DocumentList * >(argp1);
  8001. result = (int)((DocumentList const *)arg1)->Size();
  8002. vresult = SWIG_From_int(static_cast< int >(result));
  8003. return vresult;
  8004. fail:
  8005. return Qnil;
  8006. }
  8007. SWIGINTERN VALUE
  8008. _wrap_DocumentList_NumberOfPairs(int argc, VALUE *argv, VALUE self) {
  8009. DocumentList *arg1 = (DocumentList *) 0 ;
  8010. void *argp1 = 0 ;
  8011. int res1 = 0 ;
  8012. int result;
  8013. VALUE vresult = Qnil;
  8014. if ((argc < 0) || (argc > 0)) {
  8015. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  8016. }
  8017. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  8018. if (!SWIG_IsOK(res1)) {
  8019. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList const *","NumberOfPairs", 1, self ));
  8020. }
  8021. arg1 = reinterpret_cast< DocumentList * >(argp1);
  8022. result = (int)((DocumentList const *)arg1)->NumberOfPairs();
  8023. vresult = SWIG_From_int(static_cast< int >(result));
  8024. return vresult;
  8025. fail:
  8026. return Qnil;
  8027. }
  8028. SWIGINTERN VALUE
  8029. _wrap_DocumentList_RunFerret__SWIG_0(int argc, VALUE *argv, VALUE self) {
  8030. DocumentList *arg1 = (DocumentList *) 0 ;
  8031. int arg2 ;
  8032. void *argp1 = 0 ;
  8033. int res1 = 0 ;
  8034. int val2 ;
  8035. int ecode2 = 0 ;
  8036. if ((argc < 1) || (argc > 1)) {
  8037. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  8038. }
  8039. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  8040. if (!SWIG_IsOK(res1)) {
  8041. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","RunFerret", 1, self ));
  8042. }
  8043. arg1 = reinterpret_cast< DocumentList * >(argp1);
  8044. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  8045. if (!SWIG_IsOK(ecode2)) {
  8046. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","RunFerret", 2, argv[0] ));
  8047. }
  8048. arg2 = static_cast< int >(val2);
  8049. (arg1)->RunFerret(arg2);
  8050. return Qnil;
  8051. fail:
  8052. return Qnil;
  8053. }
  8054. SWIGINTERN VALUE
  8055. _wrap_DocumentList_RunFerret__SWIG_1(int argc, VALUE *argv, VALUE self) {
  8056. DocumentList *arg1 = (DocumentList *) 0 ;
  8057. void *argp1 = 0 ;
  8058. int res1 = 0 ;
  8059. if ((argc < 0) || (argc > 0)) {
  8060. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  8061. }
  8062. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  8063. if (!SWIG_IsOK(res1)) {
  8064. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","RunFerret", 1, self ));
  8065. }
  8066. arg1 = reinterpret_cast< DocumentList * >(argp1);
  8067. (arg1)->RunFerret();
  8068. return Qnil;
  8069. fail:
  8070. return Qnil;
  8071. }
  8072. SWIGINTERN VALUE _wrap_DocumentList_RunFerret(int nargs, VALUE *args, VALUE self) {
  8073. int argc;
  8074. VALUE argv[3];
  8075. int ii;
  8076. argc = nargs + 1;
  8077. argv[0] = self;
  8078. if (argc > 3) SWIG_fail;
  8079. for (ii = 1; (ii < argc); ++ii) {
  8080. argv[ii] = args[ii-1];
  8081. }
  8082. if (argc == 1) {
  8083. int _v;
  8084. void *vptr = 0;
  8085. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_DocumentList, 0);
  8086. _v = SWIG_CheckState(res);
  8087. if (_v) {
  8088. return _wrap_DocumentList_RunFerret__SWIG_1(nargs, args, self);
  8089. }
  8090. }
  8091. if (argc == 2) {
  8092. int _v;
  8093. void *vptr = 0;
  8094. int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_DocumentList, 0);
  8095. _v = SWIG_CheckState(res);
  8096. if (_v) {
  8097. {
  8098. int res = SWIG_AsVal_int(argv[1], NULL);
  8099. _v = SWIG_CheckState(res);
  8100. }
  8101. if (_v) {
  8102. return _wrap_DocumentList_RunFerret__SWIG_0(nargs, args, self);
  8103. }
  8104. }
  8105. }
  8106. fail:
  8107. Ruby_Format_OverloadedError( argc, 3, "DocumentList.RunFerret",
  8108. " void DocumentList.RunFerret(int first_document)\n"
  8109. " void DocumentList.RunFerret()\n");
  8110. return Qnil;
  8111. }
  8112. SWIGINTERN VALUE
  8113. _wrap_DocumentList_ReadDocument(int argc, VALUE *argv, VALUE self) {
  8114. DocumentList *arg1 = (DocumentList *) 0 ;
  8115. int arg2 ;
  8116. void *argp1 = 0 ;
  8117. int res1 = 0 ;
  8118. int val2 ;
  8119. int ecode2 = 0 ;
  8120. if ((argc < 1) || (argc > 1)) {
  8121. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  8122. }
  8123. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  8124. if (!SWIG_IsOK(res1)) {
  8125. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","ReadDocument", 1, self ));
  8126. }
  8127. arg1 = reinterpret_cast< DocumentList * >(argp1);
  8128. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  8129. if (!SWIG_IsOK(ecode2)) {
  8130. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ReadDocument", 2, argv[0] ));
  8131. }
  8132. arg2 = static_cast< int >(val2);
  8133. (arg1)->ReadDocument(arg2);
  8134. return Qnil;
  8135. fail:
  8136. return Qnil;
  8137. }
  8138. SWIGINTERN VALUE
  8139. _wrap_DocumentList_ClearSimilarities(int argc, VALUE *argv, VALUE self) {
  8140. DocumentList *arg1 = (DocumentList *) 0 ;
  8141. void *argp1 = 0 ;
  8142. int res1 = 0 ;
  8143. if ((argc < 0) || (argc > 0)) {
  8144. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  8145. }
  8146. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  8147. if (!SWIG_IsOK(res1)) {
  8148. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","ClearSimilarities", 1, self ));
  8149. }
  8150. arg1 = reinterpret_cast< DocumentList * >(argp1);
  8151. (arg1)->ClearSimilarities();
  8152. return Qnil;
  8153. fail:
  8154. return Qnil;
  8155. }
  8156. SWIGINTERN VALUE
  8157. _wrap_DocumentList_ComputeSimilarities(int argc, VALUE *argv, VALUE self) {
  8158. DocumentList *arg1 = (DocumentList *) 0 ;
  8159. void *argp1 = 0 ;
  8160. int res1 = 0 ;
  8161. if ((argc < 0) || (argc > 0)) {
  8162. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  8163. }
  8164. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  8165. if (!SWIG_IsOK(res1)) {
  8166. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","ComputeSimilarities", 1, self ));
  8167. }
  8168. arg1 = reinterpret_cast< DocumentList * >(argp1);
  8169. (arg1)->ComputeSimilarities();
  8170. return Qnil;
  8171. fail:
  8172. return Qnil;
  8173. }
  8174. SWIGINTERN VALUE
  8175. _wrap_DocumentList_GetTotalTrigramCount(int argc, VALUE *argv, VALUE self) {
  8176. DocumentList *arg1 = (DocumentList *) 0 ;
  8177. void *argp1 = 0 ;
  8178. int res1 = 0 ;
  8179. int result;
  8180. VALUE vresult = Qnil;
  8181. if ((argc < 0) || (argc > 0)) {
  8182. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  8183. }
  8184. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  8185. if (!SWIG_IsOK(res1)) {
  8186. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","GetTotalTrigramCount", 1, self ));
  8187. }
  8188. arg1 = reinterpret_cast< DocumentList * >(argp1);
  8189. result = (int)(arg1)->GetTotalTrigramCount();
  8190. vresult = SWIG_From_int(static_cast< int >(result));
  8191. return vresult;
  8192. fail:
  8193. return Qnil;
  8194. }
  8195. SWIGINTERN VALUE
  8196. _wrap_DocumentList_CountTrigrams(int argc, VALUE *argv, VALUE self) {
  8197. DocumentList *arg1 = (DocumentList *) 0 ;
  8198. int arg2 ;
  8199. void *argp1 = 0 ;
  8200. int res1 = 0 ;
  8201. int val2 ;
  8202. int ecode2 = 0 ;
  8203. int result;
  8204. VALUE vresult = Qnil;
  8205. if ((argc < 1) || (argc > 1)) {
  8206. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  8207. }
  8208. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  8209. if (!SWIG_IsOK(res1)) {
  8210. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","CountTrigrams", 1, self ));
  8211. }
  8212. arg1 = reinterpret_cast< DocumentList * >(argp1);
  8213. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  8214. if (!SWIG_IsOK(ecode2)) {
  8215. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","CountTrigrams", 2, argv[0] ));
  8216. }
  8217. arg2 = static_cast< int >(val2);
  8218. result = (int)(arg1)->CountTrigrams(arg2);
  8219. vresult = SWIG_From_int(static_cast< int >(result));
  8220. return vresult;
  8221. fail:
  8222. return Qnil;
  8223. }
  8224. SWIGINTERN VALUE
  8225. _wrap_DocumentList_CountMatches(int argc, VALUE *argv, VALUE self) {
  8226. DocumentList *arg1 = (DocumentList *) 0 ;
  8227. int arg2 ;
  8228. int arg3 ;
  8229. void *argp1 = 0 ;
  8230. int res1 = 0 ;
  8231. int val2 ;
  8232. int ecode2 = 0 ;
  8233. int val3 ;
  8234. int ecode3 = 0 ;
  8235. int result;
  8236. VALUE vresult = Qnil;
  8237. if ((argc < 2) || (argc > 2)) {
  8238. rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  8239. }
  8240. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  8241. if (!SWIG_IsOK(res1)) {
  8242. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","CountMatches", 1, self ));
  8243. }
  8244. arg1 = reinterpret_cast< DocumentList * >(argp1);
  8245. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  8246. if (!SWIG_IsOK(ecode2)) {
  8247. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","CountMatches", 2, argv[0] ));
  8248. }
  8249. arg2 = static_cast< int >(val2);
  8250. ecode3 = SWIG_AsVal_int(argv[1], &val3);
  8251. if (!SWIG_IsOK(ecode3)) {
  8252. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","CountMatches", 3, argv[1] ));
  8253. }
  8254. arg3 = static_cast< int >(val3);
  8255. result = (int)(arg1)->CountMatches(arg2,arg3);
  8256. vresult = SWIG_From_int(static_cast< int >(result));
  8257. return vresult;
  8258. fail:
  8259. return Qnil;
  8260. }
  8261. SWIGINTERN VALUE
  8262. _wrap_DocumentList_ComputeResemblance(int argc, VALUE *argv, VALUE self) {
  8263. DocumentList *arg1 = (DocumentList *) 0 ;
  8264. int arg2 ;
  8265. int arg3 ;
  8266. void *argp1 = 0 ;
  8267. int res1 = 0 ;
  8268. int val2 ;
  8269. int ecode2 = 0 ;
  8270. int val3 ;
  8271. int ecode3 = 0 ;
  8272. float result;
  8273. VALUE vresult = Qnil;
  8274. if ((argc < 2) || (argc > 2)) {
  8275. rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  8276. }
  8277. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  8278. if (!SWIG_IsOK(res1)) {
  8279. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","ComputeResemblance", 1, self ));
  8280. }
  8281. arg1 = reinterpret_cast< DocumentList * >(argp1);
  8282. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  8283. if (!SWIG_IsOK(ecode2)) {
  8284. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ComputeResemblance", 2, argv[0] ));
  8285. }
  8286. arg2 = static_cast< int >(val2);
  8287. ecode3 = SWIG_AsVal_int(argv[1], &val3);
  8288. if (!SWIG_IsOK(ecode3)) {
  8289. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","ComputeResemblance", 3, argv[1] ));
  8290. }
  8291. arg3 = static_cast< int >(val3);
  8292. result = (float)(arg1)->ComputeResemblance(arg2,arg3);
  8293. vresult = SWIG_From_float(static_cast< float >(result));
  8294. return vresult;
  8295. fail:
  8296. return Qnil;
  8297. }
  8298. SWIGINTERN VALUE
  8299. _wrap_DocumentList_ComputeContainment(int argc, VALUE *argv, VALUE self) {
  8300. DocumentList *arg1 = (DocumentList *) 0 ;
  8301. int arg2 ;
  8302. int arg3 ;
  8303. void *argp1 = 0 ;
  8304. int res1 = 0 ;
  8305. int val2 ;
  8306. int ecode2 = 0 ;
  8307. int val3 ;
  8308. int ecode3 = 0 ;
  8309. float result;
  8310. VALUE vresult = Qnil;
  8311. if ((argc < 2) || (argc > 2)) {
  8312. rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  8313. }
  8314. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  8315. if (!SWIG_IsOK(res1)) {
  8316. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","ComputeContainment", 1, self ));
  8317. }
  8318. arg1 = reinterpret_cast< DocumentList * >(argp1);
  8319. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  8320. if (!SWIG_IsOK(ecode2)) {
  8321. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ComputeContainment", 2, argv[0] ));
  8322. }
  8323. arg2 = static_cast< int >(val2);
  8324. ecode3 = SWIG_AsVal_int(argv[1], &val3);
  8325. if (!SWIG_IsOK(ecode3)) {
  8326. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","ComputeContainment", 3, argv[1] ));
  8327. }
  8328. arg3 = static_cast< int >(val3);
  8329. result = (float)(arg1)->ComputeContainment(arg2,arg3);
  8330. vresult = SWIG_From_float(static_cast< float >(result));
  8331. return vresult;
  8332. fail:
  8333. return Qnil;
  8334. }
  8335. SWIGINTERN VALUE
  8336. _wrap_DocumentList_IsMatchingTrigram(int argc, VALUE *argv, VALUE self) {
  8337. DocumentList *arg1 = (DocumentList *) 0 ;
  8338. std::size_t arg2 ;
  8339. std::size_t arg3 ;
  8340. std::size_t arg4 ;
  8341. int arg5 ;
  8342. int arg6 ;
  8343. void *argp1 = 0 ;
  8344. int res1 = 0 ;
  8345. size_t val2 ;
  8346. int ecode2 = 0 ;
  8347. size_t val3 ;
  8348. int ecode3 = 0 ;
  8349. size_t val4 ;
  8350. int ecode4 = 0 ;
  8351. int val5 ;
  8352. int ecode5 = 0 ;
  8353. int val6 ;
  8354. int ecode6 = 0 ;
  8355. bool result;
  8356. VALUE vresult = Qnil;
  8357. if ((argc < 5) || (argc > 5)) {
  8358. rb_raise(rb_eArgError, "wrong # of arguments(%d for 5)",argc); SWIG_fail;
  8359. }
  8360. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  8361. if (!SWIG_IsOK(res1)) {
  8362. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","IsMatchingTrigram", 1, self ));
  8363. }
  8364. arg1 = reinterpret_cast< DocumentList * >(argp1);
  8365. ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  8366. if (!SWIG_IsOK(ecode2)) {
  8367. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::size_t","IsMatchingTrigram", 2, argv[0] ));
  8368. }
  8369. arg2 = static_cast< std::size_t >(val2);
  8370. ecode3 = SWIG_AsVal_size_t(argv[1], &val3);
  8371. if (!SWIG_IsOK(ecode3)) {
  8372. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::size_t","IsMatchingTrigram", 3, argv[1] ));
  8373. }
  8374. arg3 = static_cast< std::size_t >(val3);
  8375. ecode4 = SWIG_AsVal_size_t(argv[2], &val4);
  8376. if (!SWIG_IsOK(ecode4)) {
  8377. SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "std::size_t","IsMatchingTrigram", 4, argv[2] ));
  8378. }
  8379. arg4 = static_cast< std::size_t >(val4);
  8380. ecode5 = SWIG_AsVal_int(argv[3], &val5);
  8381. if (!SWIG_IsOK(ecode5)) {
  8382. SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "int","IsMatchingTrigram", 5, argv[3] ));
  8383. }
  8384. arg5 = static_cast< int >(val5);
  8385. ecode6 = SWIG_AsVal_int(argv[4], &val6);
  8386. if (!SWIG_IsOK(ecode6)) {
  8387. SWIG_exception_fail(SWIG_ArgError(ecode6), Ruby_Format_TypeError( "", "int","IsMatchingTrigram", 6, argv[4] ));
  8388. }
  8389. arg6 = static_cast< int >(val6);
  8390. result = (bool)(arg1)->IsMatchingTrigram(arg2,arg3,arg4,arg5,arg6);
  8391. vresult = SWIG_From_bool(static_cast< bool >(result));
  8392. return vresult;
  8393. fail:
  8394. return Qnil;
  8395. }
  8396. SWIGINTERN VALUE
  8397. _wrap_DocumentList_MakeTrigramString(int argc, VALUE *argv, VALUE self) {
  8398. DocumentList *arg1 = (DocumentList *) 0 ;
  8399. std::size_t arg2 ;
  8400. std::size_t arg3 ;
  8401. std::size_t arg4 ;
  8402. void *argp1 = 0 ;
  8403. int res1 = 0 ;
  8404. size_t val2 ;
  8405. int ecode2 = 0 ;
  8406. size_t val3 ;
  8407. int ecode3 = 0 ;
  8408. size_t val4 ;
  8409. int ecode4 = 0 ;
  8410. std::string result;
  8411. VALUE vresult = Qnil;
  8412. if ((argc < 3) || (argc > 3)) {
  8413. rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  8414. }
  8415. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  8416. if (!SWIG_IsOK(res1)) {
  8417. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","MakeTrigramString", 1, self ));
  8418. }
  8419. arg1 = reinterpret_cast< DocumentList * >(argp1);
  8420. ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  8421. if (!SWIG_IsOK(ecode2)) {
  8422. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::size_t","MakeTrigramString", 2, argv[0] ));
  8423. }
  8424. arg2 = static_cast< std::size_t >(val2);
  8425. ecode3 = SWIG_AsVal_size_t(argv[1], &val3);
  8426. if (!SWIG_IsOK(ecode3)) {
  8427. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::size_t","MakeTrigramString", 3, argv[1] ));
  8428. }
  8429. arg3 = static_cast< std::size_t >(val3);
  8430. ecode4 = SWIG_AsVal_size_t(argv[2], &val4);
  8431. if (!SWIG_IsOK(ecode4)) {
  8432. SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "std::size_t","MakeTrigramString", 4, argv[2] ));
  8433. }
  8434. arg4 = static_cast< std::size_t >(val4);
  8435. result = (arg1)->MakeTrigramString(arg2,arg3,arg4);
  8436. vresult = SWIG_From_std_string(static_cast< std::string >(result));
  8437. return vresult;
  8438. fail:
  8439. return Qnil;
  8440. }
  8441. SWIGINTERN VALUE
  8442. _wrap_DocumentList_CollectMatchingTrigrams(int argc, VALUE *argv, VALUE self) {
  8443. DocumentList *arg1 = (DocumentList *) 0 ;
  8444. int arg2 ;
  8445. int arg3 ;
  8446. void *argp1 = 0 ;
  8447. int res1 = 0 ;
  8448. int val2 ;
  8449. int ecode2 = 0 ;
  8450. int val3 ;
  8451. int ecode3 = 0 ;
  8452. SwigValueWrapper< std::vector< std::string,std::allocator< std::string > > > result;
  8453. VALUE vresult = Qnil;
  8454. if ((argc < 2) || (argc > 2)) {
  8455. rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  8456. }
  8457. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DocumentList, 0 | 0 );
  8458. if (!SWIG_IsOK(res1)) {
  8459. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "DocumentList *","CollectMatchingTrigrams", 1, self ));
  8460. }
  8461. arg1 = reinterpret_cast< DocumentList * >(argp1);
  8462. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  8463. if (!SWIG_IsOK(ecode2)) {
  8464. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","CollectMatchingTrigrams", 2, argv[0] ));
  8465. }
  8466. arg2 = static_cast< int >(val2);
  8467. ecode3 = SWIG_AsVal_int(argv[1], &val3);
  8468. if (!SWIG_IsOK(ecode3)) {
  8469. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","CollectMatchingTrigrams", 3, argv[1] ));
  8470. }
  8471. arg3 = static_cast< int >(val3);
  8472. result = (arg1)->CollectMatchingTrigrams(arg2,arg3);
  8473. vresult = SWIG_NewPointerObj((new std::vector< std::string,std::allocator< std::string > >(static_cast< const std::vector< std::string,std::allocator< std::string > >& >(result))), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_OWN | 0 );
  8474. return vresult;
  8475. fail:
  8476. return Qnil;
  8477. }
  8478. swig_class SwigClassTupleSet;
  8479. #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
  8480. SWIGINTERN VALUE
  8481. _wrap_TupleSet_allocate(VALUE self) {
  8482. #else
  8483. SWIGINTERN VALUE
  8484. _wrap_TupleSet_allocate(int argc, VALUE *argv, VALUE self) {
  8485. #endif
  8486. VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_TupleSet);
  8487. #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
  8488. rb_obj_call_init(vresult, argc, argv);
  8489. #endif
  8490. return vresult;
  8491. }
  8492. SWIGINTERN VALUE
  8493. _wrap_new_TupleSet(int argc, VALUE *argv, VALUE self) {
  8494. TupleSet *result = 0 ;
  8495. if ((argc < 0) || (argc > 0)) {
  8496. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  8497. }
  8498. result = (TupleSet *)new TupleSet();
  8499. DATA_PTR(self) = result;
  8500. return self;
  8501. fail:
  8502. return Qnil;
  8503. }
  8504. SWIGINTERN VALUE
  8505. _wrap_TupleSet_Clear(int argc, VALUE *argv, VALUE self) {
  8506. TupleSet *arg1 = (TupleSet *) 0 ;
  8507. void *argp1 = 0 ;
  8508. int res1 = 0 ;
  8509. if ((argc < 0) || (argc > 0)) {
  8510. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  8511. }
  8512. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TupleSet, 0 | 0 );
  8513. if (!SWIG_IsOK(res1)) {
  8514. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TupleSet *","Clear", 1, self ));
  8515. }
  8516. arg1 = reinterpret_cast< TupleSet * >(argp1);
  8517. (arg1)->Clear();
  8518. return Qnil;
  8519. fail:
  8520. return Qnil;
  8521. }
  8522. SWIGINTERN VALUE
  8523. _wrap_TupleSet_Size(int argc, VALUE *argv, VALUE self) {
  8524. TupleSet *arg1 = (TupleSet *) 0 ;
  8525. void *argp1 = 0 ;
  8526. int res1 = 0 ;
  8527. int result;
  8528. VALUE vresult = Qnil;
  8529. if ((argc < 0) || (argc > 0)) {
  8530. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  8531. }
  8532. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TupleSet, 0 | 0 );
  8533. if (!SWIG_IsOK(res1)) {
  8534. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TupleSet *","Size", 1, self ));
  8535. }
  8536. arg1 = reinterpret_cast< TupleSet * >(argp1);
  8537. result = (int)(arg1)->Size();
  8538. vresult = SWIG_From_int(static_cast< int >(result));
  8539. return vresult;
  8540. fail:
  8541. return Qnil;
  8542. }
  8543. SWIGINTERN VALUE
  8544. _wrap_TupleSet_GetDocumentsForTuple(int argc, VALUE *argv, VALUE self) {
  8545. TupleSet *arg1 = (TupleSet *) 0 ;
  8546. std::size_t arg2 ;
  8547. std::size_t arg3 ;
  8548. std::size_t arg4 ;
  8549. void *argp1 = 0 ;
  8550. int res1 = 0 ;
  8551. size_t val2 ;
  8552. int ecode2 = 0 ;
  8553. size_t val3 ;
  8554. int ecode3 = 0 ;
  8555. size_t val4 ;
  8556. int ecode4 = 0 ;
  8557. std::vector< int,std::allocator< int > > *result = 0 ;
  8558. VALUE vresult = Qnil;
  8559. if ((argc < 3) || (argc > 3)) {
  8560. rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  8561. }
  8562. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TupleSet, 0 | 0 );
  8563. if (!SWIG_IsOK(res1)) {
  8564. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TupleSet *","GetDocumentsForTuple", 1, self ));
  8565. }
  8566. arg1 = reinterpret_cast< TupleSet * >(argp1);
  8567. ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  8568. if (!SWIG_IsOK(ecode2)) {
  8569. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::size_t","GetDocumentsForTuple", 2, argv[0] ));
  8570. }
  8571. arg2 = static_cast< std::size_t >(val2);
  8572. ecode3 = SWIG_AsVal_size_t(argv[1], &val3);
  8573. if (!SWIG_IsOK(ecode3)) {
  8574. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::size_t","GetDocumentsForTuple", 3, argv[1] ));
  8575. }
  8576. arg3 = static_cast< std::size_t >(val3);
  8577. ecode4 = SWIG_AsVal_size_t(argv[2], &val4);
  8578. if (!SWIG_IsOK(ecode4)) {
  8579. SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "std::size_t","GetDocumentsForTuple", 4, argv[2] ));
  8580. }
  8581. arg4 = static_cast< std::size_t >(val4);
  8582. result = (std::vector< int,std::allocator< int > > *) &(arg1)->GetDocumentsForTuple(arg2,arg3,arg4);
  8583. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  8584. return vresult;
  8585. fail:
  8586. return Qnil;
  8587. }
  8588. SWIGINTERN VALUE
  8589. _wrap_TupleSet_AddDocument(int argc, VALUE *argv, VALUE self) {
  8590. TupleSet *arg1 = (TupleSet *) 0 ;
  8591. std::size_t arg2 ;
  8592. std::size_t arg3 ;
  8593. std::size_t arg4 ;
  8594. int arg5 ;
  8595. void *argp1 = 0 ;
  8596. int res1 = 0 ;
  8597. size_t val2 ;
  8598. int ecode2 = 0 ;
  8599. size_t val3 ;
  8600. int ecode3 = 0 ;
  8601. size_t val4 ;
  8602. int ecode4 = 0 ;
  8603. int val5 ;
  8604. int ecode5 = 0 ;
  8605. bool result;
  8606. VALUE vresult = Qnil;
  8607. if ((argc < 4) || (argc > 4)) {
  8608. rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
  8609. }
  8610. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TupleSet, 0 | 0 );
  8611. if (!SWIG_IsOK(res1)) {
  8612. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TupleSet *","AddDocument", 1, self ));
  8613. }
  8614. arg1 = reinterpret_cast< TupleSet * >(argp1);
  8615. ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  8616. if (!SWIG_IsOK(ecode2)) {
  8617. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::size_t","AddDocument", 2, argv[0] ));
  8618. }
  8619. arg2 = static_cast< std::size_t >(val2);
  8620. ecode3 = SWIG_AsVal_size_t(argv[1], &val3);
  8621. if (!SWIG_IsOK(ecode3)) {
  8622. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::size_t","AddDocument", 3, argv[1] ));
  8623. }
  8624. arg3 = static_cast< std::size_t >(val3);
  8625. ecode4 = SWIG_AsVal_size_t(argv[2], &val4);
  8626. if (!SWIG_IsOK(ecode4)) {
  8627. SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "std::size_t","AddDocument", 4, argv[2] ));
  8628. }
  8629. arg4 = static_cast< std::size_t >(val4);
  8630. ecode5 = SWIG_AsVal_int(argv[3], &val5);
  8631. if (!SWIG_IsOK(ecode5)) {
  8632. SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "int","AddDocument", 5, argv[3] ));
  8633. }
  8634. arg5 = static_cast< int >(val5);
  8635. result = (bool)(arg1)->AddDocument(arg2,arg3,arg4,arg5);
  8636. vresult = SWIG_From_bool(static_cast< bool >(result));
  8637. return vresult;
  8638. fail:
  8639. return Qnil;
  8640. }
  8641. SWIGINTERN VALUE
  8642. _wrap_TupleSet_IsMatchingTuple(int argc, VALUE *argv, VALUE self) {
  8643. TupleSet *arg1 = (TupleSet *) 0 ;
  8644. std::size_t arg2 ;
  8645. std::size_t arg3 ;
  8646. std::size_t arg4 ;
  8647. int arg5 ;
  8648. int arg6 ;
  8649. void *argp1 = 0 ;
  8650. int res1 = 0 ;
  8651. size_t val2 ;
  8652. int ecode2 = 0 ;
  8653. size_t val3 ;
  8654. int ecode3 = 0 ;
  8655. size_t val4 ;
  8656. int ecode4 = 0 ;
  8657. int val5 ;
  8658. int ecode5 = 0 ;
  8659. int val6 ;
  8660. int ecode6 = 0 ;
  8661. bool result;
  8662. VALUE vresult = Qnil;
  8663. if ((argc < 5) || (argc > 5)) {
  8664. rb_raise(rb_eArgError, "wrong # of arguments(%d for 5)",argc); SWIG_fail;
  8665. }
  8666. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TupleSet, 0 | 0 );
  8667. if (!SWIG_IsOK(res1)) {
  8668. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TupleSet *","IsMatchingTuple", 1, self ));
  8669. }
  8670. arg1 = reinterpret_cast< TupleSet * >(argp1);
  8671. ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  8672. if (!SWIG_IsOK(ecode2)) {
  8673. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::size_t","IsMatchingTuple", 2, argv[0] ));
  8674. }
  8675. arg2 = static_cast< std::size_t >(val2);
  8676. ecode3 = SWIG_AsVal_size_t(argv[1], &val3);
  8677. if (!SWIG_IsOK(ecode3)) {
  8678. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "std::size_t","IsMatchingTuple", 3, argv[1] ));
  8679. }
  8680. arg3 = static_cast< std::size_t >(val3);
  8681. ecode4 = SWIG_AsVal_size_t(argv[2], &val4);
  8682. if (!SWIG_IsOK(ecode4)) {
  8683. SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "std::size_t","IsMatchingTuple", 4, argv[2] ));
  8684. }
  8685. arg4 = static_cast< std::size_t >(val4);
  8686. ecode5 = SWIG_AsVal_int(argv[3], &val5);
  8687. if (!SWIG_IsOK(ecode5)) {
  8688. SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "int","IsMatchingTuple", 5, argv[3] ));
  8689. }
  8690. arg5 = static_cast< int >(val5);
  8691. ecode6 = SWIG_AsVal_int(argv[4], &val6);
  8692. if (!SWIG_IsOK(ecode6)) {
  8693. SWIG_exception_fail(SWIG_ArgError(ecode6), Ruby_Format_TypeError( "", "int","IsMatchingTuple", 6, argv[4] ));
  8694. }
  8695. arg6 = static_cast< int >(val6);
  8696. result = (bool)(arg1)->IsMatchingTuple(arg2,arg3,arg4,arg5,arg6);
  8697. vresult = SWIG_From_bool(static_cast< bool >(result));
  8698. return vresult;
  8699. fail:
  8700. return Qnil;
  8701. }
  8702. SWIGINTERN VALUE
  8703. _wrap_TupleSet_CollectMatchingTuples(int argc, VALUE *argv, VALUE self) {
  8704. TupleSet *arg1 = (TupleSet *) 0 ;
  8705. int arg2 ;
  8706. int arg3 ;
  8707. TokenSet *arg4 = 0 ;
  8708. void *argp1 = 0 ;
  8709. int res1 = 0 ;
  8710. int val2 ;
  8711. int ecode2 = 0 ;
  8712. int val3 ;
  8713. int ecode3 = 0 ;
  8714. void *argp4 = 0 ;
  8715. int res4 = 0 ;
  8716. SwigValueWrapper< std::vector< std::string,std::allocator< std::string > > > result;
  8717. VALUE vresult = Qnil;
  8718. if ((argc < 3) || (argc > 3)) {
  8719. rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  8720. }
  8721. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TupleSet, 0 | 0 );
  8722. if (!SWIG_IsOK(res1)) {
  8723. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TupleSet *","CollectMatchingTuples", 1, self ));
  8724. }
  8725. arg1 = reinterpret_cast< TupleSet * >(argp1);
  8726. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  8727. if (!SWIG_IsOK(ecode2)) {
  8728. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","CollectMatchingTuples", 2, argv[0] ));
  8729. }
  8730. arg2 = static_cast< int >(val2);
  8731. ecode3 = SWIG_AsVal_int(argv[1], &val3);
  8732. if (!SWIG_IsOK(ecode3)) {
  8733. SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","CollectMatchingTuples", 3, argv[1] ));
  8734. }
  8735. arg3 = static_cast< int >(val3);
  8736. res4 = SWIG_ConvertPtr(argv[2], &argp4, SWIGTYPE_p_TokenSet, 0 );
  8737. if (!SWIG_IsOK(res4)) {
  8738. SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "TokenSet &","CollectMatchingTuples", 4, argv[2] ));
  8739. }
  8740. if (!argp4) {
  8741. SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "TokenSet &","CollectMatchingTuples", 4, argv[2]));
  8742. }
  8743. arg4 = reinterpret_cast< TokenSet * >(argp4);
  8744. result = (arg1)->CollectMatchingTuples(arg2,arg3,*arg4);
  8745. vresult = SWIG_NewPointerObj((new std::vector< std::string,std::allocator< std::string > >(static_cast< const std::vector< std::string,std::allocator< std::string > >& >(result))), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_OWN | 0 );
  8746. return vresult;
  8747. fail:
  8748. return Qnil;
  8749. }
  8750. SWIGINTERN VALUE
  8751. _wrap_TupleSet_Begin(int argc, VALUE *argv, VALUE self) {
  8752. TupleSet *arg1 = (TupleSet *) 0 ;
  8753. void *argp1 = 0 ;
  8754. int res1 = 0 ;
  8755. if ((argc < 0) || (argc > 0)) {
  8756. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  8757. }
  8758. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TupleSet, 0 | 0 );
  8759. if (!SWIG_IsOK(res1)) {
  8760. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TupleSet *","Begin", 1, self ));
  8761. }
  8762. arg1 = reinterpret_cast< TupleSet * >(argp1);
  8763. (arg1)->Begin();
  8764. return Qnil;
  8765. fail:
  8766. return Qnil;
  8767. }
  8768. SWIGINTERN VALUE
  8769. _wrap_TupleSet_GetNext(int argc, VALUE *argv, VALUE self) {
  8770. TupleSet *arg1 = (TupleSet *) 0 ;
  8771. void *argp1 = 0 ;
  8772. int res1 = 0 ;
  8773. if ((argc < 0) || (argc > 0)) {
  8774. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  8775. }
  8776. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TupleSet, 0 | 0 );
  8777. if (!SWIG_IsOK(res1)) {
  8778. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TupleSet *","GetNext", 1, self ));
  8779. }
  8780. arg1 = reinterpret_cast< TupleSet * >(argp1);
  8781. (arg1)->GetNext();
  8782. return Qnil;
  8783. fail:
  8784. return Qnil;
  8785. }
  8786. SWIGINTERN VALUE
  8787. _wrap_TupleSet_HasMore(int argc, VALUE *argv, VALUE self) {
  8788. TupleSet *arg1 = (TupleSet *) 0 ;
  8789. void *argp1 = 0 ;
  8790. int res1 = 0 ;
  8791. bool result;
  8792. VALUE vresult = Qnil;
  8793. if ((argc < 0) || (argc > 0)) {
  8794. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  8795. }
  8796. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TupleSet, 0 | 0 );
  8797. if (!SWIG_IsOK(res1)) {
  8798. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TupleSet const *","HasMore", 1, self ));
  8799. }
  8800. arg1 = reinterpret_cast< TupleSet * >(argp1);
  8801. result = (bool)((TupleSet const *)arg1)->HasMore();
  8802. vresult = SWIG_From_bool(static_cast< bool >(result));
  8803. return vresult;
  8804. fail:
  8805. return Qnil;
  8806. }
  8807. SWIGINTERN VALUE
  8808. _wrap_TupleSet_GetDocumentsForCurrentTuple(int argc, VALUE *argv, VALUE self) {
  8809. TupleSet *arg1 = (TupleSet *) 0 ;
  8810. void *argp1 = 0 ;
  8811. int res1 = 0 ;
  8812. std::vector< int,std::allocator< int > > *result = 0 ;
  8813. VALUE vresult = Qnil;
  8814. if ((argc < 0) || (argc > 0)) {
  8815. rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  8816. }
  8817. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TupleSet, 0 | 0 );
  8818. if (!SWIG_IsOK(res1)) {
  8819. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TupleSet *","GetDocumentsForCurrentTuple", 1, self ));
  8820. }
  8821. arg1 = reinterpret_cast< TupleSet * >(argp1);
  8822. result = (std::vector< int,std::allocator< int > > *) &(arg1)->GetDocumentsForCurrentTuple();
  8823. vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 );
  8824. return vresult;
  8825. fail:
  8826. return Qnil;
  8827. }
  8828. SWIGINTERN VALUE
  8829. _wrap_TupleSet_GetStringForCurrentTuple(int argc, VALUE *argv, VALUE self) {
  8830. TupleSet *arg1 = (TupleSet *) 0 ;
  8831. TokenSet *arg2 = 0 ;
  8832. void *argp1 = 0 ;
  8833. int res1 = 0 ;
  8834. void *argp2 = 0 ;
  8835. int res2 = 0 ;
  8836. std::string result;
  8837. VALUE vresult = Qnil;
  8838. if ((argc < 1) || (argc > 1)) {
  8839. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  8840. }
  8841. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TupleSet, 0 | 0 );
  8842. if (!SWIG_IsOK(res1)) {
  8843. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TupleSet const *","GetStringForCurrentTuple", 1, self ));
  8844. }
  8845. arg1 = reinterpret_cast< TupleSet * >(argp1);
  8846. res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_TokenSet, 0 );
  8847. if (!SWIG_IsOK(res2)) {
  8848. SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "TokenSet &","GetStringForCurrentTuple", 2, argv[0] ));
  8849. }
  8850. if (!argp2) {
  8851. SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "TokenSet &","GetStringForCurrentTuple", 2, argv[0]));
  8852. }
  8853. arg2 = reinterpret_cast< TokenSet * >(argp2);
  8854. result = ((TupleSet const *)arg1)->GetStringForCurrentTuple(*arg2);
  8855. vresult = SWIG_From_std_string(static_cast< std::string >(result));
  8856. return vresult;
  8857. fail:
  8858. return Qnil;
  8859. }
  8860. SWIGINTERN VALUE
  8861. _wrap_TupleSet_GetToken(int argc, VALUE *argv, VALUE self) {
  8862. TupleSet *arg1 = (TupleSet *) 0 ;
  8863. int arg2 ;
  8864. void *argp1 = 0 ;
  8865. int res1 = 0 ;
  8866. int val2 ;
  8867. int ecode2 = 0 ;
  8868. std::size_t result;
  8869. VALUE vresult = Qnil;
  8870. if ((argc < 1) || (argc > 1)) {
  8871. rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  8872. }
  8873. res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TupleSet, 0 | 0 );
  8874. if (!SWIG_IsOK(res1)) {
  8875. SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TupleSet const *","GetToken", 1, self ));
  8876. }
  8877. arg1 = reinterpret_cast< TupleSet * >(argp1);
  8878. ecode2 = SWIG_AsVal_int(argv[0], &val2);
  8879. if (!SWIG_IsOK(ecode2)) {
  8880. SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","GetToken", 2, argv[0] ));
  8881. }
  8882. arg2 = static_cast< int >(val2);
  8883. result = ((TupleSet const *)arg1)->GetToken(arg2);
  8884. vresult = SWIG_From_size_t(static_cast< size_t >(result));
  8885. return vresult;
  8886. fail:
  8887. return Qnil;
  8888. }
  8889. SWIGINTERN void
  8890. free_TupleSet(TupleSet *arg1) {
  8891. delete arg1;
  8892. }
  8893. /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
  8894. static void *_p_swig__IteratorTo_p_swig__ConstIterator(void *x, int *SWIGUNUSEDPARM(newmemory)) {
  8895. return (void *)((swig::ConstIterator *) ((swig::Iterator *) x));
  8896. }
  8897. static swig_type_info _swigt__p_Document = {"_p_Document", "Document *", 0, 0, (void*)0, 0};
  8898. static swig_type_info _swigt__p_DocumentList = {"_p_DocumentList", "DocumentList *", 0, 0, (void*)0, 0};
  8899. static swig_type_info _swigt__p_TokenSet = {"_p_TokenSet", "TokenSet *", 0, 0, (void*)0, 0};
  8900. static swig_type_info _swigt__p_TupleSet = {"_p_TupleSet", "TupleSet *", 0, 0, (void*)0, 0};
  8901. static swig_type_info _swigt__p_allocator_type = {"_p_allocator_type", "allocator_type *", 0, 0, (void*)0, 0};
  8902. static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
  8903. static swig_type_info _swigt__p_difference_type = {"_p_difference_type", "difference_type *", 0, 0, (void*)0, 0};
  8904. static swig_type_info _swigt__p_p_void = {"_p_p_void", "void **|VALUE *", 0, 0, (void*)0, 0};
  8905. static swig_type_info _swigt__p_size_type = {"_p_size_type", "size_type *", 0, 0, (void*)0, 0};
  8906. static swig_type_info _swigt__p_std__allocatorT_int_t = {"_p_std__allocatorT_int_t", "std::vector< int >::allocator_type *|std::allocator< int > *", 0, 0, (void*)0, 0};
  8907. static swig_type_info _swigt__p_std__istream = {"_p_std__istream", "std::istream *", 0, 0, (void*)0, 0};
  8908. static swig_type_info _swigt__p_std__vectorT_int_std__allocatorT_int_t_t = {"_p_std__vectorT_int_std__allocatorT_int_t_t", "std::vector< int,std::allocator< int > > *|std::vector< int > *", 0, 0, (void*)0, 0};
  8909. static swig_type_info _swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t = {"_p_std__vectorT_std__string_std__allocatorT_std__string_t_t", "std::vector< std::string,std::allocator< std::string > > *", 0, 0, (void*)0, 0};
  8910. static swig_type_info _swigt__p_swig__ConstIterator = {"_p_swig__ConstIterator", "swig::ConstIterator *", 0, 0, (void*)0, 0};
  8911. static swig_type_info _swigt__p_swig__GC_VALUE = {"_p_swig__GC_VALUE", "swig::GC_VALUE *", 0, 0, (void*)0, 0};
  8912. static swig_type_info _swigt__p_swig__Iterator = {"_p_swig__Iterator", "swig::Iterator *", 0, 0, (void*)0, 0};
  8913. static swig_type_info _swigt__p_value_type = {"_p_value_type", "value_type *", 0, 0, (void*)0, 0};
  8914. static swig_type_info _swigt__p_void = {"_p_void", "VALUE|void *", 0, 0, (void*)0, 0};
  8915. static swig_type_info *swig_type_initial[] = {
  8916. &_swigt__p_Document,
  8917. &_swigt__p_DocumentList,
  8918. &_swigt__p_TokenSet,
  8919. &_swigt__p_TupleSet,
  8920. &_swigt__p_allocator_type,
  8921. &_swigt__p_char,
  8922. &_swigt__p_difference_type,
  8923. &_swigt__p_p_void,
  8924. &_swigt__p_size_type,
  8925. &_swigt__p_std__allocatorT_int_t,
  8926. &_swigt__p_std__istream,
  8927. &_swigt__p_std__vectorT_int_std__allocatorT_int_t_t,
  8928. &_swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t,
  8929. &_swigt__p_swig__ConstIterator,
  8930. &_swigt__p_swig__GC_VALUE,
  8931. &_swigt__p_swig__Iterator,
  8932. &_swigt__p_value_type,
  8933. &_swigt__p_void,
  8934. };
  8935. static swig_cast_info _swigc__p_Document[] = { {&_swigt__p_Document, 0, 0, 0},{0, 0, 0, 0}};
  8936. static swig_cast_info _swigc__p_DocumentList[] = { {&_swigt__p_DocumentList, 0, 0, 0},{0, 0, 0, 0}};
  8937. static swig_cast_info _swigc__p_TokenSet[] = { {&_swigt__p_TokenSet, 0, 0, 0},{0, 0, 0, 0}};
  8938. static swig_cast_info _swigc__p_TupleSet[] = { {&_swigt__p_TupleSet, 0, 0, 0},{0, 0, 0, 0}};
  8939. static swig_cast_info _swigc__p_allocator_type[] = { {&_swigt__p_allocator_type, 0, 0, 0},{0, 0, 0, 0}};
  8940. static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
  8941. static swig_cast_info _swigc__p_difference_type[] = { {&_swigt__p_difference_type, 0, 0, 0},{0, 0, 0, 0}};
  8942. static swig_cast_info _swigc__p_p_void[] = { {&_swigt__p_p_void, 0, 0, 0},{0, 0, 0, 0}};
  8943. static swig_cast_info _swigc__p_size_type[] = { {&_swigt__p_size_type, 0, 0, 0},{0, 0, 0, 0}};
  8944. static swig_cast_info _swigc__p_std__allocatorT_int_t[] = { {&_swigt__p_std__allocatorT_int_t, 0, 0, 0},{0, 0, 0, 0}};
  8945. static swig_cast_info _swigc__p_std__istream[] = { {&_swigt__p_std__istream, 0, 0, 0},{0, 0, 0, 0}};
  8946. static swig_cast_info _swigc__p_std__vectorT_int_std__allocatorT_int_t_t[] = { {&_swigt__p_std__vectorT_int_std__allocatorT_int_t_t, 0, 0, 0},{0, 0, 0, 0}};
  8947. static swig_cast_info _swigc__p_std__vectorT_std__string_std__allocatorT_std__string_t_t[] = { {&_swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0, 0, 0},{0, 0, 0, 0}};
  8948. static swig_cast_info _swigc__p_swig__ConstIterator[] = { {&_swigt__p_swig__ConstIterator, 0, 0, 0}, {&_swigt__p_swig__Iterator, _p_swig__IteratorTo_p_swig__ConstIterator, 0, 0},{0, 0, 0, 0}};
  8949. static swig_cast_info _swigc__p_swig__GC_VALUE[] = { {&_swigt__p_swig__GC_VALUE, 0, 0, 0},{0, 0, 0, 0}};
  8950. static swig_cast_info _swigc__p_swig__Iterator[] = { {&_swigt__p_swig__Iterator, 0, 0, 0},{0, 0, 0, 0}};
  8951. static swig_cast_info _swigc__p_value_type[] = { {&_swigt__p_value_type, 0, 0, 0},{0, 0, 0, 0}};
  8952. static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
  8953. static swig_cast_info *swig_cast_initial[] = {
  8954. _swigc__p_Document,
  8955. _swigc__p_DocumentList,
  8956. _swigc__p_TokenSet,
  8957. _swigc__p_TupleSet,
  8958. _swigc__p_allocator_type,
  8959. _swigc__p_char,
  8960. _swigc__p_difference_type,
  8961. _swigc__p_p_void,
  8962. _swigc__p_size_type,
  8963. _swigc__p_std__allocatorT_int_t,
  8964. _swigc__p_std__istream,
  8965. _swigc__p_std__vectorT_int_std__allocatorT_int_t_t,
  8966. _swigc__p_std__vectorT_std__string_std__allocatorT_std__string_t_t,
  8967. _swigc__p_swig__ConstIterator,
  8968. _swigc__p_swig__GC_VALUE,
  8969. _swigc__p_swig__Iterator,
  8970. _swigc__p_value_type,
  8971. _swigc__p_void,
  8972. };
  8973. /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
  8974. /* -----------------------------------------------------------------------------
  8975. * Type initialization:
  8976. * This problem is tough by the requirement that no dynamic
  8977. * memory is used. Also, since swig_type_info structures store pointers to
  8978. * swig_cast_info structures and swig_cast_info structures store pointers back
  8979. * to swig_type_info structures, we need some lookup code at initialization.
  8980. * The idea is that swig generates all the structures that are needed.
  8981. * The runtime then collects these partially filled structures.
  8982. * The SWIG_InitializeModule function takes these initial arrays out of
  8983. * swig_module, and does all the lookup, filling in the swig_module.types
  8984. * array with the correct data and linking the correct swig_cast_info
  8985. * structures together.
  8986. *
  8987. * The generated swig_type_info structures are assigned staticly to an initial
  8988. * array. We just loop through that array, and handle each type individually.
  8989. * First we lookup if this type has been already loaded, and if so, use the
  8990. * loaded structure instead of the generated one. Then we have to fill in the
  8991. * cast linked list. The cast data is initially stored in something like a
  8992. * two-dimensional array. Each row corresponds to a type (there are the same
  8993. * number of rows as there are in the swig_type_initial array). Each entry in
  8994. * a column is one of the swig_cast_info structures for that type.
  8995. * The cast_initial array is actually an array of arrays, because each row has
  8996. * a variable number of columns. So to actually build the cast linked list,
  8997. * we find the array of casts associated with the type, and loop through it
  8998. * adding the casts to the list. The one last trick we need to do is making
  8999. * sure the type pointer in the swig_cast_info struct is correct.
  9000. *
  9001. * First off, we lookup the cast->type name to see if it is already loaded.
  9002. * There are three cases to handle:
  9003. * 1) If the cast->type has already been loaded AND the type we are adding
  9004. * casting info to has not been loaded (it is in this module), THEN we
  9005. * replace the cast->type pointer with the type pointer that has already
  9006. * been loaded.
  9007. * 2) If BOTH types (the one we are adding casting info to, and the
  9008. * cast->type) are loaded, THEN the cast info has already been loaded by
  9009. * the previous module so we just ignore it.
  9010. * 3) Finally, if cast->type has not already been loaded, then we add that
  9011. * swig_cast_info to the linked list (because the cast->type) pointer will
  9012. * be correct.
  9013. * ----------------------------------------------------------------------------- */
  9014. #ifdef __cplusplus
  9015. extern "C" {
  9016. #if 0
  9017. } /* c-mode */
  9018. #endif
  9019. #endif
  9020. #if 0
  9021. #define SWIGRUNTIME_DEBUG
  9022. #endif
  9023. SWIGRUNTIME void
  9024. SWIG_InitializeModule(void *clientdata) {
  9025. size_t i;
  9026. swig_module_info *module_head, *iter;
  9027. int found, init;
  9028. clientdata = clientdata;
  9029. /* check to see if the circular list has been setup, if not, set it up */
  9030. if (swig_module.next==0) {
  9031. /* Initialize the swig_module */
  9032. swig_module.type_initial = swig_type_initial;
  9033. swig_module.cast_initial = swig_cast_initial;
  9034. swig_module.next = &swig_module;
  9035. init = 1;
  9036. } else {
  9037. init = 0;
  9038. }
  9039. /* Try and load any already created modules */
  9040. module_head = SWIG_GetModule(clientdata);
  9041. if (!module_head) {
  9042. /* This is the first module loaded for this interpreter */
  9043. /* so set the swig module into the interpreter */
  9044. SWIG_SetModule(clientdata, &swig_module);
  9045. module_head = &swig_module;
  9046. } else {
  9047. /* the interpreter has loaded a SWIG module, but has it loaded this one? */
  9048. found=0;
  9049. iter=module_head;
  9050. do {
  9051. if (iter==&swig_module) {
  9052. found=1;
  9053. break;
  9054. }
  9055. iter=iter->next;
  9056. } while (iter!= module_head);
  9057. /* if the is found in the list, then all is done and we may leave */
  9058. if (found) return;
  9059. /* otherwise we must add out module into the list */
  9060. swig_module.next = module_head->next;
  9061. module_head->next = &swig_module;
  9062. }
  9063. /* When multiple interpeters are used, a module could have already been initialized in
  9064. a different interpreter, but not yet have a pointer in this interpreter.
  9065. In this case, we do not want to continue adding types... everything should be
  9066. set up already */
  9067. if (init == 0) return;
  9068. /* Now work on filling in swig_module.types */
  9069. #ifdef SWIGRUNTIME_DEBUG
  9070. printf("SWIG_InitializeModule: size %d\n", swig_module.size);
  9071. #endif
  9072. for (i = 0; i < swig_module.size; ++i) {
  9073. swig_type_info *type = 0;
  9074. swig_type_info *ret;
  9075. swig_cast_info *cast;
  9076. #ifdef SWIGRUNTIME_DEBUG
  9077. printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
  9078. #endif
  9079. /* if there is another module already loaded */
  9080. if (swig_module.next != &swig_module) {
  9081. type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
  9082. }
  9083. if (type) {
  9084. /* Overwrite clientdata field */
  9085. #ifdef SWIGRUNTIME_DEBUG
  9086. printf("SWIG_InitializeModule: found type %s\n", type->name);
  9087. #endif
  9088. if (swig_module.type_initial[i]->clientdata) {
  9089. type->clientdata = swig_module.type_initial[i]->clientdata;
  9090. #ifdef SWIGRUNTIME_DEBUG
  9091. printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
  9092. #endif
  9093. }
  9094. } else {
  9095. type = swig_module.type_initial[i];
  9096. }
  9097. /* Insert casting types */
  9098. cast = swig_module.cast_initial[i];
  9099. while (cast->type) {
  9100. /* Don't need to add information already in the list */
  9101. ret = 0;
  9102. #ifdef SWIGRUNTIME_DEBUG
  9103. printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
  9104. #endif
  9105. if (swig_module.next != &swig_module) {
  9106. ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
  9107. #ifdef SWIGRUNTIME_DEBUG
  9108. if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
  9109. #endif
  9110. }
  9111. if (ret) {
  9112. if (type == swig_module.type_initial[i]) {
  9113. #ifdef SWIGRUNTIME_DEBUG
  9114. printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
  9115. #endif
  9116. cast->type = ret;
  9117. ret = 0;
  9118. } else {
  9119. /* Check for casting already in the list */
  9120. swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
  9121. #ifdef SWIGRUNTIME_DEBUG
  9122. if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
  9123. #endif
  9124. if (!ocast) ret = 0;
  9125. }
  9126. }
  9127. if (!ret) {
  9128. #ifdef SWIGRUNTIME_DEBUG
  9129. printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
  9130. #endif
  9131. if (type->cast) {
  9132. type->cast->prev = cast;
  9133. cast->next = type->cast;
  9134. }
  9135. type->cast = cast;
  9136. }
  9137. cast++;
  9138. }
  9139. /* Set entry in modules->types array equal to the type */
  9140. swig_module.types[i] = type;
  9141. }
  9142. swig_module.types[i] = 0;
  9143. #ifdef SWIGRUNTIME_DEBUG
  9144. printf("**** SWIG_InitializeModule: Cast List ******\n");
  9145. for (i = 0; i < swig_module.size; ++i) {
  9146. int j = 0;
  9147. swig_cast_info *cast = swig_module.cast_initial[i];
  9148. printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
  9149. while (cast->type) {
  9150. printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
  9151. cast++;
  9152. ++j;
  9153. }
  9154. printf("---- Total casts: %d\n",j);
  9155. }
  9156. printf("**** SWIG_InitializeModule: Cast List ******\n");
  9157. #endif
  9158. }
  9159. /* This function will propagate the clientdata field of type to
  9160. * any new swig_type_info structures that have been added into the list
  9161. * of equivalent types. It is like calling
  9162. * SWIG_TypeClientData(type, clientdata) a second time.
  9163. */
  9164. SWIGRUNTIME void
  9165. SWIG_PropagateClientData(void) {
  9166. size_t i;
  9167. swig_cast_info *equiv;
  9168. static int init_run = 0;
  9169. if (init_run) return;
  9170. init_run = 1;
  9171. for (i = 0; i < swig_module.size; i++) {
  9172. if (swig_module.types[i]->clientdata) {
  9173. equiv = swig_module.types[i]->cast;
  9174. while (equiv) {
  9175. if (!equiv->converter) {
  9176. if (equiv->type && !equiv->type->clientdata)
  9177. SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
  9178. }
  9179. equiv = equiv->next;
  9180. }
  9181. }
  9182. }
  9183. }
  9184. #ifdef __cplusplus
  9185. #if 0
  9186. { /* c-mode */
  9187. #endif
  9188. }
  9189. #endif
  9190. /*
  9191. */
  9192. #ifdef __cplusplus
  9193. extern "C"
  9194. #endif
  9195. SWIGEXPORT void Init_uhferret_lib(void) {
  9196. size_t i;
  9197. SWIG_InitRuntime();
  9198. mUhferret_lib = rb_define_module("Uhferret_lib");
  9199. SWIG_InitializeModule(0);
  9200. for (i = 0; i < swig_module.size; i++) {
  9201. SWIG_define_class(swig_module.types[i]);
  9202. }
  9203. SWIG_RubyInitializeTrackings();
  9204. SwigClassGC_VALUE.klass = rb_define_class_under(mUhferret_lib, "GC_VALUE", rb_cObject);
  9205. SWIG_TypeClientData(SWIGTYPE_p_swig__GC_VALUE, (void *) &SwigClassGC_VALUE);
  9206. rb_undef_alloc_func(SwigClassGC_VALUE.klass);
  9207. rb_define_method(SwigClassGC_VALUE.klass, "inspect", VALUEFUNC(_wrap_GC_VALUE_inspect), -1);
  9208. rb_define_method(SwigClassGC_VALUE.klass, "to_s", VALUEFUNC(_wrap_GC_VALUE_to_s), -1);
  9209. SwigClassGC_VALUE.mark = 0;
  9210. SwigClassGC_VALUE.trackObjects = 0;
  9211. swig::GC_VALUE::initialize();
  9212. SwigClassConstIterator.klass = rb_define_class_under(mUhferret_lib, "ConstIterator", rb_cObject);
  9213. SWIG_TypeClientData(SWIGTYPE_p_swig__ConstIterator, (void *) &SwigClassConstIterator);
  9214. rb_undef_alloc_func(SwigClassConstIterator.klass);
  9215. rb_define_method(SwigClassConstIterator.klass, "value", VALUEFUNC(_wrap_ConstIterator_value), -1);
  9216. rb_define_method(SwigClassConstIterator.klass, "dup", VALUEFUNC(_wrap_ConstIterator_dup), -1);
  9217. rb_define_method(SwigClassConstIterator.klass, "inspect", VALUEFUNC(_wrap_ConstIterator_inspect), -1);
  9218. rb_define_method(SwigClassConstIterator.klass, "to_s", VALUEFUNC(_wrap_ConstIterator_to_s), -1);
  9219. rb_define_method(SwigClassConstIterator.klass, "next", VALUEFUNC(_wrap_ConstIterator_next), -1);
  9220. rb_define_method(SwigClassConstIterator.klass, "previous", VALUEFUNC(_wrap_ConstIterator_previous), -1);
  9221. rb_define_method(SwigClassConstIterator.klass, "==", VALUEFUNC(_wrap_ConstIterator___eq__), -1);
  9222. rb_define_method(SwigClassConstIterator.klass, "+", VALUEFUNC(_wrap_ConstIterator___add__), -1);
  9223. rb_define_method(SwigClassConstIterator.klass, "-", VALUEFUNC(_wrap_ConstIterator___sub__), -1);
  9224. SwigClassConstIterator.mark = 0;
  9225. SwigClassConstIterator.destroy = (void (*)(void *)) free_swig_ConstIterator;
  9226. SwigClassConstIterator.trackObjects = 0;
  9227. SwigClassIterator.klass = rb_define_class_under(mUhferret_lib, "Iterator", ((swig_class *) SWIGTYPE_p_swig__ConstIterator->clientdata)->klass);
  9228. SWIG_TypeClientData(SWIGTYPE_p_swig__Iterator, (void *) &SwigClassIterator);
  9229. rb_undef_alloc_func(SwigClassIterator.klass);
  9230. rb_define_method(SwigClassIterator.klass, "value=", VALUEFUNC(_wrap_Iterator_valuee___), -1);
  9231. rb_define_method(SwigClassIterator.klass, "dup", VALUEFUNC(_wrap_Iterator_dup), -1);
  9232. rb_define_method(SwigClassIterator.klass, "next", VALUEFUNC(_wrap_Iterator_next), -1);
  9233. rb_define_method(SwigClassIterator.klass, "previous", VALUEFUNC(_wrap_Iterator_previous), -1);
  9234. rb_define_method(SwigClassIterator.klass, "inspect", VALUEFUNC(_wrap_Iterator_inspect), -1);
  9235. rb_define_method(SwigClassIterator.klass, "to_s", VALUEFUNC(_wrap_Iterator_to_s), -1);
  9236. rb_define_method(SwigClassIterator.klass, "==", VALUEFUNC(_wrap_Iterator___eq__), -1);
  9237. rb_define_method(SwigClassIterator.klass, "+", VALUEFUNC(_wrap_Iterator___add__), -1);
  9238. rb_define_method(SwigClassIterator.klass, "-", VALUEFUNC(_wrap_Iterator___sub__), -1);
  9239. SwigClassIterator.mark = 0;
  9240. SwigClassIterator.destroy = (void (*)(void *)) free_swig_Iterator;
  9241. SwigClassIterator.trackObjects = 0;
  9242. SwigClassIntVector.klass = rb_define_class_under(mUhferret_lib, "IntVector", rb_cObject);
  9243. SWIG_TypeClientData(SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, (void *) &SwigClassIntVector);
  9244. rb_include_module(SwigClassIntVector.klass, rb_eval_string("Enumerable"));
  9245. rb_define_alloc_func(SwigClassIntVector.klass, _wrap_IntVector_allocate);
  9246. rb_define_method(SwigClassIntVector.klass, "initialize", VALUEFUNC(_wrap_new_IntVector), -1);
  9247. rb_define_method(SwigClassIntVector.klass, "dup", VALUEFUNC(_wrap_IntVector_dup), -1);
  9248. rb_define_method(SwigClassIntVector.klass, "inspect", VALUEFUNC(_wrap_IntVector_inspect), -1);
  9249. rb_define_method(SwigClassIntVector.klass, "to_a", VALUEFUNC(_wrap_IntVector_to_a), -1);
  9250. rb_define_method(SwigClassIntVector.klass, "to_s", VALUEFUNC(_wrap_IntVector_to_s), -1);
  9251. rb_define_method(SwigClassIntVector.klass, "slice", VALUEFUNC(_wrap_IntVector_slice), -1);
  9252. rb_define_method(SwigClassIntVector.klass, "each", VALUEFUNC(_wrap_IntVector_each), -1);
  9253. rb_define_method(SwigClassIntVector.klass, "select", VALUEFUNC(_wrap_IntVector_select), -1);
  9254. rb_define_method(SwigClassIntVector.klass, "reject!", VALUEFUNC(_wrap_IntVector_rejectN___), -1);
  9255. rb_define_alias(SwigClassIntVector.klass, "delete_if", "reject!");
  9256. rb_define_method(SwigClassIntVector.klass, "delete_at", VALUEFUNC(_wrap_IntVector_delete_at), -1);
  9257. rb_define_method(SwigClassIntVector.klass, "__delete2__", VALUEFUNC(_wrap_IntVector___delete2__), -1);
  9258. rb_define_method(SwigClassIntVector.klass, "pop", VALUEFUNC(_wrap_IntVector_pop), -1);
  9259. rb_define_method(SwigClassIntVector.klass, "push", VALUEFUNC(_wrap_IntVector_push), -1);
  9260. rb_define_alias(SwigClassIntVector.klass, "<<", "push");
  9261. rb_define_method(SwigClassIntVector.klass, "reject", VALUEFUNC(_wrap_IntVector_reject), -1);
  9262. rb_define_method(SwigClassIntVector.klass, "at", VALUEFUNC(_wrap_IntVector_at), -1);
  9263. rb_define_method(SwigClassIntVector.klass, "[]", VALUEFUNC(_wrap_IntVector___getitem__), -1);
  9264. rb_define_method(SwigClassIntVector.klass, "[]=", VALUEFUNC(_wrap_IntVector___setitem__), -1);
  9265. rb_define_method(SwigClassIntVector.klass, "shift", VALUEFUNC(_wrap_IntVector_shift), -1);
  9266. rb_define_method(SwigClassIntVector.klass, "unshift", VALUEFUNC(_wrap_IntVector_unshift), -1);
  9267. rb_define_method(SwigClassIntVector.klass, "empty?", VALUEFUNC(_wrap_IntVector_emptyq___), -1);
  9268. rb_define_method(SwigClassIntVector.klass, "size", VALUEFUNC(_wrap_IntVector_size), -1);
  9269. rb_define_method(SwigClassIntVector.klass, "clear", VALUEFUNC(_wrap_IntVector_clear), -1);
  9270. rb_define_method(SwigClassIntVector.klass, "swap", VALUEFUNC(_wrap_IntVector_swap), -1);
  9271. rb_define_method(SwigClassIntVector.klass, "get_allocator", VALUEFUNC(_wrap_IntVector_get_allocator), -1);
  9272. rb_define_method(SwigClassIntVector.klass, "begin", VALUEFUNC(_wrap_IntVector_begin), -1);
  9273. rb_define_method(SwigClassIntVector.klass, "end", VALUEFUNC(_wrap_IntVector_end), -1);
  9274. rb_define_method(SwigClassIntVector.klass, "rbegin", VALUEFUNC(_wrap_IntVector_rbegin), -1);
  9275. rb_define_method(SwigClassIntVector.klass, "rend", VALUEFUNC(_wrap_IntVector_rend), -1);
  9276. rb_define_method(SwigClassIntVector.klass, "erase", VALUEFUNC(_wrap_IntVector_erase), -1);
  9277. rb_define_method(SwigClassIntVector.klass, "front", VALUEFUNC(_wrap_IntVector_front), -1);
  9278. rb_define_method(SwigClassIntVector.klass, "back", VALUEFUNC(_wrap_IntVector_back), -1);
  9279. rb_define_method(SwigClassIntVector.klass, "assign", VALUEFUNC(_wrap_IntVector_assign), -1);
  9280. rb_define_method(SwigClassIntVector.klass, "resize", VALUEFUNC(_wrap_IntVector_resize), -1);
  9281. rb_define_method(SwigClassIntVector.klass, "insert", VALUEFUNC(_wrap_IntVector_insert), -1);
  9282. rb_define_method(SwigClassIntVector.klass, "reserve", VALUEFUNC(_wrap_IntVector_reserve), -1);
  9283. rb_define_method(SwigClassIntVector.klass, "capacity", VALUEFUNC(_wrap_IntVector_capacity), -1);
  9284. rb_define_method(SwigClassIntVector.klass, "map_bang", VALUEFUNC(_wrap_IntVector_map_bang), -1);
  9285. rb_define_method(SwigClassIntVector.klass, "__delete__", VALUEFUNC(_wrap_IntVector___delete__), -1);
  9286. SwigClassIntVector.mark = 0;
  9287. SwigClassIntVector.destroy = (void (*)(void *)) free_std_vector_Sl_int_Sg_;
  9288. SwigClassIntVector.trackObjects = 0;
  9289. SwigClassDocument.klass = rb_define_class_under(mUhferret_lib, "Document", rb_cObject);
  9290. SWIG_TypeClientData(SWIGTYPE_p_Document, (void *) &SwigClassDocument);
  9291. rb_define_alloc_func(SwigClassDocument.klass, _wrap_Document_allocate);
  9292. rb_define_method(SwigClassDocument.klass, "initialize", VALUEFUNC(_wrap_new_Document), -1);
  9293. rb_define_const(SwigClassDocument.klass, "TypeText", SWIG_From_int(static_cast< int >(Document::TypeText)));
  9294. rb_define_const(SwigClassDocument.klass, "TypeCode", SWIG_From_int(static_cast< int >(Document::TypeCode)));
  9295. rb_define_method(SwigClassDocument.klass, "SetType", VALUEFUNC(_wrap_Document_SetType), -1);
  9296. rb_define_method(SwigClassDocument.klass, "IsTextType", VALUEFUNC(_wrap_Document_IsTextType), -1);
  9297. rb_define_method(SwigClassDocument.klass, "GetPathname", VALUEFUNC(_wrap_Document_GetPathname), -1);
  9298. rb_define_method(SwigClassDocument.klass, "SetPathname", VALUEFUNC(_wrap_Document_SetPathname), -1);
  9299. rb_define_method(SwigClassDocument.klass, "GetGroupId", VALUEFUNC(_wrap_Document_GetGroupId), -1);
  9300. rb_define_method(SwigClassDocument.klass, "SetGroupId", VALUEFUNC(_wrap_Document_SetGroupId), -1);
  9301. rb_define_method(SwigClassDocument.klass, "GetTrigramCount", VALUEFUNC(_wrap_Document_GetTrigramCount), -1);
  9302. rb_define_method(SwigClassDocument.klass, "SetTrigramCount", VALUEFUNC(_wrap_Document_SetTrigramCount), -1);
  9303. rb_define_method(SwigClassDocument.klass, "ResetTrigramCount", VALUEFUNC(_wrap_Document_ResetTrigramCount), -1);
  9304. rb_define_method(SwigClassDocument.klass, "IncrementTrigramCount", VALUEFUNC(_wrap_Document_IncrementTrigramCount), -1);
  9305. rb_define_method(SwigClassDocument.klass, "StartInput", VALUEFUNC(_wrap_Document_StartInput), -1);
  9306. rb_define_method(SwigClassDocument.klass, "ReadTrigram", VALUEFUNC(_wrap_Document_ReadTrigram), -1);
  9307. rb_define_method(SwigClassDocument.klass, "GetToken", VALUEFUNC(_wrap_Document_GetToken), -1);
  9308. rb_define_method(SwigClassDocument.klass, "GetTrigramStart", VALUEFUNC(_wrap_Document_GetTrigramStart), -1);
  9309. rb_define_method(SwigClassDocument.klass, "GetTrigramEnd", VALUEFUNC(_wrap_Document_GetTrigramEnd), -1);
  9310. rb_define_method(SwigClassDocument.klass, "CloseInput", VALUEFUNC(_wrap_Document_CloseInput), -1);
  9311. rb_define_method(SwigClassDocument.klass, "IsCodeType", VALUEFUNC(_wrap_Document_IsCodeType), -1);
  9312. rb_define_method(SwigClassDocument.klass, "IsTxtType", VALUEFUNC(_wrap_Document_IsTxtType), -1);
  9313. rb_define_method(SwigClassDocument.klass, "IsUnknownType", VALUEFUNC(_wrap_Document_IsUnknownType), -1);
  9314. SwigClassDocument.mark = 0;
  9315. SwigClassDocument.destroy = (void (*)(void *)) free_Document;
  9316. SwigClassDocument.trackObjects = 0;
  9317. SwigClassDocumentList.klass = rb_define_class_under(mUhferret_lib, "DocumentList", rb_cObject);
  9318. SWIG_TypeClientData(SWIGTYPE_p_DocumentList, (void *) &SwigClassDocumentList);
  9319. rb_define_alloc_func(SwigClassDocumentList.klass, _wrap_DocumentList_allocate);
  9320. rb_define_method(SwigClassDocumentList.klass, "initialize", VALUEFUNC(_wrap_new_DocumentList), -1);
  9321. rb_define_method(SwigClassDocumentList.klass, "AddDocument", VALUEFUNC(_wrap_DocumentList_AddDocument), -1);
  9322. rb_define_method(SwigClassDocumentList.klass, "getDocument", VALUEFUNC(_wrap_DocumentList_getDocument), -1);
  9323. rb_define_method(SwigClassDocumentList.klass, "RemoveDocument", VALUEFUNC(_wrap_DocumentList_RemoveDocument), -1);
  9324. rb_define_method(SwigClassDocumentList.klass, "GetTokenSet", VALUEFUNC(_wrap_DocumentList_GetTokenSet), -1);
  9325. rb_define_method(SwigClassDocumentList.klass, "GetTupleSet", VALUEFUNC(_wrap_DocumentList_GetTupleSet), -1);
  9326. rb_define_method(SwigClassDocumentList.klass, "Clear", VALUEFUNC(_wrap_DocumentList_Clear), -1);
  9327. rb_define_method(SwigClassDocumentList.klass, "GetNewGroupId", VALUEFUNC(_wrap_DocumentList_GetNewGroupId), -1);
  9328. rb_define_method(SwigClassDocumentList.klass, "ResetReading", VALUEFUNC(_wrap_DocumentList_ResetReading), -1);
  9329. rb_define_method(SwigClassDocumentList.klass, "Size", VALUEFUNC(_wrap_DocumentList_Size), -1);
  9330. rb_define_method(SwigClassDocumentList.klass, "NumberOfPairs", VALUEFUNC(_wrap_DocumentList_NumberOfPairs), -1);
  9331. rb_define_method(SwigClassDocumentList.klass, "RunFerret", VALUEFUNC(_wrap_DocumentList_RunFerret), -1);
  9332. rb_define_method(SwigClassDocumentList.klass, "ReadDocument", VALUEFUNC(_wrap_DocumentList_ReadDocument), -1);
  9333. rb_define_method(SwigClassDocumentList.klass, "ClearSimilarities", VALUEFUNC(_wrap_DocumentList_ClearSimilarities), -1);
  9334. rb_define_method(SwigClassDocumentList.klass, "ComputeSimilarities", VALUEFUNC(_wrap_DocumentList_ComputeSimilarities), -1);
  9335. rb_define_method(SwigClassDocumentList.klass, "GetTotalTrigramCount", VALUEFUNC(_wrap_DocumentList_GetTotalTrigramCount), -1);
  9336. rb_define_method(SwigClassDocumentList.klass, "CountTrigrams", VALUEFUNC(_wrap_DocumentList_CountTrigrams), -1);
  9337. rb_define_method(SwigClassDocumentList.klass, "CountMatches", VALUEFUNC(_wrap_DocumentList_CountMatches), -1);
  9338. rb_define_method(SwigClassDocumentList.klass, "ComputeResemblance", VALUEFUNC(_wrap_DocumentList_ComputeResemblance), -1);
  9339. rb_define_method(SwigClassDocumentList.klass, "ComputeContainment", VALUEFUNC(_wrap_DocumentList_ComputeContainment), -1);
  9340. rb_define_method(SwigClassDocumentList.klass, "IsMatchingTrigram", VALUEFUNC(_wrap_DocumentList_IsMatchingTrigram), -1);
  9341. rb_define_method(SwigClassDocumentList.klass, "MakeTrigramString", VALUEFUNC(_wrap_DocumentList_MakeTrigramString), -1);
  9342. rb_define_method(SwigClassDocumentList.klass, "CollectMatchingTrigrams", VALUEFUNC(_wrap_DocumentList_CollectMatchingTrigrams), -1);
  9343. SwigClassDocumentList.mark = 0;
  9344. SwigClassDocumentList.destroy = (void (*)(void *)) free_DocumentList;
  9345. SwigClassDocumentList.trackObjects = 0;
  9346. SwigClassTupleSet.klass = rb_define_class_under(mUhferret_lib, "TupleSet", rb_cObject);
  9347. SWIG_TypeClientData(SWIGTYPE_p_TupleSet, (void *) &SwigClassTupleSet);
  9348. rb_define_alloc_func(SwigClassTupleSet.klass, _wrap_TupleSet_allocate);
  9349. rb_define_method(SwigClassTupleSet.klass, "initialize", VALUEFUNC(_wrap_new_TupleSet), -1);
  9350. rb_define_method(SwigClassTupleSet.klass, "Clear", VALUEFUNC(_wrap_TupleSet_Clear), -1);
  9351. rb_define_method(SwigClassTupleSet.klass, "Size", VALUEFUNC(_wrap_TupleSet_Size), -1);
  9352. rb_define_method(SwigClassTupleSet.klass, "GetDocumentsForTuple", VALUEFUNC(_wrap_TupleSet_GetDocumentsForTuple), -1);
  9353. rb_define_method(SwigClassTupleSet.klass, "AddDocument", VALUEFUNC(_wrap_TupleSet_AddDocument), -1);
  9354. rb_define_method(SwigClassTupleSet.klass, "IsMatchingTuple", VALUEFUNC(_wrap_TupleSet_IsMatchingTuple), -1);
  9355. rb_define_method(SwigClassTupleSet.klass, "CollectMatchingTuples", VALUEFUNC(_wrap_TupleSet_CollectMatchingTuples), -1);
  9356. rb_define_method(SwigClassTupleSet.klass, "Begin", VALUEFUNC(_wrap_TupleSet_Begin), -1);
  9357. rb_define_method(SwigClassTupleSet.klass, "GetNext", VALUEFUNC(_wrap_TupleSet_GetNext), -1);
  9358. rb_define_method(SwigClassTupleSet.klass, "HasMore", VALUEFUNC(_wrap_TupleSet_HasMore), -1);
  9359. rb_define_method(SwigClassTupleSet.klass, "GetDocumentsForCurrentTuple", VALUEFUNC(_wrap_TupleSet_GetDocumentsForCurrentTuple), -1);
  9360. rb_define_method(SwigClassTupleSet.klass, "GetStringForCurrentTuple", VALUEFUNC(_wrap_TupleSet_GetStringForCurrentTuple), -1);
  9361. rb_define_method(SwigClassTupleSet.klass, "GetToken", VALUEFUNC(_wrap_TupleSet_GetToken), -1);
  9362. SwigClassTupleSet.mark = 0;
  9363. SwigClassTupleSet.destroy = (void (*)(void *)) free_TupleSet;
  9364. SwigClassTupleSet.trackObjects = 0;
  9365. }