ccgo_linux_s390x.go 959 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715
  1. // Code generated for linux/s390x by 'generator --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-macro=m_ --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -I /home/jnml/src/modernc.org/builder/.exclude/modernc.org/libbsd/include/linux/s390x -extended-errors -ignore-unsupported-alignment -ignore-link-errors -lbsd -o libexpat.go --package-name libexpat lib/.libs/libexpat.a', DO NOT EDIT.
  2. //go:build linux && s390x
  3. package libexpat
  4. import (
  5. "reflect"
  6. "unsafe"
  7. "modernc.org/libc"
  8. )
  9. var _ reflect.Type
  10. var _ unsafe.Pointer
  11. const m_ARG_MAX = 131072
  12. const m_ASCII_0 = 48
  13. const m_ASCII_1 = 49
  14. const m_ASCII_2 = 50
  15. const m_ASCII_3 = 51
  16. const m_ASCII_4 = 0x34
  17. const m_ASCII_5 = 0x35
  18. const m_ASCII_6 = 0x36
  19. const m_ASCII_7 = 0x37
  20. const m_ASCII_8 = 56
  21. const m_ASCII_9 = 57
  22. const m_ASCII_A = 65
  23. const m_ASCII_AMP = 0x26
  24. const m_ASCII_APOS = 0x27
  25. const m_ASCII_B = 0x42
  26. const m_ASCII_C = 67
  27. const m_ASCII_COLON = 58
  28. const m_ASCII_COMMA = 44
  29. const m_ASCII_D = 68
  30. const m_ASCII_E = 69
  31. const m_ASCII_EQUALS = 61
  32. const m_ASCII_EXCL = 33
  33. const m_ASCII_F = 70
  34. const m_ASCII_FF = 12
  35. const m_ASCII_G = 0x47
  36. const m_ASCII_GT = 0x3E
  37. const m_ASCII_H = 0x48
  38. const m_ASCII_HASH = 35
  39. const m_ASCII_I = 73
  40. const m_ASCII_J = 0x4A
  41. const m_ASCII_K = 75
  42. const m_ASCII_L = 76
  43. const m_ASCII_LPAREN = 40
  44. const m_ASCII_LSQB = 0x5B
  45. const m_ASCII_LT = 0x3C
  46. const m_ASCII_M = 77
  47. const m_ASCII_MINUS = 0x2D
  48. const m_ASCII_N = 78
  49. const m_ASCII_O = 79
  50. const m_ASCII_P = 0x50
  51. const m_ASCII_PERIOD = 46
  52. const m_ASCII_PIPE = 124
  53. const m_ASCII_Q = 0x51
  54. const m_ASCII_QUOT = 0x22
  55. const m_ASCII_R = 82
  56. const m_ASCII_RPAREN = 41
  57. const m_ASCII_RSQB = 0x5D
  58. const m_ASCII_S = 83
  59. const m_ASCII_SEMI = 0x3B
  60. const m_ASCII_SLASH = 47
  61. const m_ASCII_SPACE = 0x20
  62. const m_ASCII_T = 84
  63. const m_ASCII_TAB = 0x09
  64. const m_ASCII_U = 0x55
  65. const m_ASCII_UNDERSCORE = 0x5F
  66. const m_ASCII_V = 0x56
  67. const m_ASCII_W = 0x57
  68. const m_ASCII_X = 88
  69. const m_ASCII_Y = 89
  70. const m_ASCII_Z = 0x5A
  71. const m_ASCII_a = 97
  72. const m_ASCII_b = 0x62
  73. const m_ASCII_c = 99
  74. const m_ASCII_d = 0x64
  75. const m_ASCII_e = 101
  76. const m_ASCII_f = 0x66
  77. const m_ASCII_g = 103
  78. const m_ASCII_h = 104
  79. const m_ASCII_i = 0x69
  80. const m_ASCII_j = 0x6A
  81. const m_ASCII_k = 0x6B
  82. const m_ASCII_l = 108
  83. const m_ASCII_m = 109
  84. const m_ASCII_n = 110
  85. const m_ASCII_o = 111
  86. const m_ASCII_p = 112
  87. const m_ASCII_q = 0x71
  88. const m_ASCII_r = 114
  89. const m_ASCII_s = 115
  90. const m_ASCII_t = 116
  91. const m_ASCII_u = 0x75
  92. const m_ASCII_v = 0x76
  93. const m_ASCII_w = 119
  94. const m_ASCII_x = 120
  95. const m_ASCII_y = 0x79
  96. const m_ASCII_z = 0x7A
  97. const m_AT_EACCESS = 0x200
  98. const m_AT_EMPTY_PATH = 0x1000
  99. const m_AT_NO_AUTOMOUNT = 0x800
  100. const m_AT_RECURSIVE = 0x8000
  101. const m_AT_REMOVEDIR = 0x200
  102. const m_AT_STATX_DONT_SYNC = 0x4000
  103. const m_AT_STATX_FORCE_SYNC = 0x2000
  104. const m_AT_STATX_SYNC_AS_STAT = 0x0000
  105. const m_AT_STATX_SYNC_TYPE = 0x6000
  106. const m_AT_SYMLINK_FOLLOW = 0x400
  107. const m_AT_SYMLINK_NOFOLLOW = 0x100
  108. const m_BC_BASE_MAX = 99
  109. const m_BC_DIM_MAX = 2048
  110. const m_BC_SCALE_MAX = 99
  111. const m_BC_STRING_MAX = 1000
  112. const m_BIG_ENDIAN = "__BIG_ENDIAN"
  113. const m_BUFSIZ = 1024
  114. const m_BYTEORDER = 4321
  115. const m_BYTE_ORDER = "__BYTE_ORDER"
  116. const m_CHARCLASS_NAME_MAX = 14
  117. const m_CHAR_BIT = 8
  118. const m_CHAR_MAX = 255
  119. const m_CHAR_MIN = 0
  120. const m_COLL_WEIGHTS_MAX = 2
  121. const m_DELAYTIMER_MAX = 0x7fffffff
  122. const m_DN_ACCESS = 0x00000001
  123. const m_DN_ATTRIB = 0x00000020
  124. const m_DN_CREATE = 0x00000004
  125. const m_DN_DELETE = 0x00000008
  126. const m_DN_MODIFY = 0x00000002
  127. const m_DN_MULTISHOT = 0x80000000
  128. const m_DN_RENAME = 0x00000010
  129. const m_E2BIG = 7
  130. const m_EACCES = 13
  131. const m_EADDRINUSE = 98
  132. const m_EADDRNOTAVAIL = 99
  133. const m_EADV = 68
  134. const m_EAFNOSUPPORT = 97
  135. const m_EAGAIN = 11
  136. const m_EALREADY = 114
  137. const m_EBADE = 52
  138. const m_EBADF = 9
  139. const m_EBADFD = 77
  140. const m_EBADMSG = 74
  141. const m_EBADR = 53
  142. const m_EBADRQC = 56
  143. const m_EBADSLT = 57
  144. const m_EBFONT = 59
  145. const m_EBUSY = 16
  146. const m_ECANCELED = 125
  147. const m_ECHILD = 10
  148. const m_ECHRNG = 44
  149. const m_ECOMM = 70
  150. const m_ECONNABORTED = 103
  151. const m_ECONNREFUSED = 111
  152. const m_ECONNRESET = 104
  153. const m_EDEADLK = 35
  154. const m_EDEADLOCK = "EDEADLK"
  155. const m_EDESTADDRREQ = 89
  156. const m_EDOM = 33
  157. const m_EDOTDOT = 73
  158. const m_EDQUOT = 122
  159. const m_EEXIST = 17
  160. const m_EFAULT = 14
  161. const m_EFBIG = 27
  162. const m_EHOSTDOWN = 112
  163. const m_EHOSTUNREACH = 113
  164. const m_EHWPOISON = 133
  165. const m_EIDRM = 43
  166. const m_EILSEQ = 84
  167. const m_EINPROGRESS = 115
  168. const m_EINTR = 4
  169. const m_EINVAL = 22
  170. const m_EIO = 5
  171. const m_EISCONN = 106
  172. const m_EISDIR = 21
  173. const m_EISNAM = 120
  174. const m_EKEYEXPIRED = 127
  175. const m_EKEYREJECTED = 129
  176. const m_EKEYREVOKED = 128
  177. const m_EL2HLT = 51
  178. const m_EL2NSYNC = 45
  179. const m_EL3HLT = 46
  180. const m_EL3RST = 47
  181. const m_ELIBACC = 79
  182. const m_ELIBBAD = 80
  183. const m_ELIBEXEC = 83
  184. const m_ELIBMAX = 82
  185. const m_ELIBSCN = 81
  186. const m_ELNRNG = 48
  187. const m_ELOOP = 40
  188. const m_EMEDIUMTYPE = 124
  189. const m_EMFILE = 24
  190. const m_EMLINK = 31
  191. const m_EMSGSIZE = 90
  192. const m_EMULTIHOP = 72
  193. const m_ENAMETOOLONG = 36
  194. const m_ENAVAIL = 119
  195. const m_ENETDOWN = 100
  196. const m_ENETRESET = 102
  197. const m_ENETUNREACH = 101
  198. const m_ENFILE = 23
  199. const m_ENOANO = 55
  200. const m_ENOBUFS = 105
  201. const m_ENOCSI = 50
  202. const m_ENODATA = 61
  203. const m_ENODEV = 19
  204. const m_ENOENT = 2
  205. const m_ENOEXEC = 8
  206. const m_ENOKEY = 126
  207. const m_ENOLCK = 37
  208. const m_ENOLINK = 67
  209. const m_ENOMEDIUM = 123
  210. const m_ENOMEM = 12
  211. const m_ENOMSG = 42
  212. const m_ENONET = 64
  213. const m_ENOPKG = 65
  214. const m_ENOPROTOOPT = 92
  215. const m_ENOSPC = 28
  216. const m_ENOSR = 63
  217. const m_ENOSTR = 60
  218. const m_ENOSYS = 38
  219. const m_ENOTBLK = 15
  220. const m_ENOTCONN = 107
  221. const m_ENOTDIR = 20
  222. const m_ENOTEMPTY = 39
  223. const m_ENOTNAM = 118
  224. const m_ENOTRECOVERABLE = 131
  225. const m_ENOTSOCK = 88
  226. const m_ENOTSUP = "EOPNOTSUPP"
  227. const m_ENOTTY = 25
  228. const m_ENOTUNIQ = 76
  229. const m_ENXIO = 6
  230. const m_EOPNOTSUPP = 95
  231. const m_EOVERFLOW = 75
  232. const m_EOWNERDEAD = 130
  233. const m_EPERM = 1
  234. const m_EPFNOSUPPORT = 96
  235. const m_EPIPE = 32
  236. const m_EPROTO = 71
  237. const m_EPROTONOSUPPORT = 93
  238. const m_EPROTOTYPE = 91
  239. const m_ERANGE = 34
  240. const m_EREMCHG = 78
  241. const m_EREMOTE = 66
  242. const m_EREMOTEIO = 121
  243. const m_ERESTART = 85
  244. const m_ERFKILL = 132
  245. const m_EROFS = 30
  246. const m_ESHUTDOWN = 108
  247. const m_ESOCKTNOSUPPORT = 94
  248. const m_ESPIPE = 29
  249. const m_ESRCH = 3
  250. const m_ESRMNT = 69
  251. const m_ESTALE = 116
  252. const m_ESTRPIPE = 86
  253. const m_ETIME = 62
  254. const m_ETIMEDOUT = 110
  255. const m_ETOOMANYREFS = 109
  256. const m_ETXTBSY = 26
  257. const m_EUCLEAN = 117
  258. const m_EUNATCH = 49
  259. const m_EUSERS = 87
  260. const m_EWOULDBLOCK = "EAGAIN"
  261. const m_EXDEV = 18
  262. const m_EXFULL = 54
  263. const m_EXIT_FAILURE = 1
  264. const m_EXIT_SUCCESS = 0
  265. const m_EXPAND_SPARE = 24
  266. const m_EXPR_NEST_MAX = 32
  267. const m_Expat_External_INCLUDED = 1
  268. const m_Expat_INCLUDED = 1
  269. const m_FALLOC_FL_KEEP_SIZE = 1
  270. const m_FALLOC_FL_PUNCH_HOLE = 2
  271. const m_FAPPEND = "O_APPEND"
  272. const m_FASYNC = "O_ASYNC"
  273. const m_FD_CLOEXEC = 1
  274. const m_FD_SETSIZE = 1024
  275. const m_FFSYNC = "O_SYNC"
  276. const m_FILENAME_MAX = 4096
  277. const m_FILESIZEBITS = 64
  278. const m_FNDELAY = "O_NDELAY"
  279. const m_FNONBLOCK = "O_NONBLOCK"
  280. const m_FOPEN_MAX = 1000
  281. const m_F_ADD_SEALS = 1033
  282. const m_F_CANCELLK = 1029
  283. const m_F_DUPFD = 0
  284. const m_F_DUPFD_CLOEXEC = 1030
  285. const m_F_GETFD = 1
  286. const m_F_GETFL = 3
  287. const m_F_GETLEASE = 1025
  288. const m_F_GETLK = 5
  289. const m_F_GETOWN = 9
  290. const m_F_GETOWNER_UIDS = 17
  291. const m_F_GETOWN_EX = 16
  292. const m_F_GETPIPE_SZ = 1032
  293. const m_F_GETSIG = 11
  294. const m_F_GET_FILE_RW_HINT = 1037
  295. const m_F_GET_RW_HINT = 1035
  296. const m_F_GET_SEALS = 1034
  297. const m_F_LOCK = 1
  298. const m_F_NOTIFY = 1026
  299. const m_F_OFD_GETLK = 36
  300. const m_F_OFD_SETLK = 37
  301. const m_F_OFD_SETLKW = 38
  302. const m_F_OK = 0
  303. const m_F_OWNER_GID = 2
  304. const m_F_OWNER_PGRP = 2
  305. const m_F_OWNER_PID = 1
  306. const m_F_OWNER_TID = 0
  307. const m_F_RDLCK = 0
  308. const m_F_SEAL_FUTURE_WRITE = 0x0010
  309. const m_F_SEAL_GROW = 0x0004
  310. const m_F_SEAL_SEAL = 0x0001
  311. const m_F_SEAL_SHRINK = 0x0002
  312. const m_F_SEAL_WRITE = 0x0008
  313. const m_F_SETFD = 2
  314. const m_F_SETFL = 4
  315. const m_F_SETLEASE = 1024
  316. const m_F_SETLK = 6
  317. const m_F_SETLKW = 7
  318. const m_F_SETOWN = 8
  319. const m_F_SETOWN_EX = 15
  320. const m_F_SETPIPE_SZ = 1031
  321. const m_F_SETSIG = 10
  322. const m_F_SET_FILE_RW_HINT = 1038
  323. const m_F_SET_RW_HINT = 1036
  324. const m_F_TEST = 3
  325. const m_F_TLOCK = 2
  326. const m_F_ULOCK = 0
  327. const m_F_UNLCK = 2
  328. const m_F_WRLCK = 1
  329. const m_GRND_INSECURE = 0x0004
  330. const m_GRND_NONBLOCK = 1
  331. const m_GRND_RANDOM = 0x0002
  332. const m_HAVE_CONFIG_H = 1
  333. const m_HAVE_DLFCN_H = 1
  334. const m_HAVE_EXPAT_CONFIG_H = 1
  335. const m_HAVE_FCNTL_H = 1
  336. const m_HAVE_GETPAGESIZE = 1
  337. const m_HAVE_GETRANDOM = 1
  338. const m_HAVE_INTTYPES_H = 1
  339. const m_HAVE_MEMORY_H = 1
  340. const m_HAVE_MMAP = 1
  341. const m_HAVE_STDINT_H = 1
  342. const m_HAVE_STDLIB_H = 1
  343. const m_HAVE_STRINGS_H = 1
  344. const m_HAVE_STRING_H = 1
  345. const m_HAVE_SYSCALL_GETRANDOM = 1
  346. const m_HAVE_SYS_PARAM_H = 1
  347. const m_HAVE_SYS_STAT_H = 1
  348. const m_HAVE_SYS_TYPES_H = 1
  349. const m_HAVE_UNISTD_H = 1
  350. const m_HOST_NAME_MAX = 255
  351. const m_INIT_ATTS_SIZE = 16
  352. const m_INIT_ATTS_VERSION = 4294967295
  353. const m_INIT_BLOCK_SIZE = 1024
  354. const m_INIT_BUFFER_SIZE = 1024
  355. const m_INIT_DATA_BUF_SIZE = 1024
  356. const m_INIT_POWER = 6
  357. const m_INIT_SCAFFOLD_ELEMENTS = 32
  358. const m_INIT_TAG_BUF_SIZE = 32
  359. const m_INT16_MAX = 0x7fff
  360. const m_INT32_MAX = 0x7fffffff
  361. const m_INT64_MAX = 0x7fffffffffffffff
  362. const m_INT8_MAX = 0x7f
  363. const m_INTMAX_MAX = "INT64_MAX"
  364. const m_INTMAX_MIN = "INT64_MIN"
  365. const m_INTPTR_MAX = "INT64_MAX"
  366. const m_INTPTR_MIN = "INT64_MIN"
  367. const m_INT_FAST16_MAX = "INT32_MAX"
  368. const m_INT_FAST16_MIN = "INT32_MIN"
  369. const m_INT_FAST32_MAX = "INT32_MAX"
  370. const m_INT_FAST32_MIN = "INT32_MIN"
  371. const m_INT_FAST64_MAX = "INT64_MAX"
  372. const m_INT_FAST64_MIN = "INT64_MIN"
  373. const m_INT_FAST8_MAX = "INT8_MAX"
  374. const m_INT_FAST8_MIN = "INT8_MIN"
  375. const m_INT_LEAST16_MAX = "INT16_MAX"
  376. const m_INT_LEAST16_MIN = "INT16_MIN"
  377. const m_INT_LEAST32_MAX = "INT32_MAX"
  378. const m_INT_LEAST32_MIN = "INT32_MIN"
  379. const m_INT_LEAST64_MAX = "INT64_MAX"
  380. const m_INT_LEAST64_MIN = "INT64_MIN"
  381. const m_INT_LEAST8_MAX = "INT8_MAX"
  382. const m_INT_LEAST8_MIN = "INT8_MIN"
  383. const m_INT_MAX = 2147483647
  384. const m_IOV_MAX = 1024
  385. const m_ITIMER_PROF = 2
  386. const m_ITIMER_REAL = 0
  387. const m_ITIMER_VIRTUAL = 1
  388. const m_LINE_MAX = 4096
  389. const m_LITTLE_ENDIAN = "__LITTLE_ENDIAN"
  390. const m_LLONG_MAX = 0x7fffffffffffffff
  391. const m_LOGIN_NAME_MAX = 256
  392. const m_LONG_BIT = 64
  393. const m_LONG_MAX = "__LONG_MAX"
  394. const m_LT_OBJDIR = ".libs/"
  395. const m_L_INCR = 1
  396. const m_L_SET = 0
  397. const m_L_XTND = 2
  398. const m_L_ctermid = 20
  399. const m_L_cuserid = 20
  400. const m_L_tmpnam = 20
  401. const m_MAX_HANDLE_SZ = 128
  402. const m_MB_LEN_MAX = 4
  403. const m_MQ_PRIO_MAX = 32768
  404. const m_NAME_MAX = 255
  405. const m_NDEBUG = 1
  406. const m_NGROUPS_MAX = 32
  407. const m_NL_ARGMAX = 9
  408. const m_NL_LANGMAX = 32
  409. const m_NL_MSGMAX = 32767
  410. const m_NL_NMAX = 16
  411. const m_NL_SETMAX = 255
  412. const m_NL_TEXTMAX = 2048
  413. const m_NZERO = 20
  414. const m_O_APPEND = 02000
  415. const m_O_ASYNC = 020000
  416. const m_O_CLOEXEC = 02000000
  417. const m_O_CREAT = 0100
  418. const m_O_DIRECT = 040000
  419. const m_O_DIRECTORY = 0200000
  420. const m_O_DSYNC = 010000
  421. const m_O_EXCL = 0200
  422. const m_O_EXEC = "O_PATH"
  423. const m_O_LARGEFILE = 0100000
  424. const m_O_NDELAY = "O_NONBLOCK"
  425. const m_O_NOATIME = 01000000
  426. const m_O_NOCTTY = 0400
  427. const m_O_NOFOLLOW = 0400000
  428. const m_O_NONBLOCK = 04000
  429. const m_O_PATH = 010000000
  430. const m_O_RDONLY = 0
  431. const m_O_RDWR = 02
  432. const m_O_RSYNC = 04010000
  433. const m_O_SEARCH = "O_PATH"
  434. const m_O_SYNC = 04010000
  435. const m_O_TMPFILE = 020200000
  436. const m_O_TRUNC = 01000
  437. const m_O_TTY_INIT = 0
  438. const m_O_WRONLY = 01
  439. const m_PACKAGE = "expat"
  440. const m_PACKAGE_BUGREPORT = "expat-bugs@libexpat.org"
  441. const m_PACKAGE_NAME = "expat"
  442. const m_PACKAGE_STRING = "expat 2.2.10"
  443. const m_PACKAGE_TARNAME = "expat"
  444. const m_PACKAGE_URL = ""
  445. const m_PACKAGE_VERSION = "2.2.10"
  446. const m_PAGESIZE = 4096
  447. const m_PAGE_SIZE = "PAGESIZE"
  448. const m_PATH_MAX = 4096
  449. const m_PDP_ENDIAN = "__PDP_ENDIAN"
  450. const m_PIPE_BUF = 4096
  451. const m_POSIX_CLOSE_RESTART = 0
  452. const m_POSIX_FADV_DONTNEED = 6
  453. const m_POSIX_FADV_NOREUSE = 7
  454. const m_POSIX_FADV_NORMAL = 0
  455. const m_POSIX_FADV_RANDOM = 1
  456. const m_POSIX_FADV_SEQUENTIAL = 2
  457. const m_POSIX_FADV_WILLNEED = 3
  458. const m_PTHREAD_DESTRUCTOR_ITERATIONS = 4
  459. const m_PTHREAD_KEYS_MAX = 128
  460. const m_PTHREAD_STACK_MIN = 2048
  461. const m_PTRDIFF_MAX = "INT64_MAX"
  462. const m_PTRDIFF_MIN = "INT64_MIN"
  463. const m_P_tmpdir = "/tmp"
  464. const m_RAND_MAX = 0x7fffffff
  465. const m_RE_DUP_MAX = 255
  466. const m_RWF_WRITE_LIFE_NOT_SET = 0
  467. const m_RWH_WRITE_LIFE_EXTREME = 5
  468. const m_RWH_WRITE_LIFE_LONG = 4
  469. const m_RWH_WRITE_LIFE_MEDIUM = 3
  470. const m_RWH_WRITE_LIFE_NONE = 1
  471. const m_RWH_WRITE_LIFE_SHORT = 2
  472. const m_R_OK = 4
  473. const m_SCHAR_MAX = 127
  474. const m_SEEK_DATA = 3
  475. const m_SEEK_HOLE = 4
  476. const m_SEM_NSEMS_MAX = 256
  477. const m_SEM_VALUE_MAX = 0x7fffffff
  478. const m_SHRT_MAX = 0x7fff
  479. const m_SIG_ATOMIC_MAX = "INT32_MAX"
  480. const m_SIG_ATOMIC_MIN = "INT32_MIN"
  481. const m_SIP_KEYLEN = 16
  482. const m_SIZE_MAX = "UINT64_MAX"
  483. const m_SPLICE_F_GIFT = 8
  484. const m_SPLICE_F_MORE = 4
  485. const m_SPLICE_F_MOVE = 1
  486. const m_SPLICE_F_NONBLOCK = 2
  487. const m_SSIZE_MAX = "LONG_MAX"
  488. const m_STDC_HEADERS = 1
  489. const m_STDERR_FILENO = 2
  490. const m_STDIN_FILENO = 0
  491. const m_STDOUT_FILENO = 1
  492. const m_SYMLOOP_MAX = 40
  493. const m_SYNC_FILE_RANGE_WAIT_AFTER = 4
  494. const m_SYNC_FILE_RANGE_WAIT_BEFORE = 1
  495. const m_SYNC_FILE_RANGE_WRITE = 2
  496. const m_S_IRGRP = 0040
  497. const m_S_IROTH = 0004
  498. const m_S_IRUSR = 0400
  499. const m_S_IRWXG = 0070
  500. const m_S_IRWXO = 0007
  501. const m_S_IRWXU = 0700
  502. const m_S_ISGID = 02000
  503. const m_S_ISUID = 04000
  504. const m_S_ISVTX = 01000
  505. const m_S_IWGRP = 0020
  506. const m_S_IWOTH = 0002
  507. const m_S_IWUSR = 0200
  508. const m_S_IXGRP = 0010
  509. const m_S_IXOTH = 0001
  510. const m_S_IXUSR = 0100
  511. const m_TMP_MAX = 10000
  512. const m_TTY_NAME_MAX = 32
  513. const m_TZNAME_MAX = 6
  514. const m_UCHAR_MAX = 255
  515. const m_UINT16_MAX = 0xffff
  516. const m_UINT32_MAX = "0xffffffffu"
  517. const m_UINT64_MAX = "0xffffffffffffffffu"
  518. const m_UINT8_MAX = 0xff
  519. const m_UINTMAX_MAX = "UINT64_MAX"
  520. const m_UINTPTR_MAX = "UINT64_MAX"
  521. const m_UINT_FAST16_MAX = "UINT32_MAX"
  522. const m_UINT_FAST32_MAX = "UINT32_MAX"
  523. const m_UINT_FAST64_MAX = "UINT64_MAX"
  524. const m_UINT_FAST8_MAX = "UINT8_MAX"
  525. const m_UINT_LEAST16_MAX = "UINT16_MAX"
  526. const m_UINT_LEAST32_MAX = "UINT32_MAX"
  527. const m_UINT_LEAST64_MAX = "UINT64_MAX"
  528. const m_UINT_LEAST8_MAX = "UINT8_MAX"
  529. const m_UINT_MAX = 0xffffffff
  530. const m_USHRT_MAX = 0xffff
  531. const m_VERSION = "2.2.10"
  532. const m_WINT_MAX = "UINT32_MAX"
  533. const m_WINT_MIN = 0
  534. const m_WNOHANG = 1
  535. const m_WORDS_BIGENDIAN = 1
  536. const m_WORD_BIT = 32
  537. const m_WUNTRACED = 2
  538. const m_W_OK = 2
  539. const m_XML_ATTRIBUTE_VALUE_LITERAL = 0
  540. const m_XML_BUILDING_EXPAT = 1
  541. const m_XML_CDATA_SECTION_STATE = 2
  542. const m_XML_CONTENT_STATE = 1
  543. const m_XML_CONTEXT_BYTES = 1024
  544. const m_XML_DEV_URANDOM = 1
  545. const m_XML_DTD = 1
  546. const m_XML_ENABLE_VISIBILITY = 1
  547. const m_XML_ENCODE_MAX = "XML_UTF8_ENCODE_MAX"
  548. const m_XML_ENTITY_VALUE_LITERAL = 1
  549. const m_XML_GetErrorByteIndex = "XML_GetCurrentByteIndex"
  550. const m_XML_GetErrorColumnNumber = "XML_GetCurrentColumnNumber"
  551. const m_XML_GetErrorLineNumber = "XML_GetCurrentLineNumber"
  552. const m_XML_IGNORE_SECTION_STATE = 3
  553. const m_XML_MAJOR_VERSION = 2
  554. const m_XML_MICRO_VERSION = 10
  555. const m_XML_MINOR_VERSION = 2
  556. const m_XML_NS = 1
  557. const m_XML_N_LITERAL_TYPES = 2
  558. const m_XML_N_STATES = 4
  559. const m_XML_PROLOG_STATE = 0
  560. const m_XML_TOK_ATTRIBUTE_VALUE_S = 39
  561. const m_XML_TOK_BOM = 14
  562. const m_XML_TOK_CDATA_SECT_CLOSE = 40
  563. const m_XML_TOK_CDATA_SECT_OPEN = 8
  564. const m_XML_TOK_CHAR_REF = 10
  565. const m_XML_TOK_CLOSE_BRACKET = 26
  566. const m_XML_TOK_CLOSE_PAREN = 24
  567. const m_XML_TOK_CLOSE_PAREN_ASTERISK = 36
  568. const m_XML_TOK_CLOSE_PAREN_PLUS = 37
  569. const m_XML_TOK_CLOSE_PAREN_QUESTION = 35
  570. const m_XML_TOK_COMMA = 38
  571. const m_XML_TOK_COMMENT = 13
  572. const m_XML_TOK_COND_SECT_CLOSE = 34
  573. const m_XML_TOK_COND_SECT_OPEN = 33
  574. const m_XML_TOK_DATA_CHARS = 6
  575. const m_XML_TOK_DATA_NEWLINE = 7
  576. const m_XML_TOK_DECL_CLOSE = 17
  577. const m_XML_TOK_DECL_OPEN = 16
  578. const m_XML_TOK_EMPTY_ELEMENT_NO_ATTS = 4
  579. const m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS = 3
  580. const m_XML_TOK_END_TAG = 5
  581. const m_XML_TOK_ENTITY_REF = 9
  582. const m_XML_TOK_IGNORE_SECT = 42
  583. const m_XML_TOK_INSTANCE_START = 29
  584. const m_XML_TOK_INVALID = 0
  585. const m_XML_TOK_LITERAL = 27
  586. const m_XML_TOK_NAME = 18
  587. const m_XML_TOK_NAME_ASTERISK = 31
  588. const m_XML_TOK_NAME_PLUS = 32
  589. const m_XML_TOK_NAME_QUESTION = 30
  590. const m_XML_TOK_NMTOKEN = 19
  591. const m_XML_TOK_OPEN_BRACKET = 25
  592. const m_XML_TOK_OPEN_PAREN = 23
  593. const m_XML_TOK_OR = 21
  594. const m_XML_TOK_PARAM_ENTITY_REF = 28
  595. const m_XML_TOK_PERCENT = 22
  596. const m_XML_TOK_PI = 11
  597. const m_XML_TOK_POUND_NAME = 20
  598. const m_XML_TOK_PREFIXED_NAME = 41
  599. const m_XML_TOK_PROLOG_S = 15
  600. const m_XML_TOK_START_TAG_NO_ATTS = 2
  601. const m_XML_TOK_START_TAG_WITH_ATTS = 1
  602. const m_XML_TOK_XML_DECL = 12
  603. const m_XML_UTF16_ENCODE_MAX = 2
  604. const m_XML_UTF8_ENCODE_MAX = 4
  605. const m_X_OK = 1
  606. const m_XmlConvert = "XmlUtf8Convert"
  607. const m_XmlEncode = "XmlUtf8Encode"
  608. const m_XmlGetInternalEncoding = "XmlGetUtf8InternalEncoding"
  609. const m_XmlGetInternalEncodingNS = "XmlGetUtf8InternalEncodingNS"
  610. const m_XmlRole_INCLUDED = 1
  611. const m_XmlTok_INCLUDED = 1
  612. const m__CS_GNU_LIBC_VERSION = 2
  613. const m__CS_GNU_LIBPTHREAD_VERSION = 3
  614. const m__CS_PATH = 0
  615. const m__CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 4
  616. const m__CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116
  617. const m__CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117
  618. const m__CS_POSIX_V6_ILP32_OFF32_LIBS = 1118
  619. const m__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119
  620. const m__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120
  621. const m__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121
  622. const m__CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122
  623. const m__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123
  624. const m__CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124
  625. const m__CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125
  626. const m__CS_POSIX_V6_LP64_OFF64_LIBS = 1126
  627. const m__CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127
  628. const m__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128
  629. const m__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129
  630. const m__CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130
  631. const m__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131
  632. const m__CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 1
  633. const m__CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132
  634. const m__CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133
  635. const m__CS_POSIX_V7_ILP32_OFF32_LIBS = 1134
  636. const m__CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135
  637. const m__CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136
  638. const m__CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137
  639. const m__CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138
  640. const m__CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139
  641. const m__CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140
  642. const m__CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141
  643. const m__CS_POSIX_V7_LP64_OFF64_LIBS = 1142
  644. const m__CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143
  645. const m__CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144
  646. const m__CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145
  647. const m__CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146
  648. const m__CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147
  649. const m__CS_POSIX_V7_THREADS_CFLAGS = 1150
  650. const m__CS_POSIX_V7_THREADS_LDFLAGS = 1151
  651. const m__CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 5
  652. const m__CS_V6_ENV = 1148
  653. const m__CS_V7_ENV = 1149
  654. const m__GNU_SOURCE = 1
  655. const m__IOFBF = 0
  656. const m__IOLBF = 1
  657. const m__IONBF = 2
  658. const m__LP64 = 1
  659. const m__PC_2_SYMLINKS = 20
  660. const m__PC_ALLOC_SIZE_MIN = 18
  661. const m__PC_ASYNC_IO = 10
  662. const m__PC_CHOWN_RESTRICTED = 6
  663. const m__PC_FILESIZEBITS = 13
  664. const m__PC_LINK_MAX = 0
  665. const m__PC_MAX_CANON = 1
  666. const m__PC_MAX_INPUT = 2
  667. const m__PC_NAME_MAX = 3
  668. const m__PC_NO_TRUNC = 7
  669. const m__PC_PATH_MAX = 4
  670. const m__PC_PIPE_BUF = 5
  671. const m__PC_PRIO_IO = 11
  672. const m__PC_REC_INCR_XFER_SIZE = 14
  673. const m__PC_REC_MAX_XFER_SIZE = 15
  674. const m__PC_REC_MIN_XFER_SIZE = 16
  675. const m__PC_REC_XFER_ALIGN = 17
  676. const m__PC_SOCK_MAXBUF = 12
  677. const m__PC_SYMLINK_MAX = 19
  678. const m__PC_SYNC_IO = 9
  679. const m__PC_VDISABLE = 8
  680. const m__POSIX2_BC_BASE_MAX = 99
  681. const m__POSIX2_BC_DIM_MAX = 2048
  682. const m__POSIX2_BC_SCALE_MAX = 99
  683. const m__POSIX2_BC_STRING_MAX = 1000
  684. const m__POSIX2_CHARCLASS_NAME_MAX = 14
  685. const m__POSIX2_COLL_WEIGHTS_MAX = 2
  686. const m__POSIX2_C_BIND = "_POSIX_VERSION"
  687. const m__POSIX2_EXPR_NEST_MAX = 32
  688. const m__POSIX2_LINE_MAX = 2048
  689. const m__POSIX2_RE_DUP_MAX = 255
  690. const m__POSIX2_VERSION = "_POSIX_VERSION"
  691. const m__POSIX_ADVISORY_INFO = "_POSIX_VERSION"
  692. const m__POSIX_AIO_LISTIO_MAX = 2
  693. const m__POSIX_AIO_MAX = 1
  694. const m__POSIX_ARG_MAX = 4096
  695. const m__POSIX_ASYNCHRONOUS_IO = "_POSIX_VERSION"
  696. const m__POSIX_BARRIERS = "_POSIX_VERSION"
  697. const m__POSIX_CHILD_MAX = 25
  698. const m__POSIX_CHOWN_RESTRICTED = 1
  699. const m__POSIX_CLOCKRES_MIN = 20000000
  700. const m__POSIX_CLOCK_SELECTION = "_POSIX_VERSION"
  701. const m__POSIX_CPUTIME = "_POSIX_VERSION"
  702. const m__POSIX_DELAYTIMER_MAX = 32
  703. const m__POSIX_FSYNC = "_POSIX_VERSION"
  704. const m__POSIX_HOST_NAME_MAX = 255
  705. const m__POSIX_IPV6 = "_POSIX_VERSION"
  706. const m__POSIX_JOB_CONTROL = 1
  707. const m__POSIX_LINK_MAX = 8
  708. const m__POSIX_LOGIN_NAME_MAX = 9
  709. const m__POSIX_MAPPED_FILES = "_POSIX_VERSION"
  710. const m__POSIX_MAX_CANON = 255
  711. const m__POSIX_MAX_INPUT = 255
  712. const m__POSIX_MEMLOCK = "_POSIX_VERSION"
  713. const m__POSIX_MEMLOCK_RANGE = "_POSIX_VERSION"
  714. const m__POSIX_MEMORY_PROTECTION = "_POSIX_VERSION"
  715. const m__POSIX_MESSAGE_PASSING = "_POSIX_VERSION"
  716. const m__POSIX_MONOTONIC_CLOCK = "_POSIX_VERSION"
  717. const m__POSIX_MQ_OPEN_MAX = 8
  718. const m__POSIX_MQ_PRIO_MAX = 32
  719. const m__POSIX_NAME_MAX = 14
  720. const m__POSIX_NGROUPS_MAX = 8
  721. const m__POSIX_NO_TRUNC = 1
  722. const m__POSIX_OPEN_MAX = 20
  723. const m__POSIX_PATH_MAX = 256
  724. const m__POSIX_PIPE_BUF = 512
  725. const m__POSIX_RAW_SOCKETS = "_POSIX_VERSION"
  726. const m__POSIX_READER_WRITER_LOCKS = "_POSIX_VERSION"
  727. const m__POSIX_REALTIME_SIGNALS = "_POSIX_VERSION"
  728. const m__POSIX_REGEXP = 1
  729. const m__POSIX_RE_DUP_MAX = 255
  730. const m__POSIX_RTSIG_MAX = 8
  731. const m__POSIX_SAVED_IDS = 1
  732. const m__POSIX_SEMAPHORES = "_POSIX_VERSION"
  733. const m__POSIX_SEM_NSEMS_MAX = 256
  734. const m__POSIX_SEM_VALUE_MAX = 32767
  735. const m__POSIX_SHARED_MEMORY_OBJECTS = "_POSIX_VERSION"
  736. const m__POSIX_SHELL = 1
  737. const m__POSIX_SIGQUEUE_MAX = 32
  738. const m__POSIX_SPAWN = "_POSIX_VERSION"
  739. const m__POSIX_SPIN_LOCKS = "_POSIX_VERSION"
  740. const m__POSIX_SSIZE_MAX = 32767
  741. const m__POSIX_SS_REPL_MAX = 4
  742. const m__POSIX_STREAM_MAX = 8
  743. const m__POSIX_SYMLINK_MAX = 255
  744. const m__POSIX_SYMLOOP_MAX = 8
  745. const m__POSIX_THREADS = "_POSIX_VERSION"
  746. const m__POSIX_THREAD_ATTR_STACKADDR = "_POSIX_VERSION"
  747. const m__POSIX_THREAD_ATTR_STACKSIZE = "_POSIX_VERSION"
  748. const m__POSIX_THREAD_CPUTIME = "_POSIX_VERSION"
  749. const m__POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4
  750. const m__POSIX_THREAD_KEYS_MAX = 128
  751. const m__POSIX_THREAD_PRIORITY_SCHEDULING = "_POSIX_VERSION"
  752. const m__POSIX_THREAD_PROCESS_SHARED = "_POSIX_VERSION"
  753. const m__POSIX_THREAD_SAFE_FUNCTIONS = "_POSIX_VERSION"
  754. const m__POSIX_THREAD_THREADS_MAX = 64
  755. const m__POSIX_TIMEOUTS = "_POSIX_VERSION"
  756. const m__POSIX_TIMERS = "_POSIX_VERSION"
  757. const m__POSIX_TIMER_MAX = 32
  758. const m__POSIX_TRACE_EVENT_NAME_MAX = 30
  759. const m__POSIX_TRACE_NAME_MAX = 8
  760. const m__POSIX_TRACE_SYS_MAX = 8
  761. const m__POSIX_TRACE_USER_EVENT_MAX = 32
  762. const m__POSIX_TTY_NAME_MAX = 9
  763. const m__POSIX_TZNAME_MAX = 6
  764. const m__POSIX_V6_LP64_OFF64 = 1
  765. const m__POSIX_V7_LP64_OFF64 = 1
  766. const m__POSIX_VDISABLE = 0
  767. const m__POSIX_VERSION = 200809
  768. const m__SC_2_CHAR_TERM = 95
  769. const m__SC_2_C_BIND = 47
  770. const m__SC_2_C_DEV = 48
  771. const m__SC_2_FORT_DEV = 49
  772. const m__SC_2_FORT_RUN = 50
  773. const m__SC_2_LOCALEDEF = 52
  774. const m__SC_2_PBS = 168
  775. const m__SC_2_PBS_ACCOUNTING = 169
  776. const m__SC_2_PBS_CHECKPOINT = 175
  777. const m__SC_2_PBS_LOCATE = 170
  778. const m__SC_2_PBS_MESSAGE = 171
  779. const m__SC_2_PBS_TRACK = 172
  780. const m__SC_2_SW_DEV = 51
  781. const m__SC_2_UPE = 97
  782. const m__SC_2_VERSION = 46
  783. const m__SC_ADVISORY_INFO = 132
  784. const m__SC_AIO_LISTIO_MAX = 23
  785. const m__SC_AIO_MAX = 24
  786. const m__SC_AIO_PRIO_DELTA_MAX = 25
  787. const m__SC_ARG_MAX = 0
  788. const m__SC_ASYNCHRONOUS_IO = 12
  789. const m__SC_ATEXIT_MAX = 87
  790. const m__SC_AVPHYS_PAGES = 86
  791. const m__SC_BARRIERS = 133
  792. const m__SC_BC_BASE_MAX = 36
  793. const m__SC_BC_DIM_MAX = 37
  794. const m__SC_BC_SCALE_MAX = 38
  795. const m__SC_BC_STRING_MAX = 39
  796. const m__SC_CHILD_MAX = 1
  797. const m__SC_CLK_TCK = 2
  798. const m__SC_CLOCK_SELECTION = 137
  799. const m__SC_COLL_WEIGHTS_MAX = 40
  800. const m__SC_CPUTIME = 138
  801. const m__SC_DELAYTIMER_MAX = 26
  802. const m__SC_EXPR_NEST_MAX = 42
  803. const m__SC_FSYNC = 15
  804. const m__SC_GETGR_R_SIZE_MAX = 69
  805. const m__SC_GETPW_R_SIZE_MAX = 70
  806. const m__SC_HOST_NAME_MAX = 180
  807. const m__SC_IOV_MAX = 60
  808. const m__SC_IPV6 = 235
  809. const m__SC_JOB_CONTROL = 7
  810. const m__SC_LINE_MAX = 43
  811. const m__SC_LOGIN_NAME_MAX = 71
  812. const m__SC_MAPPED_FILES = 16
  813. const m__SC_MEMLOCK = 17
  814. const m__SC_MEMLOCK_RANGE = 18
  815. const m__SC_MEMORY_PROTECTION = 19
  816. const m__SC_MESSAGE_PASSING = 20
  817. const m__SC_MINSIGSTKSZ = 249
  818. const m__SC_MONOTONIC_CLOCK = 149
  819. const m__SC_MQ_OPEN_MAX = 27
  820. const m__SC_MQ_PRIO_MAX = 28
  821. const m__SC_NGROUPS_MAX = 3
  822. const m__SC_NPROCESSORS_CONF = 83
  823. const m__SC_NPROCESSORS_ONLN = 84
  824. const m__SC_NZERO = 109
  825. const m__SC_OPEN_MAX = 4
  826. const m__SC_PAGESIZE = 30
  827. const m__SC_PAGE_SIZE = 30
  828. const m__SC_PASS_MAX = 88
  829. const m__SC_PHYS_PAGES = 85
  830. const m__SC_PRIORITIZED_IO = 13
  831. const m__SC_PRIORITY_SCHEDULING = 10
  832. const m__SC_RAW_SOCKETS = 236
  833. const m__SC_READER_WRITER_LOCKS = 153
  834. const m__SC_REALTIME_SIGNALS = 9
  835. const m__SC_REGEXP = 155
  836. const m__SC_RE_DUP_MAX = 44
  837. const m__SC_RTSIG_MAX = 31
  838. const m__SC_SAVED_IDS = 8
  839. const m__SC_SEMAPHORES = 21
  840. const m__SC_SEM_NSEMS_MAX = 32
  841. const m__SC_SEM_VALUE_MAX = 33
  842. const m__SC_SHARED_MEMORY_OBJECTS = 22
  843. const m__SC_SHELL = 157
  844. const m__SC_SIGQUEUE_MAX = 34
  845. const m__SC_SIGSTKSZ = 250
  846. const m__SC_SPAWN = 159
  847. const m__SC_SPIN_LOCKS = 154
  848. const m__SC_SPORADIC_SERVER = 160
  849. const m__SC_SS_REPL_MAX = 241
  850. const m__SC_STREAMS = 174
  851. const m__SC_STREAM_MAX = 5
  852. const m__SC_SYMLOOP_MAX = 173
  853. const m__SC_SYNCHRONIZED_IO = 14
  854. const m__SC_THREADS = 67
  855. const m__SC_THREAD_ATTR_STACKADDR = 77
  856. const m__SC_THREAD_ATTR_STACKSIZE = 78
  857. const m__SC_THREAD_CPUTIME = 139
  858. const m__SC_THREAD_DESTRUCTOR_ITERATIONS = 73
  859. const m__SC_THREAD_KEYS_MAX = 74
  860. const m__SC_THREAD_PRIORITY_SCHEDULING = 79
  861. const m__SC_THREAD_PRIO_INHERIT = 80
  862. const m__SC_THREAD_PRIO_PROTECT = 81
  863. const m__SC_THREAD_PROCESS_SHARED = 82
  864. const m__SC_THREAD_ROBUST_PRIO_INHERIT = 247
  865. const m__SC_THREAD_ROBUST_PRIO_PROTECT = 248
  866. const m__SC_THREAD_SAFE_FUNCTIONS = 68
  867. const m__SC_THREAD_SPORADIC_SERVER = 161
  868. const m__SC_THREAD_STACK_MIN = 75
  869. const m__SC_THREAD_THREADS_MAX = 76
  870. const m__SC_TIMEOUTS = 164
  871. const m__SC_TIMERS = 11
  872. const m__SC_TIMER_MAX = 35
  873. const m__SC_TRACE = 181
  874. const m__SC_TRACE_EVENT_FILTER = 182
  875. const m__SC_TRACE_EVENT_NAME_MAX = 242
  876. const m__SC_TRACE_INHERIT = 183
  877. const m__SC_TRACE_LOG = 184
  878. const m__SC_TRACE_NAME_MAX = 243
  879. const m__SC_TRACE_SYS_MAX = 244
  880. const m__SC_TRACE_USER_EVENT_MAX = 245
  881. const m__SC_TTY_NAME_MAX = 72
  882. const m__SC_TYPED_MEMORY_OBJECTS = 165
  883. const m__SC_TZNAME_MAX = 6
  884. const m__SC_UIO_MAXIOV = 60
  885. const m__SC_V6_ILP32_OFF32 = 176
  886. const m__SC_V6_ILP32_OFFBIG = 177
  887. const m__SC_V6_LP64_OFF64 = 178
  888. const m__SC_V6_LPBIG_OFFBIG = 179
  889. const m__SC_V7_ILP32_OFF32 = 237
  890. const m__SC_V7_ILP32_OFFBIG = 238
  891. const m__SC_V7_LP64_OFF64 = 239
  892. const m__SC_V7_LPBIG_OFFBIG = 240
  893. const m__SC_VERSION = 29
  894. const m__SC_XBS5_ILP32_OFF32 = 125
  895. const m__SC_XBS5_ILP32_OFFBIG = 126
  896. const m__SC_XBS5_LP64_OFF64 = 127
  897. const m__SC_XBS5_LPBIG_OFFBIG = 128
  898. const m__SC_XOPEN_CRYPT = 92
  899. const m__SC_XOPEN_ENH_I18N = 93
  900. const m__SC_XOPEN_LEGACY = 129
  901. const m__SC_XOPEN_REALTIME = 130
  902. const m__SC_XOPEN_REALTIME_THREADS = 131
  903. const m__SC_XOPEN_SHM = 94
  904. const m__SC_XOPEN_STREAMS = 246
  905. const m__SC_XOPEN_UNIX = 91
  906. const m__SC_XOPEN_VERSION = 89
  907. const m__SC_XOPEN_XCU_VERSION = 90
  908. const m__SC_XOPEN_XPG2 = 98
  909. const m__SC_XOPEN_XPG3 = 99
  910. const m__SC_XOPEN_XPG4 = 100
  911. const m__STDC_PREDEF_H = 1
  912. const m__XOPEN_ENH_I18N = 1
  913. const m__XOPEN_IOV_MAX = 16
  914. const m__XOPEN_NAME_MAX = 255
  915. const m__XOPEN_PATH_MAX = 1024
  916. const m__XOPEN_UNIX = 1
  917. const m__XOPEN_VERSION = 700
  918. const m___ARCH__ = 9
  919. const m___ATOMIC_ACQUIRE = 2
  920. const m___ATOMIC_ACQ_REL = 4
  921. const m___ATOMIC_CONSUME = 1
  922. const m___ATOMIC_RELAXED = 0
  923. const m___ATOMIC_RELEASE = 3
  924. const m___ATOMIC_SEQ_CST = 5
  925. const m___BIGGEST_ALIGNMENT__ = 8
  926. const m___BIG_ENDIAN = 4321
  927. const m___BYTE_ORDER = 4321
  928. const m___BYTE_ORDER__ = "__ORDER_BIG_ENDIAN__"
  929. const m___CCGO__ = 1
  930. const m___CHAR_BIT__ = 8
  931. const m___CHAR_UNSIGNED__ = 1
  932. const m___DBL_DECIMAL_DIG__ = 17
  933. const m___DBL_DIG__ = 15
  934. const m___DBL_HAS_DENORM__ = 1
  935. const m___DBL_HAS_INFINITY__ = 1
  936. const m___DBL_HAS_QUIET_NAN__ = 1
  937. const m___DBL_MANT_DIG__ = 53
  938. const m___DBL_MAX_10_EXP__ = 308
  939. const m___DBL_MAX_EXP__ = 1024
  940. const m___DEC128_EPSILON__ = 1e-33
  941. const m___DEC128_MANT_DIG__ = 34
  942. const m___DEC128_MAX_EXP__ = 6145
  943. const m___DEC128_MAX__ = "9.999999999999999999999999999999999E6144"
  944. const m___DEC128_MIN__ = 1e-6143
  945. const m___DEC128_SUBNORMAL_MIN__ = 0.000000000000000000000000000000001e-6143
  946. const m___DEC32_EPSILON__ = 1e-6
  947. const m___DEC32_MANT_DIG__ = 7
  948. const m___DEC32_MAX_EXP__ = 97
  949. const m___DEC32_MAX__ = 9.999999e96
  950. const m___DEC32_MIN__ = 1e-95
  951. const m___DEC32_SUBNORMAL_MIN__ = 0.000001e-95
  952. const m___DEC64_EPSILON__ = 1e-15
  953. const m___DEC64_MANT_DIG__ = 16
  954. const m___DEC64_MAX_EXP__ = 385
  955. const m___DEC64_MAX__ = "9.999999999999999E384"
  956. const m___DEC64_MIN__ = 1e-383
  957. const m___DEC64_SUBNORMAL_MIN__ = 0.000000000000001e-383
  958. const m___DECIMAL_DIG__ = 17
  959. const m___DEC_EVAL_METHOD__ = 2
  960. const m___ELF__ = 1
  961. const m___FINITE_MATH_ONLY__ = 0
  962. const m___FLOAT_WORD_ORDER__ = "__ORDER_BIG_ENDIAN__"
  963. const m___FLT32X_DECIMAL_DIG__ = 17
  964. const m___FLT32X_DENORM_MIN__ = 4.9406564584124654e-324
  965. const m___FLT32X_DIG__ = 15
  966. const m___FLT32X_EPSILON__ = 2.2204460492503131e-16
  967. const m___FLT32X_HAS_DENORM__ = 1
  968. const m___FLT32X_HAS_INFINITY__ = 1
  969. const m___FLT32X_HAS_QUIET_NAN__ = 1
  970. const m___FLT32X_MANT_DIG__ = 53
  971. const m___FLT32X_MAX_10_EXP__ = 308
  972. const m___FLT32X_MAX_EXP__ = 1024
  973. const m___FLT32X_MAX__ = 1.7976931348623157e+308
  974. const m___FLT32X_MIN__ = 2.2250738585072014e-308
  975. const m___FLT32X_NORM_MAX__ = 1.7976931348623157e+308
  976. const m___FLT32_DECIMAL_DIG__ = 9
  977. const m___FLT32_DENORM_MIN__ = 1.4012984643248171e-45
  978. const m___FLT32_DIG__ = 6
  979. const m___FLT32_EPSILON__ = 1.1920928955078125e-7
  980. const m___FLT32_HAS_DENORM__ = 1
  981. const m___FLT32_HAS_INFINITY__ = 1
  982. const m___FLT32_HAS_QUIET_NAN__ = 1
  983. const m___FLT32_MANT_DIG__ = 24
  984. const m___FLT32_MAX_10_EXP__ = 38
  985. const m___FLT32_MAX_EXP__ = 128
  986. const m___FLT32_MAX__ = 3.4028234663852886e+38
  987. const m___FLT32_MIN__ = 1.1754943508222875e-38
  988. const m___FLT32_NORM_MAX__ = 3.4028234663852886e+38
  989. const m___FLT64_DECIMAL_DIG__ = 17
  990. const m___FLT64_DENORM_MIN__ = 4.9406564584124654e-324
  991. const m___FLT64_DIG__ = 15
  992. const m___FLT64_EPSILON__ = 2.2204460492503131e-16
  993. const m___FLT64_HAS_DENORM__ = 1
  994. const m___FLT64_HAS_INFINITY__ = 1
  995. const m___FLT64_HAS_QUIET_NAN__ = 1
  996. const m___FLT64_MANT_DIG__ = 53
  997. const m___FLT64_MAX_10_EXP__ = 308
  998. const m___FLT64_MAX_EXP__ = 1024
  999. const m___FLT64_MAX__ = 1.7976931348623157e+308
  1000. const m___FLT64_MIN__ = 2.2250738585072014e-308
  1001. const m___FLT64_NORM_MAX__ = 1.7976931348623157e+308
  1002. const m___FLT_DECIMAL_DIG__ = 9
  1003. const m___FLT_DENORM_MIN__ = 1.4012984643248171e-45
  1004. const m___FLT_DIG__ = 6
  1005. const m___FLT_EPSILON__ = 1.1920928955078125e-7
  1006. const m___FLT_EVAL_METHOD_TS_18661_3__ = 0
  1007. const m___FLT_EVAL_METHOD__ = 0
  1008. const m___FLT_HAS_DENORM__ = 1
  1009. const m___FLT_HAS_INFINITY__ = 1
  1010. const m___FLT_HAS_QUIET_NAN__ = 1
  1011. const m___FLT_MANT_DIG__ = 24
  1012. const m___FLT_MAX_10_EXP__ = 38
  1013. const m___FLT_MAX_EXP__ = 128
  1014. const m___FLT_MAX__ = 3.4028234663852886e+38
  1015. const m___FLT_MIN__ = 1.1754943508222875e-38
  1016. const m___FLT_NORM_MAX__ = 3.4028234663852886e+38
  1017. const m___FLT_RADIX__ = 2
  1018. const m___FP_FAST_FMA = 1
  1019. const m___FP_FAST_FMAF = 1
  1020. const m___FP_FAST_FMAF32 = 1
  1021. const m___FP_FAST_FMAF32x = 1
  1022. const m___FP_FAST_FMAF64 = 1
  1023. const m___FP_FAST_FMAL = 1
  1024. const m___FUNCTION__ = "__func__"
  1025. const m___GCC_ATOMIC_BOOL_LOCK_FREE = 2
  1026. const m___GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2
  1027. const m___GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2
  1028. const m___GCC_ATOMIC_CHAR_LOCK_FREE = 2
  1029. const m___GCC_ATOMIC_INT_LOCK_FREE = 2
  1030. const m___GCC_ATOMIC_LLONG_LOCK_FREE = 2
  1031. const m___GCC_ATOMIC_LONG_LOCK_FREE = 2
  1032. const m___GCC_ATOMIC_POINTER_LOCK_FREE = 2
  1033. const m___GCC_ATOMIC_SHORT_LOCK_FREE = 2
  1034. const m___GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1
  1035. const m___GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2
  1036. const m___GCC_HAVE_DWARF2_CFI_ASM = 1
  1037. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1
  1038. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 = 1
  1039. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1
  1040. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1
  1041. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1
  1042. const m___GCC_IEC_559 = 2
  1043. const m___GCC_IEC_559_COMPLEX = 2
  1044. const m___GNUC_MINOR__ = 2
  1045. const m___GNUC_PATCHLEVEL__ = 1
  1046. const m___GNUC_STDC_INLINE__ = 1
  1047. const m___GNUC__ = 10
  1048. const m___GXX_ABI_VERSION = 1014
  1049. const m___HAVE_SPECULATION_SAFE_VALUE = 1
  1050. const m___INT16_MAX__ = 0x7fff
  1051. const m___INT32_MAX__ = 0x7fffffff
  1052. const m___INT32_TYPE__ = "int"
  1053. const m___INT64_MAX__ = 0x7fffffffffffffff
  1054. const m___INT8_MAX__ = 0x7f
  1055. const m___INTMAX_MAX__ = 0x7fffffffffffffff
  1056. const m___INTMAX_WIDTH__ = 64
  1057. const m___INTPTR_MAX__ = 0x7fffffffffffffff
  1058. const m___INTPTR_WIDTH__ = 64
  1059. const m___INT_FAST16_MAX__ = 0x7fffffffffffffff
  1060. const m___INT_FAST16_WIDTH__ = 64
  1061. const m___INT_FAST32_MAX__ = 0x7fffffffffffffff
  1062. const m___INT_FAST32_WIDTH__ = 64
  1063. const m___INT_FAST64_MAX__ = 0x7fffffffffffffff
  1064. const m___INT_FAST64_WIDTH__ = 64
  1065. const m___INT_FAST8_MAX__ = 0x7f
  1066. const m___INT_FAST8_WIDTH__ = 8
  1067. const m___INT_LEAST16_MAX__ = 0x7fff
  1068. const m___INT_LEAST16_WIDTH__ = 16
  1069. const m___INT_LEAST32_MAX__ = 0x7fffffff
  1070. const m___INT_LEAST32_TYPE__ = "int"
  1071. const m___INT_LEAST32_WIDTH__ = 32
  1072. const m___INT_LEAST64_MAX__ = 0x7fffffffffffffff
  1073. const m___INT_LEAST64_WIDTH__ = 64
  1074. const m___INT_LEAST8_MAX__ = 0x7f
  1075. const m___INT_LEAST8_WIDTH__ = 8
  1076. const m___INT_MAX__ = 0x7fffffff
  1077. const m___INT_WIDTH__ = 32
  1078. const m___LDBL_DECIMAL_DIG__ = 17
  1079. const m___LDBL_DENORM_MIN__ = 4.9406564584124654e-324
  1080. const m___LDBL_DIG__ = 15
  1081. const m___LDBL_EPSILON__ = 2.2204460492503131e-16
  1082. const m___LDBL_HAS_DENORM__ = 1
  1083. const m___LDBL_HAS_INFINITY__ = 1
  1084. const m___LDBL_HAS_QUIET_NAN__ = 1
  1085. const m___LDBL_MANT_DIG__ = 53
  1086. const m___LDBL_MAX_10_EXP__ = 308
  1087. const m___LDBL_MAX_EXP__ = 1024
  1088. const m___LDBL_MAX__ = 1.7976931348623157e+308
  1089. const m___LDBL_MIN__ = 2.2250738585072014e-308
  1090. const m___LDBL_NORM_MAX__ = 1.7976931348623157e+308
  1091. const m___LITTLE_ENDIAN = 1234
  1092. const m___LONG_LONG_MAX__ = 0x7fffffffffffffff
  1093. const m___LONG_LONG_WIDTH__ = 64
  1094. const m___LONG_MAX = 0x7fffffffffffffff
  1095. const m___LONG_MAX__ = 0x7fffffffffffffff
  1096. const m___LONG_WIDTH__ = 64
  1097. const m___LP64__ = 1
  1098. const m___NO_INLINE__ = 1
  1099. const m___ORDER_BIG_ENDIAN__ = 4321
  1100. const m___ORDER_LITTLE_ENDIAN__ = 1234
  1101. const m___ORDER_PDP_ENDIAN__ = 3412
  1102. const m___PDP_ENDIAN = 3412
  1103. const m___PIC__ = 2
  1104. const m___PIE__ = 2
  1105. const m___PRAGMA_REDEFINE_EXTNAME = 1
  1106. const m___PRETTY_FUNCTION__ = "__func__"
  1107. const m___PTRDIFF_MAX__ = 0x7fffffffffffffff
  1108. const m___PTRDIFF_WIDTH__ = 64
  1109. const m___SCHAR_MAX__ = 0x7f
  1110. const m___SCHAR_WIDTH__ = 8
  1111. const m___SHRT_MAX__ = 0x7fff
  1112. const m___SHRT_WIDTH__ = 16
  1113. const m___SIG_ATOMIC_MAX__ = 0x7fffffff
  1114. const m___SIG_ATOMIC_TYPE__ = "int"
  1115. const m___SIG_ATOMIC_WIDTH__ = 32
  1116. const m___SIZEOF_DOUBLE__ = 8
  1117. const m___SIZEOF_FLOAT__ = 4
  1118. const m___SIZEOF_INT128__ = 16
  1119. const m___SIZEOF_INT__ = 4
  1120. const m___SIZEOF_LONG_DOUBLE__ = 8
  1121. const m___SIZEOF_LONG_LONG__ = 8
  1122. const m___SIZEOF_LONG__ = 8
  1123. const m___SIZEOF_POINTER__ = 8
  1124. const m___SIZEOF_PTRDIFF_T__ = 8
  1125. const m___SIZEOF_SHORT__ = 2
  1126. const m___SIZEOF_SIZE_T__ = 8
  1127. const m___SIZEOF_WCHAR_T__ = 4
  1128. const m___SIZEOF_WINT_T__ = 4
  1129. const m___SIZE_MAX__ = 0xffffffffffffffff
  1130. const m___SIZE_WIDTH__ = 64
  1131. const m___STDC_HOSTED__ = 1
  1132. const m___STDC_IEC_559_COMPLEX__ = 1
  1133. const m___STDC_IEC_559__ = 1
  1134. const m___STDC_ISO_10646__ = 201706
  1135. const m___STDC_UTF_16__ = 1
  1136. const m___STDC_UTF_32__ = 1
  1137. const m___STDC_VERSION__ = 201710
  1138. const m___STDC__ = 1
  1139. const m___UINT16_MAX__ = 0xffff
  1140. const m___UINT32_MAX__ = 0xffffffff
  1141. const m___UINT64_MAX__ = 0xffffffffffffffff
  1142. const m___UINT8_MAX__ = 0xff
  1143. const m___UINTMAX_MAX__ = 0xffffffffffffffff
  1144. const m___UINTPTR_MAX__ = 0xffffffffffffffff
  1145. const m___UINT_FAST16_MAX__ = 0xffffffffffffffff
  1146. const m___UINT_FAST32_MAX__ = 0xffffffffffffffff
  1147. const m___UINT_FAST64_MAX__ = 0xffffffffffffffff
  1148. const m___UINT_FAST8_MAX__ = 0xff
  1149. const m___UINT_LEAST16_MAX__ = 0xffff
  1150. const m___UINT_LEAST32_MAX__ = 0xffffffff
  1151. const m___UINT_LEAST64_MAX__ = 0xffffffffffffffff
  1152. const m___UINT_LEAST8_MAX__ = 0xff
  1153. const m___USE_TIME_BITS64 = 1
  1154. const m___VERSION__ = "10.2.1 20210110"
  1155. const m___WCHAR_MAX__ = 0x7fffffff
  1156. const m___WCHAR_TYPE__ = "int"
  1157. const m___WCHAR_WIDTH__ = 32
  1158. const m___WINT_MAX__ = 0xffffffff
  1159. const m___WINT_MIN__ = 0
  1160. const m___WINT_WIDTH__ = 32
  1161. const m___gnu_linux__ = 1
  1162. const m___inline = "inline"
  1163. const m___linux = 1
  1164. const m___linux__ = 1
  1165. const m___pic__ = 2
  1166. const m___pie__ = 2
  1167. const m___restrict = "restrict"
  1168. const m___restrict_arr = "restrict"
  1169. const m___s390__ = 1
  1170. const m___s390x__ = 1
  1171. const m___unix = 1
  1172. const m___unix__ = 1
  1173. const m___zarch__ = 1
  1174. const m_alloca = "__builtin_alloca"
  1175. const m_inline = "__inline"
  1176. const m_linux = 1
  1177. const m_loff_t = "off_t"
  1178. const m_static_assert = "_Static_assert"
  1179. const m_unix = 1
  1180. type t__builtin_va_list = uintptr
  1181. type t__predefined_size_t = uint64
  1182. type t__predefined_wchar_t = int32
  1183. type t__predefined_ptrdiff_t = int64
  1184. type Twchar_t = int32
  1185. type Tmax_align_t = struct {
  1186. F__ll int64
  1187. F__ld float64
  1188. }
  1189. type Tsize_t = uint64
  1190. type Tptrdiff_t = int64
  1191. type Tlocale_t = uintptr
  1192. type Tssize_t = int64
  1193. type Toff_t = int64
  1194. type Tva_list = uintptr
  1195. type t__isoc_va_list = uintptr
  1196. type Tfpos_t = struct {
  1197. F__lldata [0]int64
  1198. F__align [0]float64
  1199. F__opaque [16]uint8
  1200. }
  1201. type T_G_fpos64_t = Tfpos_t
  1202. type Tcookie_io_functions_t = struct {
  1203. Fread uintptr
  1204. Fwrite uintptr
  1205. Fseek uintptr
  1206. Fclose1 uintptr
  1207. }
  1208. type T_IO_cookie_io_functions_t = Tcookie_io_functions_t
  1209. type Tdiv_t = struct {
  1210. Fquot int32
  1211. Frem int32
  1212. }
  1213. type Tldiv_t = struct {
  1214. Fquot int64
  1215. Frem int64
  1216. }
  1217. type Tlldiv_t = struct {
  1218. Fquot int64
  1219. Frem int64
  1220. }
  1221. type Tuintptr_t = uint64
  1222. type Tintptr_t = int64
  1223. type Tint8_t = int8
  1224. type Tint16_t = int16
  1225. type Tint32_t = int32
  1226. type Tint64_t = int64
  1227. type Tintmax_t = int64
  1228. type Tuint8_t = uint8
  1229. type Tuint16_t = uint16
  1230. type Tuint32_t = uint32
  1231. type Tuint64_t = uint64
  1232. type Tuintmax_t = uint64
  1233. type Tint_fast8_t = int8
  1234. type Tint_fast64_t = int64
  1235. type Tint_least8_t = int8
  1236. type Tint_least16_t = int16
  1237. type Tint_least32_t = int32
  1238. type Tint_least64_t = int64
  1239. type Tuint_fast8_t = uint8
  1240. type Tuint_fast64_t = uint64
  1241. type Tuint_least8_t = uint8
  1242. type Tuint_least16_t = uint16
  1243. type Tuint_least32_t = uint32
  1244. type Tuint_least64_t = uint64
  1245. type Tint_fast16_t = int32
  1246. type Tint_fast32_t = int32
  1247. type Tuint_fast16_t = uint32
  1248. type Tuint_fast32_t = uint32
  1249. type Ttime_t = int64
  1250. type Tsuseconds_t = int64
  1251. type Ttimeval = struct {
  1252. Ftv_sec Ttime_t
  1253. Ftv_usec Tsuseconds_t
  1254. }
  1255. type Ttimespec = struct {
  1256. Ftv_sec Ttime_t
  1257. Ftv_nsec int64
  1258. }
  1259. type Tsigset_t = struct {
  1260. F__bits [16]uint64
  1261. }
  1262. type t__sigset_t = Tsigset_t
  1263. type Tfd_mask = uint64
  1264. type Tfd_set = struct {
  1265. Ffds_bits [16]uint64
  1266. }
  1267. type Titimerval = struct {
  1268. Fit_interval Ttimeval
  1269. Fit_value Ttimeval
  1270. }
  1271. type Ttimezone = struct {
  1272. Ftz_minuteswest int32
  1273. Ftz_dsttime int32
  1274. }
  1275. type Tregister_t = int64
  1276. type Tu_int64_t = uint64
  1277. type Tmode_t = uint32
  1278. type Tnlink_t = uint64
  1279. type Tino_t = uint64
  1280. type Tdev_t = uint64
  1281. type Tblksize_t = int64
  1282. type Tblkcnt_t = int64
  1283. type Tfsblkcnt_t = uint64
  1284. type Tfsfilcnt_t = uint64
  1285. type Ttimer_t = uintptr
  1286. type Tclockid_t = int32
  1287. type Tclock_t = int64
  1288. type Tpid_t = int32
  1289. type Tid_t = uint32
  1290. type Tuid_t = uint32
  1291. type Tgid_t = uint32
  1292. type Tkey_t = int32
  1293. type Tuseconds_t = uint32
  1294. type Tpthread_t = uintptr
  1295. type Tpthread_once_t = int32
  1296. type Tpthread_key_t = uint32
  1297. type Tpthread_spinlock_t = int32
  1298. type Tpthread_mutexattr_t = struct {
  1299. F__attr uint32
  1300. }
  1301. type Tpthread_condattr_t = struct {
  1302. F__attr uint32
  1303. }
  1304. type Tpthread_barrierattr_t = struct {
  1305. F__attr uint32
  1306. }
  1307. type Tpthread_rwlockattr_t = struct {
  1308. F__attr [2]uint32
  1309. }
  1310. type Tpthread_attr_t = struct {
  1311. F__u struct {
  1312. F__vi [0][14]int32
  1313. F__s [0][7]uint64
  1314. F__i [14]int32
  1315. }
  1316. }
  1317. type Tpthread_mutex_t = struct {
  1318. F__u struct {
  1319. F__vi [0][10]int32
  1320. F__p [0][5]uintptr
  1321. F__i [10]int32
  1322. }
  1323. }
  1324. type Tpthread_cond_t = struct {
  1325. F__u struct {
  1326. F__vi [0][12]int32
  1327. F__p [0][6]uintptr
  1328. F__i [12]int32
  1329. }
  1330. }
  1331. type Tpthread_rwlock_t = struct {
  1332. F__u struct {
  1333. F__vi [0][14]int32
  1334. F__p [0][7]uintptr
  1335. F__i [14]int32
  1336. }
  1337. }
  1338. type Tpthread_barrier_t = struct {
  1339. F__u struct {
  1340. F__vi [0][8]int32
  1341. F__p [0][4]uintptr
  1342. F__i [8]int32
  1343. }
  1344. }
  1345. type Tu_int8_t = uint8
  1346. type Tu_int16_t = uint16
  1347. type Tu_int32_t = uint32
  1348. type Tcaddr_t = uintptr
  1349. type Tu_char = uint8
  1350. type Tu_short = uint16
  1351. type Tushort = uint16
  1352. type Tu_int = uint32
  1353. type Tuint = uint32
  1354. type Tu_long = uint64
  1355. type Tulong = uint64
  1356. type Tquad_t = int64
  1357. type Tu_quad_t = uint64
  1358. type Tiovec = struct {
  1359. Fiov_base uintptr
  1360. Fiov_len Tsize_t
  1361. }
  1362. type Tflock = struct {
  1363. Fl_type int16
  1364. Fl_whence int16
  1365. Fl_start Toff_t
  1366. Fl_len Toff_t
  1367. Fl_pid Tpid_t
  1368. }
  1369. type Tfile_handle = struct {
  1370. Fhandle_bytes uint32
  1371. Fhandle_type int32
  1372. }
  1373. type Tf_owner_ex = struct {
  1374. Ftype1 int32
  1375. Fpid Tpid_t
  1376. }
  1377. type TXML_Char = uint8
  1378. type TXML_LChar = uint8
  1379. type TXML_Index = int64
  1380. type TXML_Size = uint64
  1381. type TXML_ParserStruct = struct {
  1382. Fm_userData uintptr
  1383. Fm_handlerArg uintptr
  1384. Fm_buffer uintptr
  1385. Fm_mem TXML_Memory_Handling_Suite
  1386. Fm_bufferPtr uintptr
  1387. Fm_bufferEnd uintptr
  1388. Fm_bufferLim uintptr
  1389. Fm_parseEndByteIndex TXML_Index
  1390. Fm_parseEndPtr uintptr
  1391. Fm_dataBuf uintptr
  1392. Fm_dataBufEnd uintptr
  1393. Fm_startElementHandler TXML_StartElementHandler
  1394. Fm_endElementHandler TXML_EndElementHandler
  1395. Fm_characterDataHandler TXML_CharacterDataHandler
  1396. Fm_processingInstructionHandler TXML_ProcessingInstructionHandler
  1397. Fm_commentHandler TXML_CommentHandler
  1398. Fm_startCdataSectionHandler TXML_StartCdataSectionHandler
  1399. Fm_endCdataSectionHandler TXML_EndCdataSectionHandler
  1400. Fm_defaultHandler TXML_DefaultHandler
  1401. Fm_startDoctypeDeclHandler TXML_StartDoctypeDeclHandler
  1402. Fm_endDoctypeDeclHandler TXML_EndDoctypeDeclHandler
  1403. Fm_unparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  1404. Fm_notationDeclHandler TXML_NotationDeclHandler
  1405. Fm_startNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  1406. Fm_endNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  1407. Fm_notStandaloneHandler TXML_NotStandaloneHandler
  1408. Fm_externalEntityRefHandler TXML_ExternalEntityRefHandler
  1409. Fm_externalEntityRefHandlerArg TXML_Parser
  1410. Fm_skippedEntityHandler TXML_SkippedEntityHandler
  1411. Fm_unknownEncodingHandler TXML_UnknownEncodingHandler
  1412. Fm_elementDeclHandler TXML_ElementDeclHandler
  1413. Fm_attlistDeclHandler TXML_AttlistDeclHandler
  1414. Fm_entityDeclHandler TXML_EntityDeclHandler
  1415. Fm_xmlDeclHandler TXML_XmlDeclHandler
  1416. Fm_encoding uintptr
  1417. Fm_initEncoding TINIT_ENCODING
  1418. Fm_internalEncoding uintptr
  1419. Fm_protocolEncodingName uintptr
  1420. Fm_ns TXML_Bool
  1421. Fm_ns_triplets TXML_Bool
  1422. Fm_unknownEncodingMem uintptr
  1423. Fm_unknownEncodingData uintptr
  1424. Fm_unknownEncodingHandlerData uintptr
  1425. Fm_unknownEncodingRelease uintptr
  1426. Fm_prologState TPROLOG_STATE
  1427. Fm_processor uintptr
  1428. Fm_errorCode _XML_Error
  1429. Fm_eventPtr uintptr
  1430. Fm_eventEndPtr uintptr
  1431. Fm_positionPtr uintptr
  1432. Fm_openInternalEntities uintptr
  1433. Fm_freeInternalEntities uintptr
  1434. Fm_defaultExpandInternalEntities TXML_Bool
  1435. Fm_tagLevel int32
  1436. Fm_declEntity uintptr
  1437. Fm_doctypeName uintptr
  1438. Fm_doctypeSysid uintptr
  1439. Fm_doctypePubid uintptr
  1440. Fm_declAttributeType uintptr
  1441. Fm_declNotationName uintptr
  1442. Fm_declNotationPublicId uintptr
  1443. Fm_declElementType uintptr
  1444. Fm_declAttributeId uintptr
  1445. Fm_declAttributeIsCdata TXML_Bool
  1446. Fm_declAttributeIsId TXML_Bool
  1447. Fm_dtd uintptr
  1448. Fm_curBase uintptr
  1449. Fm_tagStack uintptr
  1450. Fm_freeTagList uintptr
  1451. Fm_inheritedBindings uintptr
  1452. Fm_freeBindingList uintptr
  1453. Fm_attsSize int32
  1454. Fm_nSpecifiedAtts int32
  1455. Fm_idAttIndex int32
  1456. Fm_atts uintptr
  1457. Fm_nsAtts uintptr
  1458. Fm_nsAttsVersion uint64
  1459. Fm_nsAttsPower uint8
  1460. Fm_position TPOSITION
  1461. Fm_tempPool TSTRING_POOL
  1462. Fm_temp2Pool TSTRING_POOL
  1463. Fm_groupConnector uintptr
  1464. Fm_groupSize uint32
  1465. Fm_namespaceSeparator TXML_Char
  1466. Fm_parentParser TXML_Parser
  1467. Fm_parsingStatus TXML_ParsingStatus
  1468. Fm_isParamEntity TXML_Bool
  1469. Fm_useForeignDTD TXML_Bool
  1470. Fm_paramEntityParsing _XML_ParamEntityParsing
  1471. Fm_hash_secret_salt uint64
  1472. }
  1473. type _XML_Error = int32
  1474. const _XML_ERROR_NONE = 0
  1475. const _XML_ERROR_NO_MEMORY = 1
  1476. const _XML_ERROR_SYNTAX = 2
  1477. const _XML_ERROR_NO_ELEMENTS = 3
  1478. const _XML_ERROR_INVALID_TOKEN = 4
  1479. const _XML_ERROR_UNCLOSED_TOKEN = 5
  1480. const _XML_ERROR_PARTIAL_CHAR = 6
  1481. const _XML_ERROR_TAG_MISMATCH = 7
  1482. const _XML_ERROR_DUPLICATE_ATTRIBUTE = 8
  1483. const _XML_ERROR_JUNK_AFTER_DOC_ELEMENT = 9
  1484. const _XML_ERROR_PARAM_ENTITY_REF = 10
  1485. const _XML_ERROR_UNDEFINED_ENTITY = 11
  1486. const _XML_ERROR_RECURSIVE_ENTITY_REF = 12
  1487. const _XML_ERROR_ASYNC_ENTITY = 13
  1488. const _XML_ERROR_BAD_CHAR_REF = 14
  1489. const _XML_ERROR_BINARY_ENTITY_REF = 15
  1490. const _XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF = 16
  1491. const _XML_ERROR_MISPLACED_XML_PI = 17
  1492. const _XML_ERROR_UNKNOWN_ENCODING = 18
  1493. const _XML_ERROR_INCORRECT_ENCODING = 19
  1494. const _XML_ERROR_UNCLOSED_CDATA_SECTION = 20
  1495. const _XML_ERROR_EXTERNAL_ENTITY_HANDLING = 21
  1496. const _XML_ERROR_NOT_STANDALONE = 22
  1497. const _XML_ERROR_UNEXPECTED_STATE = 23
  1498. const _XML_ERROR_ENTITY_DECLARED_IN_PE = 24
  1499. const _XML_ERROR_FEATURE_REQUIRES_XML_DTD = 25
  1500. const _XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING = 26
  1501. const _XML_ERROR_UNBOUND_PREFIX = 27
  1502. const _XML_ERROR_UNDECLARING_PREFIX = 28
  1503. const _XML_ERROR_INCOMPLETE_PE = 29
  1504. const _XML_ERROR_XML_DECL = 30
  1505. const _XML_ERROR_TEXT_DECL = 31
  1506. const _XML_ERROR_PUBLICID = 32
  1507. const _XML_ERROR_SUSPENDED = 33
  1508. const _XML_ERROR_NOT_SUSPENDED = 34
  1509. const _XML_ERROR_ABORTED = 35
  1510. const _XML_ERROR_FINISHED = 36
  1511. const _XML_ERROR_SUSPEND_PE = 37
  1512. const _XML_ERROR_RESERVED_PREFIX_XML = 38
  1513. const _XML_ERROR_RESERVED_PREFIX_XMLNS = 39
  1514. const _XML_ERROR_RESERVED_NAMESPACE_URI = 40
  1515. const _XML_ERROR_INVALID_ARGUMENT = 41
  1516. type _XML_ParamEntityParsing = int32
  1517. const _XML_PARAM_ENTITY_PARSING_NEVER = 0
  1518. const _XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE = 1
  1519. const _XML_PARAM_ENTITY_PARSING_ALWAYS = 2
  1520. type TXML_Parser = uintptr
  1521. type TXML_Bool = uint8
  1522. type _XML_Status = int32
  1523. const _XML_STATUS_ERROR = 0
  1524. const _XML_STATUS_OK = 1
  1525. const _XML_STATUS_SUSPENDED = 2
  1526. type _XML_Content_Type = int32
  1527. const _XML_CTYPE_EMPTY = 1
  1528. const _XML_CTYPE_ANY = 2
  1529. const _XML_CTYPE_MIXED = 3
  1530. const _XML_CTYPE_NAME = 4
  1531. const _XML_CTYPE_CHOICE = 5
  1532. const _XML_CTYPE_SEQ = 6
  1533. type _XML_Content_Quant = int32
  1534. const _XML_CQUANT_NONE = 0
  1535. const _XML_CQUANT_OPT = 1
  1536. const _XML_CQUANT_REP = 2
  1537. const _XML_CQUANT_PLUS = 3
  1538. type TXML_Content = struct {
  1539. Ftype1 _XML_Content_Type
  1540. Fquant _XML_Content_Quant
  1541. Fname uintptr
  1542. Fnumchildren uint32
  1543. Fchildren uintptr
  1544. }
  1545. type TXML_cp = TXML_Content
  1546. type TXML_ElementDeclHandler = uintptr
  1547. type TXML_AttlistDeclHandler = uintptr
  1548. type TXML_XmlDeclHandler = uintptr
  1549. type TXML_Memory_Handling_Suite = struct {
  1550. Fmalloc_fcn uintptr
  1551. Frealloc_fcn uintptr
  1552. Ffree_fcn uintptr
  1553. }
  1554. type TXML_StartElementHandler = uintptr
  1555. type TXML_EndElementHandler = uintptr
  1556. type TXML_CharacterDataHandler = uintptr
  1557. type TXML_ProcessingInstructionHandler = uintptr
  1558. type TXML_CommentHandler = uintptr
  1559. type TXML_StartCdataSectionHandler = uintptr
  1560. type TXML_EndCdataSectionHandler = uintptr
  1561. type TXML_DefaultHandler = uintptr
  1562. type TXML_StartDoctypeDeclHandler = uintptr
  1563. type TXML_EndDoctypeDeclHandler = uintptr
  1564. type TXML_EntityDeclHandler = uintptr
  1565. type TXML_UnparsedEntityDeclHandler = uintptr
  1566. type TXML_NotationDeclHandler = uintptr
  1567. type TXML_StartNamespaceDeclHandler = uintptr
  1568. type TXML_EndNamespaceDeclHandler = uintptr
  1569. type TXML_NotStandaloneHandler = uintptr
  1570. type TXML_ExternalEntityRefHandler = uintptr
  1571. type TXML_SkippedEntityHandler = uintptr
  1572. type TXML_Encoding = struct {
  1573. Fmap1 [256]int32
  1574. Fdata uintptr
  1575. Fconvert uintptr
  1576. Frelease uintptr
  1577. }
  1578. type TXML_UnknownEncodingHandler = uintptr
  1579. type _XML_Parsing = int32
  1580. const _XML_INITIALIZED = 0
  1581. const _XML_PARSING = 1
  1582. const _XML_FINISHED = 2
  1583. const _XML_SUSPENDED = 3
  1584. type TXML_ParsingStatus = struct {
  1585. Fparsing _XML_Parsing
  1586. FfinalBuffer TXML_Bool
  1587. }
  1588. type TXML_Expat_Version = struct {
  1589. Fmajor int32
  1590. Fminor int32
  1591. Fmicro int32
  1592. }
  1593. type _XML_FeatureEnum = int32
  1594. const _XML_FEATURE_END = 0
  1595. const _XML_FEATURE_UNICODE = 1
  1596. const _XML_FEATURE_UNICODE_WCHAR_T = 2
  1597. const _XML_FEATURE_DTD = 3
  1598. const _XML_FEATURE_CONTEXT_BYTES = 4
  1599. const _XML_FEATURE_MIN_SIZE = 5
  1600. const _XML_FEATURE_SIZEOF_XML_CHAR = 6
  1601. const _XML_FEATURE_SIZEOF_XML_LCHAR = 7
  1602. const _XML_FEATURE_NS = 8
  1603. const _XML_FEATURE_LARGE_SIZE = 9
  1604. const _XML_FEATURE_ATTR_INFO = 10
  1605. type TXML_Feature = struct {
  1606. Ffeature _XML_FeatureEnum
  1607. Fname uintptr
  1608. Fvalue int64
  1609. }
  1610. type Tsiphash = struct {
  1611. Fv0 Tuint64_t
  1612. Fv1 Tuint64_t
  1613. Fv2 Tuint64_t
  1614. Fv3 Tuint64_t
  1615. Fbuf [8]uint8
  1616. Fp uintptr
  1617. Fc Tuint64_t
  1618. }
  1619. type Tsipkey = struct {
  1620. Fk [2]Tuint64_t
  1621. }
  1622. func _sip_tokey(tls *libc.TLS, key uintptr, src uintptr) (r uintptr) {
  1623. *(*Tuint64_t)(unsafe.Pointer(key)) = uint64(*(*uint8)(unsafe.Pointer(src)))<<libc.Int32FromInt32(0) | uint64(*(*uint8)(unsafe.Pointer(src + 1)))<<libc.Int32FromInt32(8) | uint64(*(*uint8)(unsafe.Pointer(src + 2)))<<libc.Int32FromInt32(16) | uint64(*(*uint8)(unsafe.Pointer(src + 3)))<<libc.Int32FromInt32(24) | uint64(*(*uint8)(unsafe.Pointer(src + 4)))<<libc.Int32FromInt32(32) | uint64(*(*uint8)(unsafe.Pointer(src + 5)))<<libc.Int32FromInt32(40) | uint64(*(*uint8)(unsafe.Pointer(src + 6)))<<libc.Int32FromInt32(48) | uint64(*(*uint8)(unsafe.Pointer(src + 7)))<<libc.Int32FromInt32(56)
  1624. *(*Tuint64_t)(unsafe.Pointer(key + 1*8)) = uint64(*(*uint8)(unsafe.Pointer(src + libc.UintptrFromInt32(8))))<<libc.Int32FromInt32(0) | uint64(*(*uint8)(unsafe.Pointer(src + libc.UintptrFromInt32(8) + 1)))<<libc.Int32FromInt32(8) | uint64(*(*uint8)(unsafe.Pointer(src + libc.UintptrFromInt32(8) + 2)))<<libc.Int32FromInt32(16) | uint64(*(*uint8)(unsafe.Pointer(src + libc.UintptrFromInt32(8) + 3)))<<libc.Int32FromInt32(24) | uint64(*(*uint8)(unsafe.Pointer(src + libc.UintptrFromInt32(8) + 4)))<<libc.Int32FromInt32(32) | uint64(*(*uint8)(unsafe.Pointer(src + libc.UintptrFromInt32(8) + 5)))<<libc.Int32FromInt32(40) | uint64(*(*uint8)(unsafe.Pointer(src + libc.UintptrFromInt32(8) + 6)))<<libc.Int32FromInt32(48) | uint64(*(*uint8)(unsafe.Pointer(src + libc.UintptrFromInt32(8) + 7)))<<libc.Int32FromInt32(56)
  1625. return key
  1626. }
  1627. func _sip_round(tls *libc.TLS, H uintptr, rounds int32) {
  1628. var i int32
  1629. _ = i
  1630. i = 0
  1631. for {
  1632. if !(i < rounds) {
  1633. break
  1634. }
  1635. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1636. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(13) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(13))
  1637. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1638. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = (*Tsiphash)(unsafe.Pointer(H)).Fv0<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv0>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1639. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1640. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(16) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(16))
  1641. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1642. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1643. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(21) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(21))
  1644. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1645. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1646. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(17) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(17))
  1647. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1648. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = (*Tsiphash)(unsafe.Pointer(H)).Fv2<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv2>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1649. goto _1
  1650. _1:
  1651. ;
  1652. i++
  1653. }
  1654. }
  1655. func _sip24_init(tls *libc.TLS, H uintptr, key uintptr) (r uintptr) {
  1656. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = libc.Uint64FromUint32(0x736f6d65)<<libc.Int32FromInt32(32) | libc.Uint64FromUint32(0x70736575) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1657. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = libc.Uint64FromUint32(0x646f7261)<<libc.Int32FromInt32(32) | libc.Uint64FromUint32(0x6e646f6d) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1658. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = libc.Uint64FromUint32(0x6c796765)<<libc.Int32FromInt32(32) | libc.Uint64FromUint32(0x6e657261) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1659. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = libc.Uint64FromUint32(0x74656462)<<libc.Int32FromInt32(32) | libc.Uint64FromUint32(0x79746573) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1660. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1661. (*Tsiphash)(unsafe.Pointer(H)).Fc = uint64(0)
  1662. return H
  1663. }
  1664. func _sip24_update(tls *libc.TLS, H uintptr, src uintptr, len1 Tsize_t) (r uintptr) {
  1665. var m Tuint64_t
  1666. var p, pe, v1, v2, v3 uintptr
  1667. _, _, _, _, _, _ = m, p, pe, v1, v2, v3
  1668. p = src
  1669. pe = p + uintptr(len1)
  1670. for cond := true; cond; cond = p < pe {
  1671. for p < pe && (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)) {
  1672. v2 = H + 40
  1673. v1 = *(*uintptr)(unsafe.Pointer(v2))
  1674. *(*uintptr)(unsafe.Pointer(v2))++
  1675. v3 = p
  1676. p++
  1677. *(*uint8)(unsafe.Pointer(v1)) = *(*uint8)(unsafe.Pointer(v3))
  1678. }
  1679. if (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)) {
  1680. break
  1681. }
  1682. m = uint64(*(*uint8)(unsafe.Pointer(H + 32)))<<libc.Int32FromInt32(0) | uint64(*(*uint8)(unsafe.Pointer(H + 32 + 1)))<<libc.Int32FromInt32(8) | uint64(*(*uint8)(unsafe.Pointer(H + 32 + 2)))<<libc.Int32FromInt32(16) | uint64(*(*uint8)(unsafe.Pointer(H + 32 + 3)))<<libc.Int32FromInt32(24) | uint64(*(*uint8)(unsafe.Pointer(H + 32 + 4)))<<libc.Int32FromInt32(32) | uint64(*(*uint8)(unsafe.Pointer(H + 32 + 5)))<<libc.Int32FromInt32(40) | uint64(*(*uint8)(unsafe.Pointer(H + 32 + 6)))<<libc.Int32FromInt32(48) | uint64(*(*uint8)(unsafe.Pointer(H + 32 + 7)))<<libc.Int32FromInt32(56)
  1683. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= m
  1684. _sip_round(tls, H, int32(2))
  1685. *(*Tuint64_t)(unsafe.Pointer(H)) ^= m
  1686. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1687. *(*Tuint64_t)(unsafe.Pointer(H + 48)) += uint64(8)
  1688. }
  1689. return H
  1690. }
  1691. func _sip24_final(tls *libc.TLS, H uintptr) (r Tuint64_t) {
  1692. var b Tuint64_t
  1693. var left uint8
  1694. _, _ = b, left
  1695. left = libc.Uint8FromInt64(int64((*Tsiphash)(unsafe.Pointer(H)).Fp) - t__predefined_ptrdiff_t(H+32))
  1696. b = ((*Tsiphash)(unsafe.Pointer(H)).Fc + uint64(left)) << int32(56)
  1697. switch libc.Int32FromUint8(left) {
  1698. case int32(7):
  1699. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 6))) << int32(48)
  1700. fallthrough
  1701. case int32(6):
  1702. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 5))) << int32(40)
  1703. fallthrough
  1704. case int32(5):
  1705. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 4))) << int32(32)
  1706. fallthrough
  1707. case int32(4):
  1708. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 3))) << int32(24)
  1709. fallthrough
  1710. case int32(3):
  1711. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 2))) << int32(16)
  1712. fallthrough
  1713. case int32(2):
  1714. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 1))) << int32(8)
  1715. fallthrough
  1716. case int32(1):
  1717. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32))) << 0
  1718. fallthrough
  1719. case 0:
  1720. break
  1721. }
  1722. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= b
  1723. _sip_round(tls, H, int32(2))
  1724. *(*Tuint64_t)(unsafe.Pointer(H)) ^= b
  1725. *(*Tuint64_t)(unsafe.Pointer(H + 16)) ^= uint64(0xff)
  1726. _sip_round(tls, H, int32(4))
  1727. return (*Tsiphash)(unsafe.Pointer(H)).Fv0 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv1 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv2 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1728. }
  1729. func _siphash24(tls *libc.TLS, src uintptr, len1 Tsize_t, key uintptr) (r Tuint64_t) {
  1730. bp := tls.Alloc(64)
  1731. defer tls.Free(64)
  1732. var _ /* state at bp+0 */ Tsiphash
  1733. *(*Tsiphash)(unsafe.Pointer(bp)) = Tsiphash{}
  1734. return _sip24_final(tls, _sip24_update(tls, _sip24_init(tls, bp, key), src, len1))
  1735. }
  1736. func _sip24_valid(tls *libc.TLS) (r int32) {
  1737. bp := tls.Alloc(80)
  1738. defer tls.Free(80)
  1739. var i Tsize_t
  1740. var _ /* in at bp+0 */ [64]uint8
  1741. var _ /* k at bp+64 */ Tsipkey
  1742. _ = i
  1743. _sip_tokey(tls, bp+64, __ccgo_ts)
  1744. i = uint64(0)
  1745. for {
  1746. if !(i < uint64(64)) {
  1747. break
  1748. }
  1749. (*(*[64]uint8)(unsafe.Pointer(bp)))[i] = uint8(i)
  1750. if _siphash24(tls, bp, i, bp+64) != uint64(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vectors)) + uintptr(i)*8)))<<libc.Int32FromInt32(0)|uint64(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vectors)) + uintptr(i)*8 + 1)))<<libc.Int32FromInt32(8)|uint64(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vectors)) + uintptr(i)*8 + 2)))<<libc.Int32FromInt32(16)|uint64(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vectors)) + uintptr(i)*8 + 3)))<<libc.Int32FromInt32(24)|uint64(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vectors)) + uintptr(i)*8 + 4)))<<libc.Int32FromInt32(32)|uint64(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vectors)) + uintptr(i)*8 + 5)))<<libc.Int32FromInt32(40)|uint64(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vectors)) + uintptr(i)*8 + 6)))<<libc.Int32FromInt32(48)|uint64(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vectors)) + uintptr(i)*8 + 7)))<<libc.Int32FromInt32(56) {
  1751. return 0
  1752. }
  1753. goto _1
  1754. _1:
  1755. ;
  1756. i++
  1757. }
  1758. return int32(1)
  1759. }
  1760. var _vectors = [64][8]uint8{
  1761. 0: {
  1762. 0: uint8(0x31),
  1763. 1: uint8(0x0e),
  1764. 2: uint8(0x0e),
  1765. 3: uint8(0xdd),
  1766. 4: uint8(0x47),
  1767. 5: uint8(0xdb),
  1768. 6: uint8(0x6f),
  1769. 7: uint8(0x72),
  1770. },
  1771. 1: {
  1772. 0: uint8(0xfd),
  1773. 1: uint8(0x67),
  1774. 2: uint8(0xdc),
  1775. 3: uint8(0x93),
  1776. 4: uint8(0xc5),
  1777. 5: uint8(0x39),
  1778. 6: uint8(0xf8),
  1779. 7: uint8(0x74),
  1780. },
  1781. 2: {
  1782. 0: uint8(0x5a),
  1783. 1: uint8(0x4f),
  1784. 2: uint8(0xa9),
  1785. 3: uint8(0xd9),
  1786. 4: uint8(0x09),
  1787. 5: uint8(0x80),
  1788. 6: uint8(0x6c),
  1789. 7: uint8(0x0d),
  1790. },
  1791. 3: {
  1792. 0: uint8(0x2d),
  1793. 1: uint8(0x7e),
  1794. 2: uint8(0xfb),
  1795. 3: uint8(0xd7),
  1796. 4: uint8(0x96),
  1797. 5: uint8(0x66),
  1798. 6: uint8(0x67),
  1799. 7: uint8(0x85),
  1800. },
  1801. 4: {
  1802. 0: uint8(0xb7),
  1803. 1: uint8(0x87),
  1804. 2: uint8(0x71),
  1805. 3: uint8(0x27),
  1806. 4: uint8(0xe0),
  1807. 5: uint8(0x94),
  1808. 6: uint8(0x27),
  1809. 7: uint8(0xcf),
  1810. },
  1811. 5: {
  1812. 0: uint8(0x8d),
  1813. 1: uint8(0xa6),
  1814. 2: uint8(0x99),
  1815. 3: uint8(0xcd),
  1816. 4: uint8(0x64),
  1817. 5: uint8(0x55),
  1818. 6: uint8(0x76),
  1819. 7: uint8(0x18),
  1820. },
  1821. 6: {
  1822. 0: uint8(0xce),
  1823. 1: uint8(0xe3),
  1824. 2: uint8(0xfe),
  1825. 3: uint8(0x58),
  1826. 4: uint8(0x6e),
  1827. 5: uint8(0x46),
  1828. 6: uint8(0xc9),
  1829. 7: uint8(0xcb),
  1830. },
  1831. 7: {
  1832. 0: uint8(0x37),
  1833. 1: uint8(0xd1),
  1834. 2: uint8(0x01),
  1835. 3: uint8(0x8b),
  1836. 4: uint8(0xf5),
  1837. 6: uint8(0x02),
  1838. 7: uint8(0xab),
  1839. },
  1840. 8: {
  1841. 0: uint8(0x62),
  1842. 1: uint8(0x24),
  1843. 2: uint8(0x93),
  1844. 3: uint8(0x9a),
  1845. 4: uint8(0x79),
  1846. 5: uint8(0xf5),
  1847. 6: uint8(0xf5),
  1848. 7: uint8(0x93),
  1849. },
  1850. 9: {
  1851. 0: uint8(0xb0),
  1852. 1: uint8(0xe4),
  1853. 2: uint8(0xa9),
  1854. 3: uint8(0x0b),
  1855. 4: uint8(0xdf),
  1856. 5: uint8(0x82),
  1857. 7: uint8(0x9e),
  1858. },
  1859. 10: {
  1860. 0: uint8(0xf3),
  1861. 1: uint8(0xb9),
  1862. 2: uint8(0xdd),
  1863. 3: uint8(0x94),
  1864. 4: uint8(0xc5),
  1865. 5: uint8(0xbb),
  1866. 6: uint8(0x5d),
  1867. 7: uint8(0x7a),
  1868. },
  1869. 11: {
  1870. 0: uint8(0xa7),
  1871. 1: uint8(0xad),
  1872. 2: uint8(0x6b),
  1873. 3: uint8(0x22),
  1874. 4: uint8(0x46),
  1875. 5: uint8(0x2f),
  1876. 6: uint8(0xb3),
  1877. 7: uint8(0xf4),
  1878. },
  1879. 12: {
  1880. 0: uint8(0xfb),
  1881. 1: uint8(0xe5),
  1882. 2: uint8(0x0e),
  1883. 3: uint8(0x86),
  1884. 4: uint8(0xbc),
  1885. 5: uint8(0x8f),
  1886. 6: uint8(0x1e),
  1887. 7: uint8(0x75),
  1888. },
  1889. 13: {
  1890. 0: uint8(0x90),
  1891. 1: uint8(0x3d),
  1892. 2: uint8(0x84),
  1893. 3: uint8(0xc0),
  1894. 4: uint8(0x27),
  1895. 5: uint8(0x56),
  1896. 6: uint8(0xea),
  1897. 7: uint8(0x14),
  1898. },
  1899. 14: {
  1900. 0: uint8(0xee),
  1901. 1: uint8(0xf2),
  1902. 2: uint8(0x7a),
  1903. 3: uint8(0x8e),
  1904. 4: uint8(0x90),
  1905. 5: uint8(0xca),
  1906. 6: uint8(0x23),
  1907. 7: uint8(0xf7),
  1908. },
  1909. 15: {
  1910. 0: uint8(0xe5),
  1911. 1: uint8(0x45),
  1912. 2: uint8(0xbe),
  1913. 3: uint8(0x49),
  1914. 4: uint8(0x61),
  1915. 5: uint8(0xca),
  1916. 6: uint8(0x29),
  1917. 7: uint8(0xa1),
  1918. },
  1919. 16: {
  1920. 0: uint8(0xdb),
  1921. 1: uint8(0x9b),
  1922. 2: uint8(0xc2),
  1923. 3: uint8(0x57),
  1924. 4: uint8(0x7f),
  1925. 5: uint8(0xcc),
  1926. 6: uint8(0x2a),
  1927. 7: uint8(0x3f),
  1928. },
  1929. 17: {
  1930. 0: uint8(0x94),
  1931. 1: uint8(0x47),
  1932. 2: uint8(0xbe),
  1933. 3: uint8(0x2c),
  1934. 4: uint8(0xf5),
  1935. 5: uint8(0xe9),
  1936. 6: uint8(0x9a),
  1937. 7: uint8(0x69),
  1938. },
  1939. 18: {
  1940. 0: uint8(0x9c),
  1941. 1: uint8(0xd3),
  1942. 2: uint8(0x8d),
  1943. 3: uint8(0x96),
  1944. 4: uint8(0xf0),
  1945. 5: uint8(0xb3),
  1946. 6: uint8(0xc1),
  1947. 7: uint8(0x4b),
  1948. },
  1949. 19: {
  1950. 0: uint8(0xbd),
  1951. 1: uint8(0x61),
  1952. 2: uint8(0x79),
  1953. 3: uint8(0xa7),
  1954. 4: uint8(0x1d),
  1955. 5: uint8(0xc9),
  1956. 6: uint8(0x6d),
  1957. 7: uint8(0xbb),
  1958. },
  1959. 20: {
  1960. 0: uint8(0x98),
  1961. 1: uint8(0xee),
  1962. 2: uint8(0xa2),
  1963. 3: uint8(0x1a),
  1964. 4: uint8(0xf2),
  1965. 5: uint8(0x5c),
  1966. 6: uint8(0xd6),
  1967. 7: uint8(0xbe),
  1968. },
  1969. 21: {
  1970. 0: uint8(0xc7),
  1971. 1: uint8(0x67),
  1972. 2: uint8(0x3b),
  1973. 3: uint8(0x2e),
  1974. 4: uint8(0xb0),
  1975. 5: uint8(0xcb),
  1976. 6: uint8(0xf2),
  1977. 7: uint8(0xd0),
  1978. },
  1979. 22: {
  1980. 0: uint8(0x88),
  1981. 1: uint8(0x3e),
  1982. 2: uint8(0xa3),
  1983. 3: uint8(0xe3),
  1984. 4: uint8(0x95),
  1985. 5: uint8(0x67),
  1986. 6: uint8(0x53),
  1987. 7: uint8(0x93),
  1988. },
  1989. 23: {
  1990. 0: uint8(0xc8),
  1991. 1: uint8(0xce),
  1992. 2: uint8(0x5c),
  1993. 3: uint8(0xcd),
  1994. 4: uint8(0x8c),
  1995. 5: uint8(0x03),
  1996. 6: uint8(0x0c),
  1997. 7: uint8(0xa8),
  1998. },
  1999. 24: {
  2000. 0: uint8(0x94),
  2001. 1: uint8(0xaf),
  2002. 2: uint8(0x49),
  2003. 3: uint8(0xf6),
  2004. 4: uint8(0xc6),
  2005. 5: uint8(0x50),
  2006. 6: uint8(0xad),
  2007. 7: uint8(0xb8),
  2008. },
  2009. 25: {
  2010. 0: uint8(0xea),
  2011. 1: uint8(0xb8),
  2012. 2: uint8(0x85),
  2013. 3: uint8(0x8a),
  2014. 4: uint8(0xde),
  2015. 5: uint8(0x92),
  2016. 6: uint8(0xe1),
  2017. 7: uint8(0xbc),
  2018. },
  2019. 26: {
  2020. 0: uint8(0xf3),
  2021. 1: uint8(0x15),
  2022. 2: uint8(0xbb),
  2023. 3: uint8(0x5b),
  2024. 4: uint8(0xb8),
  2025. 5: uint8(0x35),
  2026. 6: uint8(0xd8),
  2027. 7: uint8(0x17),
  2028. },
  2029. 27: {
  2030. 0: uint8(0xad),
  2031. 1: uint8(0xcf),
  2032. 2: uint8(0x6b),
  2033. 3: uint8(0x07),
  2034. 4: uint8(0x63),
  2035. 5: uint8(0x61),
  2036. 6: uint8(0x2e),
  2037. 7: uint8(0x2f),
  2038. },
  2039. 28: {
  2040. 0: uint8(0xa5),
  2041. 1: uint8(0xc9),
  2042. 2: uint8(0x1d),
  2043. 3: uint8(0xa7),
  2044. 4: uint8(0xac),
  2045. 5: uint8(0xaa),
  2046. 6: uint8(0x4d),
  2047. 7: uint8(0xde),
  2048. },
  2049. 29: {
  2050. 0: uint8(0x71),
  2051. 1: uint8(0x65),
  2052. 2: uint8(0x95),
  2053. 3: uint8(0x87),
  2054. 4: uint8(0x66),
  2055. 5: uint8(0x50),
  2056. 6: uint8(0xa2),
  2057. 7: uint8(0xa6),
  2058. },
  2059. 30: {
  2060. 0: uint8(0x28),
  2061. 1: uint8(0xef),
  2062. 2: uint8(0x49),
  2063. 3: uint8(0x5c),
  2064. 4: uint8(0x53),
  2065. 5: uint8(0xa3),
  2066. 6: uint8(0x87),
  2067. 7: uint8(0xad),
  2068. },
  2069. 31: {
  2070. 0: uint8(0x42),
  2071. 1: uint8(0xc3),
  2072. 2: uint8(0x41),
  2073. 3: uint8(0xd8),
  2074. 4: uint8(0xfa),
  2075. 5: uint8(0x92),
  2076. 6: uint8(0xd8),
  2077. 7: uint8(0x32),
  2078. },
  2079. 32: {
  2080. 0: uint8(0xce),
  2081. 1: uint8(0x7c),
  2082. 2: uint8(0xf2),
  2083. 3: uint8(0x72),
  2084. 4: uint8(0x2f),
  2085. 5: uint8(0x51),
  2086. 6: uint8(0x27),
  2087. 7: uint8(0x71),
  2088. },
  2089. 33: {
  2090. 0: uint8(0xe3),
  2091. 1: uint8(0x78),
  2092. 2: uint8(0x59),
  2093. 3: uint8(0xf9),
  2094. 4: uint8(0x46),
  2095. 5: uint8(0x23),
  2096. 6: uint8(0xf3),
  2097. 7: uint8(0xa7),
  2098. },
  2099. 34: {
  2100. 0: uint8(0x38),
  2101. 1: uint8(0x12),
  2102. 2: uint8(0x05),
  2103. 3: uint8(0xbb),
  2104. 4: uint8(0x1a),
  2105. 5: uint8(0xb0),
  2106. 6: uint8(0xe0),
  2107. 7: uint8(0x12),
  2108. },
  2109. 35: {
  2110. 0: uint8(0xae),
  2111. 1: uint8(0x97),
  2112. 2: uint8(0xa1),
  2113. 3: uint8(0x0f),
  2114. 4: uint8(0xd4),
  2115. 5: uint8(0x34),
  2116. 6: uint8(0xe0),
  2117. 7: uint8(0x15),
  2118. },
  2119. 36: {
  2120. 0: uint8(0xb4),
  2121. 1: uint8(0xa3),
  2122. 2: uint8(0x15),
  2123. 3: uint8(0x08),
  2124. 4: uint8(0xbe),
  2125. 5: uint8(0xff),
  2126. 6: uint8(0x4d),
  2127. 7: uint8(0x31),
  2128. },
  2129. 37: {
  2130. 0: uint8(0x81),
  2131. 1: uint8(0x39),
  2132. 2: uint8(0x62),
  2133. 3: uint8(0x29),
  2134. 4: uint8(0xf0),
  2135. 5: uint8(0x90),
  2136. 6: uint8(0x79),
  2137. 7: uint8(0x02),
  2138. },
  2139. 38: {
  2140. 0: uint8(0x4d),
  2141. 1: uint8(0x0c),
  2142. 2: uint8(0xf4),
  2143. 3: uint8(0x9e),
  2144. 4: uint8(0xe5),
  2145. 5: uint8(0xd4),
  2146. 6: uint8(0xdc),
  2147. 7: uint8(0xca),
  2148. },
  2149. 39: {
  2150. 0: uint8(0x5c),
  2151. 1: uint8(0x73),
  2152. 2: uint8(0x33),
  2153. 3: uint8(0x6a),
  2154. 4: uint8(0x76),
  2155. 5: uint8(0xd8),
  2156. 6: uint8(0xbf),
  2157. 7: uint8(0x9a),
  2158. },
  2159. 40: {
  2160. 0: uint8(0xd0),
  2161. 1: uint8(0xa7),
  2162. 2: uint8(0x04),
  2163. 3: uint8(0x53),
  2164. 4: uint8(0x6b),
  2165. 5: uint8(0xa9),
  2166. 6: uint8(0x3e),
  2167. 7: uint8(0x0e),
  2168. },
  2169. 41: {
  2170. 0: uint8(0x92),
  2171. 1: uint8(0x59),
  2172. 2: uint8(0x58),
  2173. 3: uint8(0xfc),
  2174. 4: uint8(0xd6),
  2175. 5: uint8(0x42),
  2176. 6: uint8(0x0c),
  2177. 7: uint8(0xad),
  2178. },
  2179. 42: {
  2180. 0: uint8(0xa9),
  2181. 1: uint8(0x15),
  2182. 2: uint8(0xc2),
  2183. 3: uint8(0x9b),
  2184. 4: uint8(0xc8),
  2185. 5: uint8(0x06),
  2186. 6: uint8(0x73),
  2187. 7: uint8(0x18),
  2188. },
  2189. 43: {
  2190. 0: uint8(0x95),
  2191. 1: uint8(0x2b),
  2192. 2: uint8(0x79),
  2193. 3: uint8(0xf3),
  2194. 4: uint8(0xbc),
  2195. 5: uint8(0x0a),
  2196. 6: uint8(0xa6),
  2197. 7: uint8(0xd4),
  2198. },
  2199. 44: {
  2200. 0: uint8(0xf2),
  2201. 1: uint8(0x1d),
  2202. 2: uint8(0xf2),
  2203. 3: uint8(0xe4),
  2204. 4: uint8(0x1d),
  2205. 5: uint8(0x45),
  2206. 6: uint8(0x35),
  2207. 7: uint8(0xf9),
  2208. },
  2209. 45: {
  2210. 0: uint8(0x87),
  2211. 1: uint8(0x57),
  2212. 2: uint8(0x75),
  2213. 3: uint8(0x19),
  2214. 4: uint8(0x04),
  2215. 5: uint8(0x8f),
  2216. 6: uint8(0x53),
  2217. 7: uint8(0xa9),
  2218. },
  2219. 46: {
  2220. 0: uint8(0x10),
  2221. 1: uint8(0xa5),
  2222. 2: uint8(0x6c),
  2223. 3: uint8(0xf5),
  2224. 4: uint8(0xdf),
  2225. 5: uint8(0xcd),
  2226. 6: uint8(0x9a),
  2227. 7: uint8(0xdb),
  2228. },
  2229. 47: {
  2230. 0: uint8(0xeb),
  2231. 1: uint8(0x75),
  2232. 2: uint8(0x09),
  2233. 3: uint8(0x5c),
  2234. 4: uint8(0xcd),
  2235. 5: uint8(0x98),
  2236. 6: uint8(0x6c),
  2237. 7: uint8(0xd0),
  2238. },
  2239. 48: {
  2240. 0: uint8(0x51),
  2241. 1: uint8(0xa9),
  2242. 2: uint8(0xcb),
  2243. 3: uint8(0x9e),
  2244. 4: uint8(0xcb),
  2245. 5: uint8(0xa3),
  2246. 6: uint8(0x12),
  2247. 7: uint8(0xe6),
  2248. },
  2249. 49: {
  2250. 0: uint8(0x96),
  2251. 1: uint8(0xaf),
  2252. 2: uint8(0xad),
  2253. 3: uint8(0xfc),
  2254. 4: uint8(0x2c),
  2255. 5: uint8(0xe6),
  2256. 6: uint8(0x66),
  2257. 7: uint8(0xc7),
  2258. },
  2259. 50: {
  2260. 0: uint8(0x72),
  2261. 1: uint8(0xfe),
  2262. 2: uint8(0x52),
  2263. 3: uint8(0x97),
  2264. 4: uint8(0x5a),
  2265. 5: uint8(0x43),
  2266. 6: uint8(0x64),
  2267. 7: uint8(0xee),
  2268. },
  2269. 51: {
  2270. 0: uint8(0x5a),
  2271. 1: uint8(0x16),
  2272. 2: uint8(0x45),
  2273. 3: uint8(0xb2),
  2274. 4: uint8(0x76),
  2275. 5: uint8(0xd5),
  2276. 6: uint8(0x92),
  2277. 7: uint8(0xa1),
  2278. },
  2279. 52: {
  2280. 0: uint8(0xb2),
  2281. 1: uint8(0x74),
  2282. 2: uint8(0xcb),
  2283. 3: uint8(0x8e),
  2284. 4: uint8(0xbf),
  2285. 5: uint8(0x87),
  2286. 6: uint8(0x87),
  2287. 7: uint8(0x0a),
  2288. },
  2289. 53: {
  2290. 0: uint8(0x6f),
  2291. 1: uint8(0x9b),
  2292. 2: uint8(0xb4),
  2293. 3: uint8(0x20),
  2294. 4: uint8(0x3d),
  2295. 5: uint8(0xe7),
  2296. 6: uint8(0xb3),
  2297. 7: uint8(0x81),
  2298. },
  2299. 54: {
  2300. 0: uint8(0xea),
  2301. 1: uint8(0xec),
  2302. 2: uint8(0xb2),
  2303. 3: uint8(0xa3),
  2304. 4: uint8(0x0b),
  2305. 5: uint8(0x22),
  2306. 6: uint8(0xa8),
  2307. 7: uint8(0x7f),
  2308. },
  2309. 55: {
  2310. 0: uint8(0x99),
  2311. 1: uint8(0x24),
  2312. 2: uint8(0xa4),
  2313. 3: uint8(0x3c),
  2314. 4: uint8(0xc1),
  2315. 5: uint8(0x31),
  2316. 6: uint8(0x57),
  2317. 7: uint8(0x24),
  2318. },
  2319. 56: {
  2320. 0: uint8(0xbd),
  2321. 1: uint8(0x83),
  2322. 2: uint8(0x8d),
  2323. 3: uint8(0x3a),
  2324. 4: uint8(0xaf),
  2325. 5: uint8(0xbf),
  2326. 6: uint8(0x8d),
  2327. 7: uint8(0xb7),
  2328. },
  2329. 57: {
  2330. 0: uint8(0x0b),
  2331. 1: uint8(0x1a),
  2332. 2: uint8(0x2a),
  2333. 3: uint8(0x32),
  2334. 4: uint8(0x65),
  2335. 5: uint8(0xd5),
  2336. 6: uint8(0x1a),
  2337. 7: uint8(0xea),
  2338. },
  2339. 58: {
  2340. 0: uint8(0x13),
  2341. 1: uint8(0x50),
  2342. 2: uint8(0x79),
  2343. 3: uint8(0xa3),
  2344. 4: uint8(0x23),
  2345. 5: uint8(0x1c),
  2346. 6: uint8(0xe6),
  2347. 7: uint8(0x60),
  2348. },
  2349. 59: {
  2350. 0: uint8(0x93),
  2351. 1: uint8(0x2b),
  2352. 2: uint8(0x28),
  2353. 3: uint8(0x46),
  2354. 4: uint8(0xe4),
  2355. 5: uint8(0xd7),
  2356. 6: uint8(0x06),
  2357. 7: uint8(0x66),
  2358. },
  2359. 60: {
  2360. 0: uint8(0xe1),
  2361. 1: uint8(0x91),
  2362. 2: uint8(0x5f),
  2363. 3: uint8(0x5c),
  2364. 4: uint8(0xb1),
  2365. 5: uint8(0xec),
  2366. 6: uint8(0xa4),
  2367. 7: uint8(0x6c),
  2368. },
  2369. 61: {
  2370. 0: uint8(0xf3),
  2371. 1: uint8(0x25),
  2372. 2: uint8(0x96),
  2373. 3: uint8(0x5c),
  2374. 4: uint8(0xa1),
  2375. 5: uint8(0x6d),
  2376. 6: uint8(0x62),
  2377. 7: uint8(0x9f),
  2378. },
  2379. 62: {
  2380. 0: uint8(0x57),
  2381. 1: uint8(0x5f),
  2382. 2: uint8(0xf2),
  2383. 3: uint8(0x8e),
  2384. 4: uint8(0x60),
  2385. 5: uint8(0x38),
  2386. 6: uint8(0x1b),
  2387. 7: uint8(0xe5),
  2388. },
  2389. 63: {
  2390. 0: uint8(0x72),
  2391. 1: uint8(0x45),
  2392. 2: uint8(0x06),
  2393. 3: uint8(0xeb),
  2394. 4: uint8(0x4c),
  2395. 5: uint8(0x32),
  2396. 6: uint8(0x8a),
  2397. 7: uint8(0x95),
  2398. },
  2399. }
  2400. type TICHAR = uint8
  2401. type TPOSITION = struct {
  2402. FlineNumber TXML_Size
  2403. FcolumnNumber TXML_Size
  2404. }
  2405. type Tposition = TPOSITION
  2406. type TATTRIBUTE = struct {
  2407. Fname uintptr
  2408. FvaluePtr uintptr
  2409. FvalueEnd uintptr
  2410. Fnormalized uint8
  2411. }
  2412. type Tencoding = struct {
  2413. Fscanners [4]TSCANNER
  2414. FliteralScanners [2]TSCANNER
  2415. FnameMatchesAscii uintptr
  2416. FnameLength uintptr
  2417. FskipS uintptr
  2418. FgetAtts uintptr
  2419. FcharRefNumber uintptr
  2420. FpredefinedEntityName uintptr
  2421. FupdatePosition uintptr
  2422. FisPublicId uintptr
  2423. Futf8Convert uintptr
  2424. Futf16Convert uintptr
  2425. FminBytesPerChar int32
  2426. FisUtf8 uint8
  2427. FisUtf16 uint8
  2428. }
  2429. type TENCODING = struct {
  2430. Fscanners [4]TSCANNER
  2431. FliteralScanners [2]TSCANNER
  2432. FnameMatchesAscii uintptr
  2433. FnameLength uintptr
  2434. FskipS uintptr
  2435. FgetAtts uintptr
  2436. FcharRefNumber uintptr
  2437. FpredefinedEntityName uintptr
  2438. FupdatePosition uintptr
  2439. FisPublicId uintptr
  2440. Futf8Convert uintptr
  2441. Futf16Convert uintptr
  2442. FminBytesPerChar int32
  2443. FisUtf8 uint8
  2444. FisUtf16 uint8
  2445. }
  2446. type TSCANNER = uintptr
  2447. type _XML_Convert_Result = int32
  2448. const _XML_CONVERT_COMPLETED = 0
  2449. const _XML_CONVERT_INPUT_INCOMPLETE = 1
  2450. const _XML_CONVERT_OUTPUT_EXHAUSTED = 2
  2451. type TINIT_ENCODING = struct {
  2452. FinitEnc TENCODING
  2453. FencPtr uintptr
  2454. }
  2455. type TCONVERTER = uintptr
  2456. const _XML_ROLE_ERROR = -1
  2457. const _XML_ROLE_NONE = 0
  2458. const _XML_ROLE_XML_DECL = 1
  2459. const _XML_ROLE_INSTANCE_START = 2
  2460. const _XML_ROLE_DOCTYPE_NONE = 3
  2461. const _XML_ROLE_DOCTYPE_NAME = 4
  2462. const _XML_ROLE_DOCTYPE_SYSTEM_ID = 5
  2463. const _XML_ROLE_DOCTYPE_PUBLIC_ID = 6
  2464. const _XML_ROLE_DOCTYPE_INTERNAL_SUBSET = 7
  2465. const _XML_ROLE_DOCTYPE_CLOSE = 8
  2466. const _XML_ROLE_GENERAL_ENTITY_NAME = 9
  2467. const _XML_ROLE_PARAM_ENTITY_NAME = 10
  2468. const _XML_ROLE_ENTITY_NONE = 11
  2469. const _XML_ROLE_ENTITY_VALUE = 12
  2470. const _XML_ROLE_ENTITY_SYSTEM_ID = 13
  2471. const _XML_ROLE_ENTITY_PUBLIC_ID = 14
  2472. const _XML_ROLE_ENTITY_COMPLETE = 15
  2473. const _XML_ROLE_ENTITY_NOTATION_NAME = 16
  2474. const _XML_ROLE_NOTATION_NONE = 17
  2475. const _XML_ROLE_NOTATION_NAME = 18
  2476. const _XML_ROLE_NOTATION_SYSTEM_ID = 19
  2477. const _XML_ROLE_NOTATION_NO_SYSTEM_ID = 20
  2478. const _XML_ROLE_NOTATION_PUBLIC_ID = 21
  2479. const _XML_ROLE_ATTRIBUTE_NAME = 22
  2480. const _XML_ROLE_ATTRIBUTE_TYPE_CDATA = 23
  2481. const _XML_ROLE_ATTRIBUTE_TYPE_ID = 24
  2482. const _XML_ROLE_ATTRIBUTE_TYPE_IDREF = 25
  2483. const _XML_ROLE_ATTRIBUTE_TYPE_IDREFS = 26
  2484. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITY = 27
  2485. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITIES = 28
  2486. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN = 29
  2487. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS = 30
  2488. const _XML_ROLE_ATTRIBUTE_ENUM_VALUE = 31
  2489. const _XML_ROLE_ATTRIBUTE_NOTATION_VALUE = 32
  2490. const _XML_ROLE_ATTLIST_NONE = 33
  2491. const _XML_ROLE_ATTLIST_ELEMENT_NAME = 34
  2492. const _XML_ROLE_IMPLIED_ATTRIBUTE_VALUE = 35
  2493. const _XML_ROLE_REQUIRED_ATTRIBUTE_VALUE = 36
  2494. const _XML_ROLE_DEFAULT_ATTRIBUTE_VALUE = 37
  2495. const _XML_ROLE_FIXED_ATTRIBUTE_VALUE = 38
  2496. const _XML_ROLE_ELEMENT_NONE = 39
  2497. const _XML_ROLE_ELEMENT_NAME = 40
  2498. const _XML_ROLE_CONTENT_ANY = 41
  2499. const _XML_ROLE_CONTENT_EMPTY = 42
  2500. const _XML_ROLE_CONTENT_PCDATA = 43
  2501. const _XML_ROLE_GROUP_OPEN = 44
  2502. const _XML_ROLE_GROUP_CLOSE = 45
  2503. const _XML_ROLE_GROUP_CLOSE_REP = 46
  2504. const _XML_ROLE_GROUP_CLOSE_OPT = 47
  2505. const _XML_ROLE_GROUP_CLOSE_PLUS = 48
  2506. const _XML_ROLE_GROUP_CHOICE = 49
  2507. const _XML_ROLE_GROUP_SEQUENCE = 50
  2508. const _XML_ROLE_CONTENT_ELEMENT = 51
  2509. const _XML_ROLE_CONTENT_ELEMENT_REP = 52
  2510. const _XML_ROLE_CONTENT_ELEMENT_OPT = 53
  2511. const _XML_ROLE_CONTENT_ELEMENT_PLUS = 54
  2512. const _XML_ROLE_PI = 55
  2513. const _XML_ROLE_COMMENT = 56
  2514. const _XML_ROLE_TEXT_DECL = 57
  2515. const _XML_ROLE_IGNORE_SECT = 58
  2516. const _XML_ROLE_INNER_PARAM_ENTITY_REF = 59
  2517. const _XML_ROLE_PARAM_ENTITY_REF = 60
  2518. type TPROLOG_STATE = struct {
  2519. Fhandler uintptr
  2520. Flevel uint32
  2521. Frole_none int32
  2522. FincludeLevel uint32
  2523. FdocumentEntity int32
  2524. FinEntityValue int32
  2525. }
  2526. type Tprolog_state = TPROLOG_STATE
  2527. type TKEY = uintptr
  2528. type TNAMED = struct {
  2529. Fname TKEY
  2530. }
  2531. type THASH_TABLE = struct {
  2532. Fv uintptr
  2533. Fpower uint8
  2534. Fsize Tsize_t
  2535. Fused Tsize_t
  2536. Fmem uintptr
  2537. }
  2538. /* For probing (after a collision) we need a step size relative prime
  2539. to the hash table size, which is a power of 2. We use double-hashing,
  2540. since we can calculate a second hash value cheaply by taking those bits
  2541. of the first hash value that were discarded (masked out) when the table
  2542. index was calculated: index = hash & mask, where mask = table->size - 1.
  2543. We limit the maximum step size to table->size / 4 (mask >> 2) and make
  2544. it odd, since odd numbers are always relative prime to a power of 2.
  2545. */
  2546. type THASH_TABLE_ITER = struct {
  2547. Fp uintptr
  2548. Fend uintptr
  2549. }
  2550. type TBINDING = struct {
  2551. Fprefix uintptr
  2552. FnextTagBinding uintptr
  2553. FprevPrefixBinding uintptr
  2554. FattId uintptr
  2555. Furi uintptr
  2556. FuriLen int32
  2557. FuriAlloc int32
  2558. }
  2559. type Tbinding = TBINDING
  2560. type TPREFIX = struct {
  2561. Fname uintptr
  2562. Fbinding uintptr
  2563. }
  2564. type Tprefix = TPREFIX
  2565. type TTAG_NAME = struct {
  2566. Fstr uintptr
  2567. FlocalPart uintptr
  2568. Fprefix uintptr
  2569. FstrLen int32
  2570. FuriLen int32
  2571. FprefixLen int32
  2572. }
  2573. // C documentation
  2574. //
  2575. // /* TAG represents an open element.
  2576. // The name of the element is stored in both the document and API
  2577. // encodings. The memory buffer 'buf' is a separately-allocated
  2578. // memory area which stores the name. During the XML_Parse()/
  2579. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2580. // version of the name (in the document encoding) is shared with the
  2581. // document buffer. If the element is open across calls to
  2582. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2583. // contain the 'raw' name as well.
  2584. //
  2585. // A parser re-uses these structures, maintaining a list of allocated
  2586. // TAG objects in a free list.
  2587. // */
  2588. type TTAG = struct {
  2589. Fparent uintptr
  2590. FrawName uintptr
  2591. FrawNameLength int32
  2592. Fname TTAG_NAME
  2593. Fbuf uintptr
  2594. FbufEnd uintptr
  2595. Fbindings uintptr
  2596. }
  2597. // C documentation
  2598. //
  2599. // /* TAG represents an open element.
  2600. // The name of the element is stored in both the document and API
  2601. // encodings. The memory buffer 'buf' is a separately-allocated
  2602. // memory area which stores the name. During the XML_Parse()/
  2603. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2604. // version of the name (in the document encoding) is shared with the
  2605. // document buffer. If the element is open across calls to
  2606. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2607. // contain the 'raw' name as well.
  2608. //
  2609. // A parser re-uses these structures, maintaining a list of allocated
  2610. // TAG objects in a free list.
  2611. // */
  2612. type Ttag = TTAG
  2613. type TENTITY = struct {
  2614. Fname uintptr
  2615. FtextPtr uintptr
  2616. FtextLen int32
  2617. Fprocessed int32
  2618. FsystemId uintptr
  2619. Fbase uintptr
  2620. FpublicId uintptr
  2621. Fnotation uintptr
  2622. Fopen TXML_Bool
  2623. Fis_param TXML_Bool
  2624. Fis_internal TXML_Bool
  2625. }
  2626. type TCONTENT_SCAFFOLD = struct {
  2627. Ftype1 _XML_Content_Type
  2628. Fquant _XML_Content_Quant
  2629. Fname uintptr
  2630. Ffirstchild int32
  2631. Flastchild int32
  2632. Fchildcnt int32
  2633. Fnextsib int32
  2634. }
  2635. type TBLOCK = struct {
  2636. Fnext uintptr
  2637. Fsize int32
  2638. Fs [1]TXML_Char
  2639. }
  2640. type Tblock = TBLOCK
  2641. type TSTRING_POOL = struct {
  2642. Fblocks uintptr
  2643. FfreeBlocks uintptr
  2644. Fend uintptr
  2645. Fptr uintptr
  2646. Fstart uintptr
  2647. Fmem uintptr
  2648. }
  2649. // C documentation
  2650. //
  2651. // /* The XML_Char before the name is used to determine whether
  2652. // an attribute has been specified. */
  2653. type TATTRIBUTE_ID = struct {
  2654. Fname uintptr
  2655. Fprefix uintptr
  2656. FmaybeTokenized TXML_Bool
  2657. Fxmlns TXML_Bool
  2658. }
  2659. // C documentation
  2660. //
  2661. // /* The XML_Char before the name is used to determine whether
  2662. // an attribute has been specified. */
  2663. type Tattribute_id = TATTRIBUTE_ID
  2664. type TDEFAULT_ATTRIBUTE = struct {
  2665. Fid uintptr
  2666. FisCdata TXML_Bool
  2667. Fvalue uintptr
  2668. }
  2669. type TNS_ATT = struct {
  2670. Fversion uint64
  2671. Fhash uint64
  2672. FuriName uintptr
  2673. }
  2674. type TELEMENT_TYPE = struct {
  2675. Fname uintptr
  2676. Fprefix uintptr
  2677. FidAtt uintptr
  2678. FnDefaultAtts int32
  2679. FallocDefaultAtts int32
  2680. FdefaultAtts uintptr
  2681. }
  2682. type TDTD = struct {
  2683. FgeneralEntities THASH_TABLE
  2684. FelementTypes THASH_TABLE
  2685. FattributeIds THASH_TABLE
  2686. Fprefixes THASH_TABLE
  2687. Fpool TSTRING_POOL
  2688. FentityValuePool TSTRING_POOL
  2689. FkeepProcessing TXML_Bool
  2690. FhasParamEntityRefs TXML_Bool
  2691. Fstandalone TXML_Bool
  2692. FparamEntityRead TXML_Bool
  2693. FparamEntities THASH_TABLE
  2694. FdefaultPrefix TPREFIX
  2695. Fin_eldecl TXML_Bool
  2696. Fscaffold uintptr
  2697. FcontentStringLen uint32
  2698. FscaffSize uint32
  2699. FscaffCount uint32
  2700. FscaffLevel int32
  2701. FscaffIndex uintptr
  2702. }
  2703. type TOPEN_INTERNAL_ENTITY = struct {
  2704. FinternalEventPtr uintptr
  2705. FinternalEventEndPtr uintptr
  2706. Fnext uintptr
  2707. Fentity uintptr
  2708. FstartTagLevel int32
  2709. FbetweenDecl TXML_Bool
  2710. }
  2711. type Topen_internal_entity = TOPEN_INTERNAL_ENTITY
  2712. func XXML_ParserCreate(tls *libc.TLS, encodingName uintptr) (r TXML_Parser) {
  2713. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0))
  2714. }
  2715. func XXML_ParserCreateNS(tls *libc.TLS, encodingName uintptr, nsSep TXML_Char) (r TXML_Parser) {
  2716. bp := tls.Alloc(16)
  2717. defer tls.Free(16)
  2718. var _ /* tmp at bp+0 */ [2]TXML_Char
  2719. *(*TXML_Char)(unsafe.Pointer(bp)) = nsSep
  2720. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), bp)
  2721. }
  2722. var _implicitContext = [41]TXML_Char{
  2723. 0: uint8(m_ASCII_x),
  2724. 1: uint8(m_ASCII_m),
  2725. 2: uint8(m_ASCII_l),
  2726. 3: uint8(m_ASCII_EQUALS),
  2727. 4: uint8(m_ASCII_h),
  2728. 5: uint8(m_ASCII_t),
  2729. 6: uint8(m_ASCII_t),
  2730. 7: uint8(m_ASCII_p),
  2731. 8: uint8(m_ASCII_COLON),
  2732. 9: uint8(m_ASCII_SLASH),
  2733. 10: uint8(m_ASCII_SLASH),
  2734. 11: uint8(m_ASCII_w),
  2735. 12: uint8(m_ASCII_w),
  2736. 13: uint8(m_ASCII_w),
  2737. 14: uint8(m_ASCII_PERIOD),
  2738. 15: uint8(m_ASCII_w),
  2739. 16: uint8(m_ASCII_3),
  2740. 17: uint8(m_ASCII_PERIOD),
  2741. 18: uint8(m_ASCII_o),
  2742. 19: uint8(m_ASCII_r),
  2743. 20: uint8(m_ASCII_g),
  2744. 21: uint8(m_ASCII_SLASH),
  2745. 22: uint8(m_ASCII_X),
  2746. 23: uint8(m_ASCII_M),
  2747. 24: uint8(m_ASCII_L),
  2748. 25: uint8(m_ASCII_SLASH),
  2749. 26: uint8(m_ASCII_1),
  2750. 27: uint8(m_ASCII_9),
  2751. 28: uint8(m_ASCII_9),
  2752. 29: uint8(m_ASCII_8),
  2753. 30: uint8(m_ASCII_SLASH),
  2754. 31: uint8(m_ASCII_n),
  2755. 32: uint8(m_ASCII_a),
  2756. 33: uint8(m_ASCII_m),
  2757. 34: uint8(m_ASCII_e),
  2758. 35: uint8(m_ASCII_s),
  2759. 36: uint8(m_ASCII_p),
  2760. 37: uint8(m_ASCII_a),
  2761. 38: uint8(m_ASCII_c),
  2762. 39: uint8(m_ASCII_e),
  2763. }
  2764. /* To avoid warnings about unused functions: */
  2765. // C documentation
  2766. //
  2767. // /* Obtain entropy on Linux 3.17+ */
  2768. func _writeRandomBytes_getrandom_nonblock(tls *libc.TLS, target uintptr, count Tsize_t) (r int32) {
  2769. var bytesToWrite, bytesWrittenTotal Tsize_t
  2770. var bytesWrittenMore, success int32
  2771. var currentTarget uintptr
  2772. var getrandomFlags uint32
  2773. _, _, _, _, _, _ = bytesToWrite, bytesWrittenMore, bytesWrittenTotal, currentTarget, getrandomFlags, success
  2774. success = 0 /* full count bytes written? */
  2775. bytesWrittenTotal = uint64(0)
  2776. getrandomFlags = uint32(m_GRND_NONBLOCK)
  2777. for cond := true; cond; cond = !(success != 0) && *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EINTR) {
  2778. currentTarget = target + uintptr(bytesWrittenTotal)
  2779. bytesToWrite = count - bytesWrittenTotal
  2780. bytesWrittenMore = int32(libc.Xgetrandom(tls, currentTarget, bytesToWrite, getrandomFlags))
  2781. if bytesWrittenMore > 0 {
  2782. bytesWrittenTotal += libc.Uint64FromInt32(bytesWrittenMore)
  2783. if bytesWrittenTotal >= count {
  2784. success = int32(1)
  2785. }
  2786. }
  2787. }
  2788. return success
  2789. }
  2790. // C documentation
  2791. //
  2792. // /* Extract entropy from /dev/urandom */
  2793. func _writeRandomBytes_dev_urandom(tls *libc.TLS, target uintptr, count Tsize_t) (r int32) {
  2794. var bytesToWrite, bytesWrittenTotal Tsize_t
  2795. var bytesWrittenMore Tssize_t
  2796. var currentTarget uintptr
  2797. var fd, success int32
  2798. _, _, _, _, _, _ = bytesToWrite, bytesWrittenMore, bytesWrittenTotal, currentTarget, fd, success
  2799. success = 0 /* full count bytes written? */
  2800. bytesWrittenTotal = uint64(0)
  2801. fd = libc.Xopen(tls, __ccgo_ts+17, m_O_RDONLY, 0)
  2802. if fd < 0 {
  2803. return 0
  2804. }
  2805. for cond := true; cond; cond = !(success != 0) && *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EINTR) {
  2806. currentTarget = target + uintptr(bytesWrittenTotal)
  2807. bytesToWrite = count - bytesWrittenTotal
  2808. bytesWrittenMore = libc.Xread(tls, fd, currentTarget, bytesToWrite)
  2809. if bytesWrittenMore > 0 {
  2810. bytesWrittenTotal += libc.Uint64FromInt64(bytesWrittenMore)
  2811. if bytesWrittenTotal >= count {
  2812. success = int32(1)
  2813. }
  2814. }
  2815. }
  2816. libc.Xclose(tls, fd)
  2817. return success
  2818. }
  2819. func _gather_time_entropy(tls *libc.TLS) (r uint64) {
  2820. bp := tls.Alloc(16)
  2821. defer tls.Free(16)
  2822. var gettimeofday_res int32
  2823. var _ /* tv at bp+0 */ Ttimeval
  2824. _ = gettimeofday_res
  2825. gettimeofday_res = libc.Xgettimeofday(tls, bp, libc.UintptrFromInt32(0))
  2826. _ = gettimeofday_res
  2827. /* Microseconds time is <20 bits entropy */
  2828. return libc.Uint64FromInt64((*(*Ttimeval)(unsafe.Pointer(bp))).Ftv_usec)
  2829. }
  2830. func _ENTROPY_DEBUG(tls *libc.TLS, label uintptr, entropy uint64) (r uint64) {
  2831. bp := tls.Alloc(48)
  2832. defer tls.Free(48)
  2833. var EXPAT_ENTROPY_DEBUG uintptr
  2834. _ = EXPAT_ENTROPY_DEBUG
  2835. EXPAT_ENTROPY_DEBUG = libc.Xgetenv(tls, __ccgo_ts+30)
  2836. if EXPAT_ENTROPY_DEBUG != 0 && !(libc.Xstrcmp(tls, EXPAT_ENTROPY_DEBUG, __ccgo_ts+50) != 0) {
  2837. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+52, libc.VaList(bp+8, label, libc.Int32FromInt64(8)*libc.Int32FromInt32(2), entropy, libc.Uint64FromInt64(8)))
  2838. }
  2839. return entropy
  2840. }
  2841. func _generate_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  2842. bp := tls.Alloc(16)
  2843. defer tls.Free(16)
  2844. var _ /* entropy at bp+0 */ uint64
  2845. _ = parser
  2846. /* "Failproof" high quality providers: */
  2847. /* Try high quality providers first .. */
  2848. if _writeRandomBytes_getrandom_nonblock(tls, bp, uint64(8)) != 0 {
  2849. return _ENTROPY_DEBUG(tls, __ccgo_ts+89, *(*uint64)(unsafe.Pointer(bp)))
  2850. }
  2851. if _writeRandomBytes_dev_urandom(tls, bp, uint64(8)) != 0 {
  2852. return _ENTROPY_DEBUG(tls, __ccgo_ts+17, *(*uint64)(unsafe.Pointer(bp)))
  2853. }
  2854. /* .. and self-made low quality for backup: */
  2855. /* Process ID is 0 bits entropy if attacker has local access */
  2856. *(*uint64)(unsafe.Pointer(bp)) = _gather_time_entropy(tls) ^ libc.Uint64FromInt32(libc.Xgetpid(tls))
  2857. /* Factors are 2^31-1 and 2^61-1 (Mersenne primes M31 and M61) */
  2858. if uint64(8) == uint64(4) {
  2859. return _ENTROPY_DEBUG(tls, __ccgo_ts+99, *(*uint64)(unsafe.Pointer(bp))*uint64(2147483647))
  2860. } else {
  2861. return _ENTROPY_DEBUG(tls, __ccgo_ts+111, *(*uint64)(unsafe.Pointer(bp))*libc.Uint64FromUint64(2305843009213693951))
  2862. }
  2863. return r
  2864. }
  2865. func _get_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  2866. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  2867. return _get_hash_secret_salt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser)
  2868. }
  2869. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  2870. }
  2871. func _startParsing(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  2872. /* hash functions must be initialized before setContext() is called */
  2873. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt == uint64(0) {
  2874. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = _generate_hash_secret_salt(tls, parser)
  2875. }
  2876. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  2877. /* implicit context only set for root parser, since child
  2878. parsers (i.e. external entity parsers) will inherit it
  2879. */
  2880. return _setContext(tls, parser, uintptr(unsafe.Pointer(&_implicitContext)))
  2881. }
  2882. return libc.Uint8FromInt32(1)
  2883. }
  2884. func XXML_ParserCreate_MM(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr) (r TXML_Parser) {
  2885. return _parserCreate(tls, encodingName, memsuite, nameSep, libc.UintptrFromInt32(0))
  2886. }
  2887. func _parserCreate(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr, dtd uintptr) (r TXML_Parser) {
  2888. var mtemp, mtemp1 uintptr
  2889. var parser TXML_Parser
  2890. _, _, _ = mtemp, mtemp1, parser
  2891. if memsuite != 0 {
  2892. parser = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, uint64(928))
  2893. if parser != libc.UintptrFromInt32(0) {
  2894. mtemp = parser + 24
  2895. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Fmalloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn
  2896. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Frealloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Frealloc_fcn
  2897. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Ffree_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Ffree_fcn
  2898. }
  2899. } else {
  2900. parser = libc.Xmalloc(tls, uint64(928))
  2901. if parser != libc.UintptrFromInt32(0) {
  2902. mtemp1 = parser + 24
  2903. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Fmalloc_fcn = __ccgo_fp(libc.Xmalloc)
  2904. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Frealloc_fcn = __ccgo_fp(libc.Xrealloc)
  2905. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Ffree_fcn = __ccgo_fp(libc.Xfree)
  2906. }
  2907. }
  2908. if !(parser != 0) {
  2909. return parser
  2910. }
  2911. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = libc.UintptrFromInt32(0)
  2912. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = libc.UintptrFromInt32(0)
  2913. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = int32(m_INIT_ATTS_SIZE)
  2914. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize)*libc.Uint64FromInt64(32))
  2915. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts == libc.UintptrFromInt32(0) {
  2916. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  2917. return libc.UintptrFromInt32(0)
  2918. }
  2919. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(m_INIT_DATA_BUF_SIZE)*libc.Uint64FromInt64(1))
  2920. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf == libc.UintptrFromInt32(0) {
  2921. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  2922. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  2923. return libc.UintptrFromInt32(0)
  2924. }
  2925. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf + uintptr(m_INIT_DATA_BUF_SIZE)
  2926. if dtd != 0 {
  2927. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = dtd
  2928. } else {
  2929. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = _dtdCreate(tls, parser+24)
  2930. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd == libc.UintptrFromInt32(0) {
  2931. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)
  2932. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  2933. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  2934. return libc.UintptrFromInt32(0)
  2935. }
  2936. }
  2937. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = libc.UintptrFromInt32(0)
  2938. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  2939. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  2940. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  2941. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = libc.UintptrFromInt32(0)
  2942. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = libc.UintptrFromInt32(0)
  2943. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = libc.UintptrFromInt32(0)
  2944. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = uint8(m_ASCII_EXCL)
  2945. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(0)
  2946. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(0)
  2947. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = libc.UintptrFromInt32(0)
  2948. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = uint64(0)
  2949. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(0)
  2950. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  2951. _poolInit(tls, parser+784, parser+24)
  2952. _poolInit(tls, parser+832, parser+24)
  2953. _parserInit(tls, parser, encodingName)
  2954. if encodingName != 0 && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  2955. XXML_ParserFree(tls, parser)
  2956. return libc.UintptrFromInt32(0)
  2957. }
  2958. if nameSep != 0 {
  2959. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(1)
  2960. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncodingNS(tls)
  2961. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = *(*TXML_Char)(unsafe.Pointer(nameSep))
  2962. } else {
  2963. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncoding(tls)
  2964. }
  2965. return parser
  2966. }
  2967. func _parserInit(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) {
  2968. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologInitProcessor)
  2969. XXmlPrologStateInit(tls, parser+496)
  2970. if encodingName != libc.UintptrFromInt32(0) {
  2971. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+24)
  2972. }
  2973. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  2974. XXmlInitEncoding(tls, parser+296, parser+288, uintptr(0))
  2975. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = libc.UintptrFromInt32(0)
  2976. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = libc.UintptrFromInt32(0)
  2977. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = libc.UintptrFromInt32(0)
  2978. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = libc.UintptrFromInt32(0)
  2979. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = libc.UintptrFromInt32(0)
  2980. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = libc.UintptrFromInt32(0)
  2981. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = libc.UintptrFromInt32(0)
  2982. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = libc.UintptrFromInt32(0)
  2983. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = libc.UintptrFromInt32(0)
  2984. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = libc.UintptrFromInt32(0)
  2985. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = libc.UintptrFromInt32(0)
  2986. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = libc.UintptrFromInt32(0)
  2987. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = libc.UintptrFromInt32(0)
  2988. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = libc.UintptrFromInt32(0)
  2989. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = libc.UintptrFromInt32(0)
  2990. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = libc.UintptrFromInt32(0)
  2991. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = libc.UintptrFromInt32(0)
  2992. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = libc.UintptrFromInt32(0)
  2993. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  2994. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = libc.UintptrFromInt32(0)
  2995. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = libc.UintptrFromInt32(0)
  2996. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = libc.UintptrFromInt32(0)
  2997. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = libc.UintptrFromInt32(0)
  2998. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = libc.UintptrFromInt32(0)
  2999. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3000. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3001. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex = 0
  3002. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = libc.UintptrFromInt32(0)
  3003. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = libc.UintptrFromInt32(0)
  3004. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = libc.UintptrFromInt32(0)
  3005. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  3006. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  3007. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0)
  3008. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  3009. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  3010. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  3011. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  3012. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  3013. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  3014. libc.Xmemset(tls, parser+768, 0, uint64(16))
  3015. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NONE)
  3016. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = libc.UintptrFromInt32(0)
  3017. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = libc.UintptrFromInt32(0)
  3018. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  3019. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = libc.UintptrFromInt32(0)
  3020. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3021. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = 0
  3022. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = libc.UintptrFromInt32(0)
  3023. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings = libc.UintptrFromInt32(0)
  3024. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = 0
  3025. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem = libc.UintptrFromInt32(0)
  3026. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = libc.UintptrFromInt32(0)
  3027. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = libc.UintptrFromInt32(0)
  3028. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = libc.UintptrFromInt32(0)
  3029. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_INITIALIZED)
  3030. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(0)
  3031. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  3032. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  3033. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = uint64(0)
  3034. }
  3035. // C documentation
  3036. //
  3037. // /* moves list of bindings to m_freeBindingList */
  3038. func _moveToFreeBindingList(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  3039. var b uintptr
  3040. _ = b
  3041. for bindings != 0 {
  3042. b = bindings
  3043. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  3044. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  3045. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  3046. }
  3047. }
  3048. func XXML_ParserReset(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r TXML_Bool) {
  3049. var openEntity, openEntityList, tStk, tag uintptr
  3050. _, _, _, _ = openEntity, openEntityList, tStk, tag
  3051. if parser == libc.UintptrFromInt32(0) {
  3052. return libc.Uint8FromInt32(0)
  3053. }
  3054. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3055. return libc.Uint8FromInt32(0)
  3056. }
  3057. /* move m_tagStack to m_freeTagList */
  3058. tStk = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3059. for tStk != 0 {
  3060. tag = tStk
  3061. tStk = (*TTAG)(unsafe.Pointer(tStk)).Fparent
  3062. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3063. _moveToFreeBindingList(tls, parser, (*TTAG)(unsafe.Pointer(tag)).Fbindings)
  3064. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  3065. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag
  3066. }
  3067. /* move m_openInternalEntities to m_freeInternalEntities */
  3068. openEntityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3069. for openEntityList != 0 {
  3070. openEntity = openEntityList
  3071. openEntityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  3072. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3073. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  3074. }
  3075. _moveToFreeBindingList(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings)
  3076. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem)
  3077. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3078. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3079. }
  3080. _poolClear(tls, parser+784)
  3081. _poolClear(tls, parser+832)
  3082. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName)
  3083. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3084. _parserInit(tls, parser, encodingName)
  3085. _dtdReset(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, parser+24)
  3086. return libc.Uint8FromInt32(1)
  3087. }
  3088. func XXML_SetEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Status) {
  3089. if parser == libc.UintptrFromInt32(0) {
  3090. return int32(_XML_STATUS_ERROR)
  3091. }
  3092. /* Block after XML_Parse()/XML_ParseBuffer() has been called.
  3093. XXX There's no way for the caller to determine which of the
  3094. XXX possible error cases caused the XML_STATUS_ERROR return.
  3095. */
  3096. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3097. return int32(_XML_STATUS_ERROR)
  3098. }
  3099. /* Get rid of any previous encoding name */
  3100. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName)
  3101. if encodingName == libc.UintptrFromInt32(0) {
  3102. /* No new encoding name */
  3103. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3104. } else {
  3105. /* Copy the new encoding name into allocated memory */
  3106. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+24)
  3107. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  3108. return int32(_XML_STATUS_ERROR)
  3109. }
  3110. }
  3111. return int32(_XML_STATUS_OK)
  3112. }
  3113. func XXML_ExternalEntityParserCreate(tls *libc.TLS, oldParser TXML_Parser, context uintptr, encodingName uintptr) (r TXML_Parser) {
  3114. bp := tls.Alloc(16)
  3115. defer tls.Free(16)
  3116. var newDtd, oldDeclElementType, oldDtd, oldHandlerArg, oldUserData uintptr
  3117. var oldAttlistDeclHandler TXML_AttlistDeclHandler
  3118. var oldCharacterDataHandler TXML_CharacterDataHandler
  3119. var oldCommentHandler TXML_CommentHandler
  3120. var oldDefaultExpandInternalEntities, oldns_triplets TXML_Bool
  3121. var oldDefaultHandler TXML_DefaultHandler
  3122. var oldElementDeclHandler TXML_ElementDeclHandler
  3123. var oldEndCdataSectionHandler TXML_EndCdataSectionHandler
  3124. var oldEndElementHandler TXML_EndElementHandler
  3125. var oldEndNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  3126. var oldEntityDeclHandler TXML_EntityDeclHandler
  3127. var oldExternalEntityRefHandler TXML_ExternalEntityRefHandler
  3128. var oldExternalEntityRefHandlerArg, parser TXML_Parser
  3129. var oldInEntityValue int32
  3130. var oldNotStandaloneHandler TXML_NotStandaloneHandler
  3131. var oldNotationDeclHandler TXML_NotationDeclHandler
  3132. var oldParamEntityParsing _XML_ParamEntityParsing
  3133. var oldProcessingInstructionHandler TXML_ProcessingInstructionHandler
  3134. var oldSkippedEntityHandler TXML_SkippedEntityHandler
  3135. var oldStartCdataSectionHandler TXML_StartCdataSectionHandler
  3136. var oldStartElementHandler TXML_StartElementHandler
  3137. var oldStartNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  3138. var oldUnknownEncodingHandler TXML_UnknownEncodingHandler
  3139. var oldUnparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  3140. var oldXmlDeclHandler TXML_XmlDeclHandler
  3141. var oldhash_secret_salt uint64
  3142. var _ /* tmp at bp+0 */ [2]TXML_Char
  3143. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = newDtd, oldAttlistDeclHandler, oldCharacterDataHandler, oldCommentHandler, oldDeclElementType, oldDefaultExpandInternalEntities, oldDefaultHandler, oldDtd, oldElementDeclHandler, oldEndCdataSectionHandler, oldEndElementHandler, oldEndNamespaceDeclHandler, oldEntityDeclHandler, oldExternalEntityRefHandler, oldExternalEntityRefHandlerArg, oldHandlerArg, oldInEntityValue, oldNotStandaloneHandler, oldNotationDeclHandler, oldParamEntityParsing, oldProcessingInstructionHandler, oldSkippedEntityHandler, oldStartCdataSectionHandler, oldStartElementHandler, oldStartNamespaceDeclHandler, oldUnknownEncodingHandler, oldUnparsedEntityDeclHandler, oldUserData, oldXmlDeclHandler, oldhash_secret_salt, oldns_triplets, parser
  3144. parser = oldParser
  3145. newDtd = libc.UintptrFromInt32(0)
  3146. /* Validate the oldParser parameter before we pull everything out of it */
  3147. if oldParser == libc.UintptrFromInt32(0) {
  3148. return libc.UintptrFromInt32(0)
  3149. }
  3150. /* Stash the original parser contents on the stack */
  3151. oldDtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  3152. oldStartElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler
  3153. oldEndElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler
  3154. oldCharacterDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  3155. oldProcessingInstructionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler
  3156. oldCommentHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler
  3157. oldStartCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler
  3158. oldEndCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler
  3159. oldDefaultHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler
  3160. oldUnparsedEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler
  3161. oldNotationDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler
  3162. oldStartNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler
  3163. oldEndNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler
  3164. oldNotStandaloneHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler
  3165. oldExternalEntityRefHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler
  3166. oldSkippedEntityHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler
  3167. oldUnknownEncodingHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler
  3168. oldElementDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler
  3169. oldAttlistDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler
  3170. oldEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler
  3171. oldXmlDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler
  3172. oldDeclElementType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType
  3173. oldUserData = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3174. oldHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg
  3175. oldDefaultExpandInternalEntities = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities
  3176. oldExternalEntityRefHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg
  3177. oldParamEntityParsing = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing
  3178. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  3179. oldns_triplets = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets
  3180. /* Note that the new parser shares the same hash secret as the old
  3181. parser, so that dtdCopy and copyEntityTable can lookup values
  3182. from hash tables associated with either parser without us having
  3183. to worry which hash secrets each table has.
  3184. */
  3185. oldhash_secret_salt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  3186. if !(context != 0) {
  3187. newDtd = oldDtd
  3188. }
  3189. /* Note that the magical uses of the pre-processor to make field
  3190. access look more like C++ require that `parser' be overwritten
  3191. here. This makes this function more painful to follow than it
  3192. would be otherwise.
  3193. */
  3194. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  3195. *(*TXML_Char)(unsafe.Pointer(bp)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  3196. parser = _parserCreate(tls, encodingName, parser+24, bp, newDtd)
  3197. } else {
  3198. parser = _parserCreate(tls, encodingName, parser+24, libc.UintptrFromInt32(0), newDtd)
  3199. }
  3200. if !(parser != 0) {
  3201. return libc.UintptrFromInt32(0)
  3202. }
  3203. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = oldStartElementHandler
  3204. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = oldEndElementHandler
  3205. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = oldCharacterDataHandler
  3206. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = oldProcessingInstructionHandler
  3207. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = oldCommentHandler
  3208. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = oldStartCdataSectionHandler
  3209. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = oldEndCdataSectionHandler
  3210. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = oldDefaultHandler
  3211. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler
  3212. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = oldNotationDeclHandler
  3213. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = oldStartNamespaceDeclHandler
  3214. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = oldEndNamespaceDeclHandler
  3215. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = oldNotStandaloneHandler
  3216. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = oldExternalEntityRefHandler
  3217. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = oldSkippedEntityHandler
  3218. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = oldUnknownEncodingHandler
  3219. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = oldElementDeclHandler
  3220. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = oldAttlistDeclHandler
  3221. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = oldEntityDeclHandler
  3222. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = oldXmlDeclHandler
  3223. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = oldDeclElementType
  3224. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = oldUserData
  3225. if oldUserData == oldHandlerArg {
  3226. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3227. } else {
  3228. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3229. }
  3230. if oldExternalEntityRefHandlerArg != oldParser {
  3231. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg
  3232. }
  3233. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = oldDefaultExpandInternalEntities
  3234. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = oldns_triplets
  3235. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = oldhash_secret_salt
  3236. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = oldParser
  3237. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = oldParamEntityParsing
  3238. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  3239. if context != 0 {
  3240. if !(_dtdCopy(tls, oldParser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, oldDtd, parser+24) != 0) || !(_setContext(tls, parser, context) != 0) {
  3241. XXML_ParserFree(tls, parser)
  3242. return libc.UintptrFromInt32(0)
  3243. }
  3244. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor)
  3245. } else {
  3246. /* The DTD instance referenced by parser->m_dtd is shared between the
  3247. document's root parser and external PE parsers, therefore one does not
  3248. need to call setContext. In addition, one also *must* not call
  3249. setContext, because this would overwrite existing prefix->binding
  3250. pointers in parser->m_dtd with ones that get destroyed with the external
  3251. PE parser. This would leave those prefixes with dangling pointers.
  3252. */
  3253. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(1)
  3254. XXmlPrologStateInitExternalEntity(tls, parser+496)
  3255. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntInitProcessor)
  3256. }
  3257. return parser
  3258. }
  3259. func _destroyBindings(tls *libc.TLS, bindings uintptr, parser TXML_Parser) {
  3260. var b uintptr
  3261. _ = b
  3262. for {
  3263. b = bindings
  3264. if !(b != 0) {
  3265. break
  3266. }
  3267. bindings = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  3268. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(b)).Furi)
  3269. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  3270. goto _1
  3271. _1:
  3272. }
  3273. }
  3274. func XXML_ParserFree(tls *libc.TLS, parser TXML_Parser) {
  3275. var entityList, openEntity, p, tagList uintptr
  3276. _, _, _, _ = entityList, openEntity, p, tagList
  3277. if parser == libc.UintptrFromInt32(0) {
  3278. return
  3279. }
  3280. /* free m_tagStack and m_freeTagList */
  3281. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3282. for {
  3283. if tagList == libc.UintptrFromInt32(0) {
  3284. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList == libc.UintptrFromInt32(0) {
  3285. break
  3286. }
  3287. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3288. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  3289. }
  3290. p = tagList
  3291. tagList = (*TTAG)(unsafe.Pointer(tagList)).Fparent
  3292. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TTAG)(unsafe.Pointer(p)).Fbuf)
  3293. _destroyBindings(tls, (*TTAG)(unsafe.Pointer(p)).Fbindings, parser)
  3294. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, p)
  3295. goto _1
  3296. _1:
  3297. }
  3298. /* free m_openInternalEntities and m_freeInternalEntities */
  3299. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3300. for {
  3301. if entityList == libc.UintptrFromInt32(0) {
  3302. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities == libc.UintptrFromInt32(0) {
  3303. break
  3304. }
  3305. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3306. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  3307. }
  3308. openEntity = entityList
  3309. entityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(entityList)).Fnext
  3310. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, openEntity)
  3311. goto _2
  3312. _2:
  3313. }
  3314. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList, parser)
  3315. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings, parser)
  3316. _poolDestroy(tls, parser+784)
  3317. _poolDestroy(tls, parser+832)
  3318. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName)
  3319. /* external parameter entity parsers share the DTD structure
  3320. parser->m_dtd with the root parser, so we must not destroy it
  3321. */
  3322. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd != 0 {
  3323. _dtdDestroy(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0)), parser+24)
  3324. }
  3325. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  3326. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector)
  3327. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3328. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)
  3329. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts)
  3330. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem)
  3331. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3332. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3333. }
  3334. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3335. }
  3336. func XXML_UseParserAsHandlerArg(tls *libc.TLS, parser TXML_Parser) {
  3337. if parser != libc.UintptrFromInt32(0) {
  3338. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3339. }
  3340. }
  3341. func XXML_UseForeignDTD(tls *libc.TLS, parser TXML_Parser, useDTD TXML_Bool) (r _XML_Error) {
  3342. if parser == libc.UintptrFromInt32(0) {
  3343. return int32(_XML_ERROR_INVALID_ARGUMENT)
  3344. }
  3345. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3346. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3347. return int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING)
  3348. }
  3349. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = useDTD
  3350. return int32(_XML_ERROR_NONE)
  3351. }
  3352. func XXML_SetReturnNSTriplet(tls *libc.TLS, parser TXML_Parser, do_nst int32) {
  3353. var v1 int32
  3354. _ = v1
  3355. if parser == libc.UintptrFromInt32(0) {
  3356. return
  3357. }
  3358. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3359. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3360. return
  3361. }
  3362. if do_nst != 0 {
  3363. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  3364. } else {
  3365. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  3366. }
  3367. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(v1)
  3368. }
  3369. func XXML_SetUserData(tls *libc.TLS, parser TXML_Parser, p uintptr) {
  3370. var v1 uintptr
  3371. _ = v1
  3372. if parser == libc.UintptrFromInt32(0) {
  3373. return
  3374. }
  3375. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData {
  3376. v1 = p
  3377. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = v1
  3378. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = v1
  3379. } else {
  3380. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = p
  3381. }
  3382. }
  3383. func XXML_SetBase(tls *libc.TLS, parser TXML_Parser, p uintptr) (r _XML_Status) {
  3384. if parser == libc.UintptrFromInt32(0) {
  3385. return int32(_XML_STATUS_ERROR)
  3386. }
  3387. if p != 0 {
  3388. p = _poolCopyString(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+160, p)
  3389. if !(p != 0) {
  3390. return int32(_XML_STATUS_ERROR)
  3391. }
  3392. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = p
  3393. } else {
  3394. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3395. }
  3396. return int32(_XML_STATUS_OK)
  3397. }
  3398. func XXML_GetBase(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  3399. if parser == libc.UintptrFromInt32(0) {
  3400. return libc.UintptrFromInt32(0)
  3401. }
  3402. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  3403. }
  3404. func XXML_GetSpecifiedAttributeCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3405. if parser == libc.UintptrFromInt32(0) {
  3406. return -int32(1)
  3407. }
  3408. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts
  3409. }
  3410. func XXML_GetIdAttributeIndex(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3411. if parser == libc.UintptrFromInt32(0) {
  3412. return -int32(1)
  3413. }
  3414. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex
  3415. }
  3416. func XXML_SetElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler, end TXML_EndElementHandler) {
  3417. if parser == libc.UintptrFromInt32(0) {
  3418. return
  3419. }
  3420. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3421. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3422. }
  3423. func XXML_SetStartElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler) {
  3424. if parser != libc.UintptrFromInt32(0) {
  3425. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3426. }
  3427. }
  3428. func XXML_SetEndElementHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndElementHandler) {
  3429. if parser != libc.UintptrFromInt32(0) {
  3430. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3431. }
  3432. }
  3433. func XXML_SetCharacterDataHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CharacterDataHandler) {
  3434. if parser != libc.UintptrFromInt32(0) {
  3435. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = handler
  3436. }
  3437. }
  3438. func XXML_SetProcessingInstructionHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ProcessingInstructionHandler) {
  3439. if parser != libc.UintptrFromInt32(0) {
  3440. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = handler
  3441. }
  3442. }
  3443. func XXML_SetCommentHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CommentHandler) {
  3444. if parser != libc.UintptrFromInt32(0) {
  3445. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = handler
  3446. }
  3447. }
  3448. func XXML_SetCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler, end TXML_EndCdataSectionHandler) {
  3449. if parser == libc.UintptrFromInt32(0) {
  3450. return
  3451. }
  3452. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3453. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3454. }
  3455. func XXML_SetStartCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler) {
  3456. if parser != libc.UintptrFromInt32(0) {
  3457. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3458. }
  3459. }
  3460. func XXML_SetEndCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndCdataSectionHandler) {
  3461. if parser != libc.UintptrFromInt32(0) {
  3462. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3463. }
  3464. }
  3465. func XXML_SetDefaultHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3466. if parser == libc.UintptrFromInt32(0) {
  3467. return
  3468. }
  3469. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3470. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(0)
  3471. }
  3472. func XXML_SetDefaultHandlerExpand(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3473. if parser == libc.UintptrFromInt32(0) {
  3474. return
  3475. }
  3476. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3477. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3478. }
  3479. func XXML_SetDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler, end TXML_EndDoctypeDeclHandler) {
  3480. if parser == libc.UintptrFromInt32(0) {
  3481. return
  3482. }
  3483. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3484. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3485. }
  3486. func XXML_SetStartDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler) {
  3487. if parser != libc.UintptrFromInt32(0) {
  3488. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3489. }
  3490. }
  3491. func XXML_SetEndDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndDoctypeDeclHandler) {
  3492. if parser != libc.UintptrFromInt32(0) {
  3493. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3494. }
  3495. }
  3496. func XXML_SetUnparsedEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnparsedEntityDeclHandler) {
  3497. if parser != libc.UintptrFromInt32(0) {
  3498. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = handler
  3499. }
  3500. }
  3501. func XXML_SetNotationDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotationDeclHandler) {
  3502. if parser != libc.UintptrFromInt32(0) {
  3503. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = handler
  3504. }
  3505. }
  3506. func XXML_SetNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler, end TXML_EndNamespaceDeclHandler) {
  3507. if parser == libc.UintptrFromInt32(0) {
  3508. return
  3509. }
  3510. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3511. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3512. }
  3513. func XXML_SetStartNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler) {
  3514. if parser != libc.UintptrFromInt32(0) {
  3515. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3516. }
  3517. }
  3518. func XXML_SetEndNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndNamespaceDeclHandler) {
  3519. if parser != libc.UintptrFromInt32(0) {
  3520. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3521. }
  3522. }
  3523. func XXML_SetNotStandaloneHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotStandaloneHandler) {
  3524. if parser != libc.UintptrFromInt32(0) {
  3525. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = handler
  3526. }
  3527. }
  3528. func XXML_SetExternalEntityRefHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ExternalEntityRefHandler) {
  3529. if parser != libc.UintptrFromInt32(0) {
  3530. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = handler
  3531. }
  3532. }
  3533. func XXML_SetExternalEntityRefHandlerArg(tls *libc.TLS, parser TXML_Parser, arg uintptr) {
  3534. if parser == libc.UintptrFromInt32(0) {
  3535. return
  3536. }
  3537. if arg != 0 {
  3538. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = arg
  3539. } else {
  3540. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3541. }
  3542. }
  3543. func XXML_SetSkippedEntityHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_SkippedEntityHandler) {
  3544. if parser != libc.UintptrFromInt32(0) {
  3545. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = handler
  3546. }
  3547. }
  3548. func XXML_SetUnknownEncodingHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnknownEncodingHandler, data uintptr) {
  3549. if parser == libc.UintptrFromInt32(0) {
  3550. return
  3551. }
  3552. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = handler
  3553. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = data
  3554. }
  3555. func XXML_SetElementDeclHandler(tls *libc.TLS, parser TXML_Parser, eldecl TXML_ElementDeclHandler) {
  3556. if parser != libc.UintptrFromInt32(0) {
  3557. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = eldecl
  3558. }
  3559. }
  3560. func XXML_SetAttlistDeclHandler(tls *libc.TLS, parser TXML_Parser, attdecl TXML_AttlistDeclHandler) {
  3561. if parser != libc.UintptrFromInt32(0) {
  3562. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = attdecl
  3563. }
  3564. }
  3565. func XXML_SetEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_EntityDeclHandler) {
  3566. if parser != libc.UintptrFromInt32(0) {
  3567. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = handler
  3568. }
  3569. }
  3570. func XXML_SetXmlDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_XmlDeclHandler) {
  3571. if parser != libc.UintptrFromInt32(0) {
  3572. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = handler
  3573. }
  3574. }
  3575. func XXML_SetParamEntityParsing(tls *libc.TLS, parser TXML_Parser, peParsing _XML_ParamEntityParsing) (r int32) {
  3576. if parser == libc.UintptrFromInt32(0) {
  3577. return 0
  3578. }
  3579. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3580. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3581. return 0
  3582. }
  3583. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = peParsing
  3584. return int32(1)
  3585. }
  3586. func XXML_SetHashSalt(tls *libc.TLS, parser TXML_Parser, hash_salt uint64) (r int32) {
  3587. if parser == libc.UintptrFromInt32(0) {
  3588. return 0
  3589. }
  3590. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3591. return XXML_SetHashSalt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser, hash_salt)
  3592. }
  3593. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3594. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3595. return 0
  3596. }
  3597. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = hash_salt
  3598. return int32(1)
  3599. }
  3600. func XXML_Parse(tls *libc.TLS, parser TXML_Parser, s uintptr, len1 int32, isFinal int32) (r _XML_Status) {
  3601. var buff uintptr
  3602. _ = buff
  3603. if parser == libc.UintptrFromInt32(0) || len1 < 0 || s == libc.UintptrFromInt32(0) && len1 != 0 {
  3604. if parser != libc.UintptrFromInt32(0) {
  3605. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_INVALID_ARGUMENT)
  3606. }
  3607. return int32(_XML_STATUS_ERROR)
  3608. }
  3609. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3610. case int32(_XML_SUSPENDED):
  3611. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3612. return int32(_XML_STATUS_ERROR)
  3613. case int32(_XML_FINISHED):
  3614. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3615. return int32(_XML_STATUS_ERROR)
  3616. case int32(_XML_INITIALIZED):
  3617. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3618. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3619. return int32(_XML_STATUS_ERROR)
  3620. }
  3621. /* fall through */
  3622. fallthrough
  3623. default:
  3624. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3625. }
  3626. if len1 == 0 {
  3627. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3628. if !(isFinal != 0) {
  3629. return int32(_XML_STATUS_OK)
  3630. }
  3631. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3632. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3633. /* If data are left over from last buffer, and we now know that these
  3634. data are the final chunk of input, then we have to check them again
  3635. to detect errors based on that fact.
  3636. */
  3637. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = (*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr) _XML_Error)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor})))(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr, parser+48)
  3638. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode == int32(_XML_ERROR_NONE) {
  3639. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3640. case int32(_XML_SUSPENDED):
  3641. /* It is hard to be certain, but it seems that this case
  3642. * cannot occur. This code is cleaning up a previous parse
  3643. * with no new data (since len == 0). Changing the parsing
  3644. * state requires getting to execute a handler function, and
  3645. * there doesn't seem to be an opportunity for that while in
  3646. * this circumstance.
  3647. *
  3648. * Given the uncertainty, we retain the code but exclude it
  3649. * from coverage tests.
  3650. *
  3651. * LCOV_EXCL_START
  3652. */
  3653. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, parser+768)
  3654. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3655. return int32(_XML_STATUS_SUSPENDED)
  3656. /* LCOV_EXCL_STOP */
  3657. fallthrough
  3658. case int32(_XML_INITIALIZED):
  3659. fallthrough
  3660. case int32(_XML_PARSING):
  3661. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3662. /* fall through */
  3663. fallthrough
  3664. default:
  3665. return int32(_XML_STATUS_OK)
  3666. }
  3667. }
  3668. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3669. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3670. return int32(_XML_STATUS_ERROR)
  3671. } else {
  3672. buff = XXML_GetBuffer(tls, parser, len1)
  3673. if buff == libc.UintptrFromInt32(0) {
  3674. return int32(_XML_STATUS_ERROR)
  3675. } else {
  3676. libc.Xmemcpy(tls, buff, s, libc.Uint64FromInt32(len1))
  3677. return XXML_ParseBuffer(tls, parser, len1, isFinal)
  3678. }
  3679. }
  3680. return r
  3681. }
  3682. func XXML_ParseBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32, isFinal int32) (r _XML_Status) {
  3683. var result _XML_Status
  3684. var start uintptr
  3685. _, _ = result, start
  3686. result = int32(_XML_STATUS_OK)
  3687. if parser == libc.UintptrFromInt32(0) {
  3688. return int32(_XML_STATUS_ERROR)
  3689. }
  3690. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3691. case int32(_XML_SUSPENDED):
  3692. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3693. return int32(_XML_STATUS_ERROR)
  3694. case int32(_XML_FINISHED):
  3695. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3696. return int32(_XML_STATUS_ERROR)
  3697. case int32(_XML_INITIALIZED):
  3698. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3699. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3700. return int32(_XML_STATUS_ERROR)
  3701. }
  3702. /* fall through */
  3703. fallthrough
  3704. default:
  3705. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3706. }
  3707. start = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3708. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = start
  3709. *(*uintptr)(unsafe.Pointer(parser + 56)) += uintptr(len1)
  3710. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3711. *(*TXML_Index)(unsafe.Pointer(parser + 72)) += int64(len1)
  3712. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3713. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = (*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr) _XML_Error)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor})))(tls, parser, start, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr, parser+48)
  3714. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  3715. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3716. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3717. return int32(_XML_STATUS_ERROR)
  3718. } else {
  3719. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3720. case int32(_XML_SUSPENDED):
  3721. result = int32(_XML_STATUS_SUSPENDED)
  3722. case int32(_XML_INITIALIZED):
  3723. fallthrough
  3724. case int32(_XML_PARSING):
  3725. if isFinal != 0 {
  3726. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3727. return result
  3728. }
  3729. fallthrough
  3730. default: /* should not happen */
  3731. }
  3732. }
  3733. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, parser+768)
  3734. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3735. return result
  3736. }
  3737. func XXML_GetBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32) (r uintptr) {
  3738. var bufferSize, keep, neededSize, offset int32
  3739. var newBuf, v10, v11 uintptr
  3740. var v1, v2, v3, v4, v5, v6, v7, v8, v9 int64
  3741. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bufferSize, keep, neededSize, newBuf, offset, v1, v10, v11, v2, v3, v4, v5, v6, v7, v8, v9
  3742. if parser == libc.UintptrFromInt32(0) {
  3743. return libc.UintptrFromInt32(0)
  3744. }
  3745. if len1 < 0 {
  3746. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3747. return libc.UintptrFromInt32(0)
  3748. }
  3749. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3750. case int32(_XML_SUSPENDED):
  3751. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3752. return libc.UintptrFromInt32(0)
  3753. case int32(_XML_FINISHED):
  3754. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3755. return libc.UintptrFromInt32(0)
  3756. default:
  3757. }
  3758. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 {
  3759. v1 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd)
  3760. } else {
  3761. v1 = 0
  3762. }
  3763. if int64(len1) > v1 {
  3764. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3765. v2 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3766. } else {
  3767. v2 = 0
  3768. }
  3769. /* Do not invoke signed arithmetic overflow: */
  3770. neededSize = libc.Int32FromUint32(libc.Uint32FromInt32(len1) + libc.Uint32FromInt64(v2))
  3771. if neededSize < 0 {
  3772. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3773. return libc.UintptrFromInt32(0)
  3774. }
  3775. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3776. v3 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3777. } else {
  3778. v3 = 0
  3779. }
  3780. keep = int32(v3)
  3781. if keep > int32(m_XML_CONTEXT_BYTES) {
  3782. keep = int32(m_XML_CONTEXT_BYTES)
  3783. }
  3784. neededSize += keep
  3785. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3786. v4 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3787. } else {
  3788. v4 = 0
  3789. }
  3790. if int64(neededSize) <= v4 {
  3791. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3792. v5 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3793. } else {
  3794. v5 = 0
  3795. }
  3796. if int64(keep) < v5 {
  3797. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3798. v6 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3799. } else {
  3800. v6 = 0
  3801. }
  3802. offset = int32(v6) - keep
  3803. /* The buffer pointers cannot be NULL here; we have at least some bytes
  3804. * in the buffer */
  3805. libc.Xmemmove(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer+uintptr(offset), libc.Uint64FromInt64(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd)-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)+int64(keep)))
  3806. *(*uintptr)(unsafe.Pointer(parser + 56)) -= uintptr(offset)
  3807. *(*uintptr)(unsafe.Pointer(parser + 48)) -= uintptr(offset)
  3808. }
  3809. } else {
  3810. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3811. v7 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3812. } else {
  3813. v7 = 0
  3814. }
  3815. bufferSize = int32(v7)
  3816. if bufferSize == 0 {
  3817. bufferSize = int32(m_INIT_BUFFER_SIZE)
  3818. }
  3819. for cond := true; cond; cond = bufferSize < neededSize && bufferSize > 0 {
  3820. /* Do not invoke signed arithmetic overflow: */
  3821. bufferSize = libc.Int32FromUint32(libc.Uint32FromUint32(2) * libc.Uint32FromInt32(bufferSize))
  3822. }
  3823. if bufferSize <= 0 {
  3824. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3825. return libc.UintptrFromInt32(0)
  3826. }
  3827. newBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(bufferSize))
  3828. if newBuf == uintptr(0) {
  3829. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3830. return libc.UintptrFromInt32(0)
  3831. }
  3832. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = newBuf + uintptr(bufferSize)
  3833. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3834. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3835. v8 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3836. } else {
  3837. v8 = 0
  3838. }
  3839. libc.Xmemcpy(tls, newBuf, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr+uintptr(-keep), libc.Uint64FromInt64(v8+int64(keep)))
  3840. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3841. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = newBuf
  3842. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3843. v9 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3844. } else {
  3845. v9 = 0
  3846. }
  3847. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(v9) + uintptr(keep)
  3848. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(keep)
  3849. } else {
  3850. /* This must be a brand new buffer with no data in it yet */
  3851. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = newBuf
  3852. v10 = newBuf
  3853. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = v10
  3854. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = v10
  3855. }
  3856. }
  3857. v11 = libc.UintptrFromInt32(0)
  3858. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = v11
  3859. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v11
  3860. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  3861. }
  3862. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3863. }
  3864. func XXML_StopParser(tls *libc.TLS, parser TXML_Parser, resumable TXML_Bool) (r _XML_Status) {
  3865. if parser == libc.UintptrFromInt32(0) {
  3866. return int32(_XML_STATUS_ERROR)
  3867. }
  3868. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3869. case int32(_XML_SUSPENDED):
  3870. if resumable != 0 {
  3871. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3872. return int32(_XML_STATUS_ERROR)
  3873. }
  3874. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3875. case int32(_XML_FINISHED):
  3876. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3877. return int32(_XML_STATUS_ERROR)
  3878. default:
  3879. if resumable != 0 {
  3880. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 {
  3881. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPEND_PE)
  3882. return int32(_XML_STATUS_ERROR)
  3883. }
  3884. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_SUSPENDED)
  3885. } else {
  3886. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3887. }
  3888. }
  3889. return int32(_XML_STATUS_OK)
  3890. }
  3891. func XXML_ResumeParser(tls *libc.TLS, parser TXML_Parser) (r _XML_Status) {
  3892. var result _XML_Status
  3893. _ = result
  3894. result = int32(_XML_STATUS_OK)
  3895. if parser == libc.UintptrFromInt32(0) {
  3896. return int32(_XML_STATUS_ERROR)
  3897. }
  3898. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_SUSPENDED) {
  3899. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NOT_SUSPENDED)
  3900. return int32(_XML_STATUS_ERROR)
  3901. }
  3902. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3903. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = (*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr) _XML_Error)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor})))(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr, parser+48)
  3904. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  3905. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3906. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3907. return int32(_XML_STATUS_ERROR)
  3908. } else {
  3909. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3910. case int32(_XML_SUSPENDED):
  3911. result = int32(_XML_STATUS_SUSPENDED)
  3912. case int32(_XML_INITIALIZED):
  3913. fallthrough
  3914. case int32(_XML_PARSING):
  3915. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0 {
  3916. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3917. return result
  3918. }
  3919. fallthrough
  3920. default:
  3921. }
  3922. }
  3923. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, parser+768)
  3924. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3925. return result
  3926. }
  3927. func XXML_GetParsingStatus(tls *libc.TLS, parser TXML_Parser, status uintptr) {
  3928. if parser == libc.UintptrFromInt32(0) {
  3929. return
  3930. }
  3931. *(*TXML_ParsingStatus)(unsafe.Pointer(status)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus
  3932. }
  3933. func XXML_GetErrorCode(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  3934. if parser == libc.UintptrFromInt32(0) {
  3935. return int32(_XML_ERROR_INVALID_ARGUMENT)
  3936. }
  3937. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  3938. }
  3939. func XXML_GetCurrentByteIndex(tls *libc.TLS, parser TXML_Parser) (r TXML_Index) {
  3940. if parser == libc.UintptrFromInt32(0) {
  3941. return int64(-int32(1))
  3942. }
  3943. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  3944. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex - (int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  3945. }
  3946. return int64(-int32(1))
  3947. }
  3948. func XXML_GetCurrentByteCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3949. if parser == libc.UintptrFromInt32(0) {
  3950. return 0
  3951. }
  3952. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  3953. return int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  3954. }
  3955. return 0
  3956. }
  3957. func XXML_GetInputContext(tls *libc.TLS, parser TXML_Parser, offset uintptr, size uintptr) (r uintptr) {
  3958. if parser == libc.UintptrFromInt32(0) {
  3959. return libc.UintptrFromInt32(0)
  3960. }
  3961. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3962. if offset != libc.UintptrFromInt32(0) {
  3963. *(*int32)(unsafe.Pointer(offset)) = int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer))
  3964. }
  3965. if size != libc.UintptrFromInt32(0) {
  3966. *(*int32)(unsafe.Pointer(size)) = int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer))
  3967. }
  3968. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3969. }
  3970. return libc.UintptrFromInt32(0)
  3971. }
  3972. func XXML_GetCurrentLineNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  3973. if parser == libc.UintptrFromInt32(0) {
  3974. return uint64(0)
  3975. }
  3976. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  3977. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, parser+768)
  3978. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3979. }
  3980. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FlineNumber + uint64(1)
  3981. }
  3982. func XXML_GetCurrentColumnNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  3983. if parser == libc.UintptrFromInt32(0) {
  3984. return uint64(0)
  3985. }
  3986. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  3987. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, parser+768)
  3988. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3989. }
  3990. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FcolumnNumber
  3991. }
  3992. func XXML_FreeContentModel(tls *libc.TLS, parser TXML_Parser, model uintptr) {
  3993. if parser != libc.UintptrFromInt32(0) {
  3994. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, model)
  3995. }
  3996. }
  3997. func XXML_MemMalloc(tls *libc.TLS, parser TXML_Parser, size Tsize_t) (r uintptr) {
  3998. if parser == libc.UintptrFromInt32(0) {
  3999. return libc.UintptrFromInt32(0)
  4000. }
  4001. return (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, size)
  4002. }
  4003. func XXML_MemRealloc(tls *libc.TLS, parser TXML_Parser, ptr uintptr, size Tsize_t) (r uintptr) {
  4004. if parser == libc.UintptrFromInt32(0) {
  4005. return libc.UintptrFromInt32(0)
  4006. }
  4007. return (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, ptr, size)
  4008. }
  4009. func XXML_MemFree(tls *libc.TLS, parser TXML_Parser, ptr uintptr) {
  4010. if parser != libc.UintptrFromInt32(0) {
  4011. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, ptr)
  4012. }
  4013. }
  4014. func XXML_DefaultCurrent(tls *libc.TLS, parser TXML_Parser) {
  4015. if parser == libc.UintptrFromInt32(0) {
  4016. return
  4017. }
  4018. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4019. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0 {
  4020. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities)).FinternalEventPtr, (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities)).FinternalEventEndPtr)
  4021. } else {
  4022. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr)
  4023. }
  4024. }
  4025. }
  4026. func XXML_ErrorString(tls *libc.TLS, code _XML_Error) (r uintptr) {
  4027. switch code {
  4028. case int32(_XML_ERROR_NONE):
  4029. return libc.UintptrFromInt32(0)
  4030. case int32(_XML_ERROR_NO_MEMORY):
  4031. return __ccgo_ts + 123
  4032. case int32(_XML_ERROR_SYNTAX):
  4033. return __ccgo_ts + 137
  4034. case int32(_XML_ERROR_NO_ELEMENTS):
  4035. return __ccgo_ts + 150
  4036. case int32(_XML_ERROR_INVALID_TOKEN):
  4037. return __ccgo_ts + 167
  4038. case int32(_XML_ERROR_UNCLOSED_TOKEN):
  4039. return __ccgo_ts + 199
  4040. case int32(_XML_ERROR_PARTIAL_CHAR):
  4041. return __ccgo_ts + 214
  4042. case int32(_XML_ERROR_TAG_MISMATCH):
  4043. return __ccgo_ts + 232
  4044. case int32(_XML_ERROR_DUPLICATE_ATTRIBUTE):
  4045. return __ccgo_ts + 247
  4046. case int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT):
  4047. return __ccgo_ts + 267
  4048. case int32(_XML_ERROR_PARAM_ENTITY_REF):
  4049. return __ccgo_ts + 295
  4050. case int32(_XML_ERROR_UNDEFINED_ENTITY):
  4051. return __ccgo_ts + 330
  4052. case int32(_XML_ERROR_RECURSIVE_ENTITY_REF):
  4053. return __ccgo_ts + 347
  4054. case int32(_XML_ERROR_ASYNC_ENTITY):
  4055. return __ccgo_ts + 374
  4056. case int32(_XML_ERROR_BAD_CHAR_REF):
  4057. return __ccgo_ts + 394
  4058. case int32(_XML_ERROR_BINARY_ENTITY_REF):
  4059. return __ccgo_ts + 432
  4060. case int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF):
  4061. return __ccgo_ts + 459
  4062. case int32(_XML_ERROR_MISPLACED_XML_PI):
  4063. return __ccgo_ts + 501
  4064. case int32(_XML_ERROR_UNKNOWN_ENCODING):
  4065. return __ccgo_ts + 548
  4066. case int32(_XML_ERROR_INCORRECT_ENCODING):
  4067. return __ccgo_ts + 565
  4068. case int32(_XML_ERROR_UNCLOSED_CDATA_SECTION):
  4069. return __ccgo_ts + 616
  4070. case int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING):
  4071. return __ccgo_ts + 639
  4072. case int32(_XML_ERROR_NOT_STANDALONE):
  4073. return __ccgo_ts + 685
  4074. case int32(_XML_ERROR_UNEXPECTED_STATE):
  4075. return __ccgo_ts + 712
  4076. case int32(_XML_ERROR_ENTITY_DECLARED_IN_PE):
  4077. return __ccgo_ts + 763
  4078. case int32(_XML_ERROR_FEATURE_REQUIRES_XML_DTD):
  4079. return __ccgo_ts + 799
  4080. case int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING):
  4081. return __ccgo_ts + 851
  4082. /* Added in 1.95.7. */
  4083. fallthrough
  4084. case int32(_XML_ERROR_UNBOUND_PREFIX):
  4085. return __ccgo_ts + 896
  4086. /* Added in 1.95.8. */
  4087. fallthrough
  4088. case int32(_XML_ERROR_UNDECLARING_PREFIX):
  4089. return __ccgo_ts + 911
  4090. case int32(_XML_ERROR_INCOMPLETE_PE):
  4091. return __ccgo_ts + 937
  4092. case int32(_XML_ERROR_XML_DECL):
  4093. return __ccgo_ts + 975
  4094. case int32(_XML_ERROR_TEXT_DECL):
  4095. return __ccgo_ts + 1007
  4096. case int32(_XML_ERROR_PUBLICID):
  4097. return __ccgo_ts + 1040
  4098. case int32(_XML_ERROR_SUSPENDED):
  4099. return __ccgo_ts + 1074
  4100. case int32(_XML_ERROR_NOT_SUSPENDED):
  4101. return __ccgo_ts + 1091
  4102. case int32(_XML_ERROR_ABORTED):
  4103. return __ccgo_ts + 1112
  4104. case int32(_XML_ERROR_FINISHED):
  4105. return __ccgo_ts + 1128
  4106. case int32(_XML_ERROR_SUSPEND_PE):
  4107. return __ccgo_ts + 1145
  4108. /* Added in 2.0.0. */
  4109. fallthrough
  4110. case int32(_XML_ERROR_RESERVED_PREFIX_XML):
  4111. return __ccgo_ts + 1189
  4112. case int32(_XML_ERROR_RESERVED_PREFIX_XMLNS):
  4113. return __ccgo_ts + 1269
  4114. case int32(_XML_ERROR_RESERVED_NAMESPACE_URI):
  4115. return __ccgo_ts + 1328
  4116. /* Added in 2.2.5. */
  4117. fallthrough
  4118. case int32(_XML_ERROR_INVALID_ARGUMENT): /* Constant added in 2.2.1, already */
  4119. return __ccgo_ts + 1392
  4120. }
  4121. return libc.UintptrFromInt32(0)
  4122. }
  4123. func XXML_ExpatVersion(tls *libc.TLS) (r uintptr) {
  4124. /* V1 is used to string-ize the version number. However, it would
  4125. string-ize the actual version macro *names* unless we get them
  4126. substituted before being passed to V1. CPP is defined to expand
  4127. a macro, then rescan for more expansions. Thus, we use V2 to expand
  4128. the version macros, then CPP will expand the resulting V1() macro
  4129. with the correct numerals. */
  4130. /* ### I'm assuming cpp is portable in this respect... */
  4131. return __ccgo_ts + 1409
  4132. }
  4133. func XXML_ExpatVersionInfo(tls *libc.TLS) (r TXML_Expat_Version) {
  4134. var version TXML_Expat_Version
  4135. _ = version
  4136. version.Fmajor = int32(m_XML_MAJOR_VERSION)
  4137. version.Fminor = int32(m_XML_MINOR_VERSION)
  4138. version.Fmicro = int32(m_XML_MICRO_VERSION)
  4139. return version
  4140. }
  4141. func XXML_GetFeatureList(tls *libc.TLS) (r uintptr) {
  4142. return uintptr(unsafe.Pointer(&_features))
  4143. }
  4144. var _features = [6]TXML_Feature{
  4145. 0: {
  4146. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_CHAR),
  4147. Fname: __ccgo_ts + 1422,
  4148. Fvalue: int64(1),
  4149. },
  4150. 1: {
  4151. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_LCHAR),
  4152. Fname: __ccgo_ts + 1439,
  4153. Fvalue: int64(1),
  4154. },
  4155. 2: {
  4156. Ffeature: int32(_XML_FEATURE_DTD),
  4157. Fname: __ccgo_ts + 1457,
  4158. },
  4159. 3: {
  4160. Ffeature: int32(_XML_FEATURE_CONTEXT_BYTES),
  4161. Fname: __ccgo_ts + 1465,
  4162. Fvalue: int64(m_XML_CONTEXT_BYTES),
  4163. },
  4164. 4: {
  4165. Ffeature: int32(_XML_FEATURE_NS),
  4166. Fname: __ccgo_ts + 1483,
  4167. },
  4168. 5: {},
  4169. }
  4170. // C documentation
  4171. //
  4172. // /* Initially tag->rawName always points into the parse buffer;
  4173. // for those TAG instances opened while the current parse buffer was
  4174. // processed, and not yet closed, we need to store tag->rawName in a more
  4175. // permanent location, since the parse buffer is about to be discarded.
  4176. // */
  4177. func _storeRawNames(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  4178. var bufSize, nameLen int32
  4179. var rawNameBuf, tag, temp uintptr
  4180. _, _, _, _, _ = bufSize, nameLen, rawNameBuf, tag, temp
  4181. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4182. for tag != 0 {
  4183. nameLen = libc.Int32FromUint64(uint64(1) * libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen+libc.Int32FromInt32(1)))
  4184. rawNameBuf = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(nameLen)
  4185. /* Stop if already stored. Since m_tagStack is a stack, we can stop
  4186. at the first entry that has already been copied; everything
  4187. below it in the stack is already been accounted for in a
  4188. previous call to this function.
  4189. */
  4190. if (*TTAG)(unsafe.Pointer(tag)).FrawName == rawNameBuf {
  4191. break
  4192. }
  4193. /* For re-use purposes we need to ensure that the
  4194. size of tag->buf is a multiple of sizeof(XML_Char).
  4195. */
  4196. bufSize = libc.Int32FromUint64(libc.Uint64FromInt32(nameLen) + (libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength)+(libc.Uint64FromInt64(1)-libc.Uint64FromInt32(1))) & ^(libc.Uint64FromInt64(1)-libc.Uint64FromInt32(1)))
  4197. if int64(bufSize) > int64((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf) {
  4198. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TTAG)(unsafe.Pointer(tag)).Fbuf, libc.Uint64FromInt32(bufSize))
  4199. if temp == libc.UintptrFromInt32(0) {
  4200. return libc.Uint8FromInt32(0)
  4201. }
  4202. /* if tag->name.str points to tag->buf (only when namespace
  4203. processing is off) then we have to update it
  4204. */
  4205. if (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr == (*TTAG)(unsafe.Pointer(tag)).Fbuf {
  4206. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = temp
  4207. }
  4208. /* if tag->name.localPart is set (when namespace processing is on)
  4209. then update it as well, since it will always point into tag->buf
  4210. */
  4211. if (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart != 0 {
  4212. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = temp + uintptr(int64((*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  4213. }
  4214. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4215. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4216. rawNameBuf = temp + uintptr(nameLen)
  4217. }
  4218. libc.Xmemcpy(tls, rawNameBuf, (*TTAG)(unsafe.Pointer(tag)).FrawName, libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength))
  4219. (*TTAG)(unsafe.Pointer(tag)).FrawName = rawNameBuf
  4220. tag = (*TTAG)(unsafe.Pointer(tag)).Fparent
  4221. }
  4222. return libc.Uint8FromInt32(1)
  4223. }
  4224. func _contentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4225. var result _XML_Error
  4226. _ = result
  4227. result = _doContent(tls, parser, 0, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, endPtr, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0)))
  4228. if result == int32(_XML_ERROR_NONE) {
  4229. if !(_storeRawNames(tls, parser) != 0) {
  4230. return int32(_XML_ERROR_NO_MEMORY)
  4231. }
  4232. }
  4233. return result
  4234. }
  4235. func _externalEntityInitProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4236. var result _XML_Error
  4237. _ = result
  4238. result = _initializeEncoding(tls, parser)
  4239. if result != int32(_XML_ERROR_NONE) {
  4240. return result
  4241. }
  4242. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor2)
  4243. return _externalEntityInitProcessor2(tls, parser, start, end, endPtr)
  4244. }
  4245. func _externalEntityInitProcessor2(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4246. bp := tls.Alloc(16)
  4247. defer tls.Free(16)
  4248. var tok int32
  4249. var _ /* next at bp+0 */ uintptr
  4250. _ = tok
  4251. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4252. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding + 1*8))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, bp)
  4253. switch tok {
  4254. case int32(m_XML_TOK_BOM):
  4255. /* If we are at the end of the buffer, this would cause the next stage,
  4256. i.e. externalEntityInitProcessor3, to pass control directly to
  4257. doContent (by detecting XML_TOK_NONE) without processing any xml text
  4258. declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent.
  4259. */
  4260. if *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4261. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4262. return int32(_XML_ERROR_NONE)
  4263. }
  4264. start = *(*uintptr)(unsafe.Pointer(bp))
  4265. case -int32(1):
  4266. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4267. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4268. return int32(_XML_ERROR_NONE)
  4269. }
  4270. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4271. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4272. case -int32(2):
  4273. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4274. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4275. return int32(_XML_ERROR_NONE)
  4276. }
  4277. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4278. return int32(_XML_ERROR_PARTIAL_CHAR)
  4279. }
  4280. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor3)
  4281. return _externalEntityInitProcessor3(tls, parser, start, end, endPtr)
  4282. }
  4283. func _externalEntityInitProcessor3(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4284. bp := tls.Alloc(16)
  4285. defer tls.Free(16)
  4286. var result _XML_Error
  4287. var tok int32
  4288. var _ /* next at bp+0 */ uintptr
  4289. _, _ = result, tok
  4290. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4291. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4292. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding + 1*8))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, bp)
  4293. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  4294. switch tok {
  4295. case int32(m_XML_TOK_XML_DECL):
  4296. result = _processXmlDecl(tls, parser, int32(1), start, *(*uintptr)(unsafe.Pointer(bp)))
  4297. if result != int32(_XML_ERROR_NONE) {
  4298. return result
  4299. }
  4300. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4301. case int32(_XML_SUSPENDED):
  4302. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4303. return int32(_XML_ERROR_NONE)
  4304. case int32(_XML_FINISHED):
  4305. return int32(_XML_ERROR_ABORTED)
  4306. default:
  4307. start = *(*uintptr)(unsafe.Pointer(bp))
  4308. }
  4309. case -int32(1):
  4310. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4311. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4312. return int32(_XML_ERROR_NONE)
  4313. }
  4314. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4315. case -int32(2):
  4316. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4317. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4318. return int32(_XML_ERROR_NONE)
  4319. }
  4320. return int32(_XML_ERROR_PARTIAL_CHAR)
  4321. }
  4322. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  4323. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = int32(1)
  4324. return _externalEntityContentProcessor(tls, parser, start, end, endPtr)
  4325. }
  4326. func _externalEntityContentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4327. var result _XML_Error
  4328. _ = result
  4329. result = _doContent(tls, parser, int32(1), (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, endPtr, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0)))
  4330. if result == int32(_XML_ERROR_NONE) {
  4331. if !(_storeRawNames(tls, parser) != 0) {
  4332. return int32(_XML_ERROR_NO_MEMORY)
  4333. }
  4334. }
  4335. return result
  4336. }
  4337. func _doContent(tls *libc.TLS, parser TXML_Parser, startTagLevel int32, enc uintptr, _s uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool) (r _XML_Error) {
  4338. bp := tls.Alloc(112)
  4339. defer tls.Free(112)
  4340. *(*uintptr)(unsafe.Pointer(bp)) = _s
  4341. var b, context, dtd, entity, eventEndPP, eventPP, localPart, name, prefix, rawName, rawName1, rawNameEnd, tag, tag1, temp, uri, v3, v4, v5, v6, v7, v9 uintptr
  4342. var bufSize, convLen, len1, n, tok int32
  4343. var charDataHandler TXML_CharacterDataHandler
  4344. var convert_res, convert_res1 _XML_Convert_Result
  4345. var noElmHandlers TXML_Bool
  4346. var result, result1, result2, result3 _XML_Error
  4347. var _ /* bindings at bp+40 */ uintptr
  4348. var _ /* buf at bp+88 */ [4]TXML_Char
  4349. var _ /* c at bp+16 */ TXML_Char
  4350. var _ /* c at bp+92 */ TXML_Char
  4351. var _ /* ch at bp+17 */ TXML_Char
  4352. var _ /* dataPtr at bp+104 */ uintptr
  4353. var _ /* dataPtr at bp+96 */ uintptr
  4354. var _ /* fromPtr at bp+32 */ uintptr
  4355. var _ /* name at bp+48 */ TTAG_NAME
  4356. var _ /* next at bp+8 */ uintptr
  4357. var _ /* toPtr at bp+24 */ uintptr
  4358. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = b, bufSize, charDataHandler, context, convLen, convert_res, convert_res1, dtd, entity, eventEndPP, eventPP, len1, localPart, n, name, noElmHandlers, prefix, rawName, rawName1, rawNameEnd, result, result1, result2, result3, tag, tag1, temp, tok, uri, v3, v4, v5, v6, v7, v9
  4359. /* save one level of indirection */
  4360. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  4361. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  4362. eventPP = parser + 544
  4363. eventEndPP = parser + 552
  4364. } else {
  4365. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  4366. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  4367. }
  4368. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4369. for {
  4370. *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(bp)) /* XmlContentTok doesn't always set the last arg */
  4371. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 1*8))})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+8)
  4372. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4373. switch tok {
  4374. case -int32(3):
  4375. if haveMore != 0 {
  4376. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4377. return int32(_XML_ERROR_NONE)
  4378. }
  4379. *(*uintptr)(unsafe.Pointer(eventEndPP)) = end
  4380. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4381. *(*TXML_Char)(unsafe.Pointer(bp + 16)) = uint8(0xA)
  4382. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+16, int32(1))
  4383. } else {
  4384. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4385. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4386. }
  4387. }
  4388. /* We are at the end of the final buffer, should we check for
  4389. XML_SUSPENDED, XML_FINISHED?
  4390. */
  4391. if startTagLevel == 0 {
  4392. return int32(_XML_ERROR_NO_ELEMENTS)
  4393. }
  4394. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4395. return int32(_XML_ERROR_ASYNC_ENTITY)
  4396. }
  4397. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4398. return int32(_XML_ERROR_NONE)
  4399. case -int32(4):
  4400. if haveMore != 0 {
  4401. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4402. return int32(_XML_ERROR_NONE)
  4403. }
  4404. if startTagLevel > 0 {
  4405. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4406. return int32(_XML_ERROR_ASYNC_ENTITY)
  4407. }
  4408. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4409. return int32(_XML_ERROR_NONE)
  4410. }
  4411. return int32(_XML_ERROR_NO_ELEMENTS)
  4412. case m_XML_TOK_INVALID:
  4413. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4414. return int32(_XML_ERROR_INVALID_TOKEN)
  4415. case -int32(1):
  4416. if haveMore != 0 {
  4417. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4418. return int32(_XML_ERROR_NONE)
  4419. }
  4420. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4421. case -int32(2):
  4422. if haveMore != 0 {
  4423. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4424. return int32(_XML_ERROR_NONE)
  4425. }
  4426. return int32(_XML_ERROR_PARTIAL_CHAR)
  4427. case int32(m_XML_TOK_ENTITY_REF):
  4428. *(*TXML_Char)(unsafe.Pointer(bp + 17)) = libc.Uint8FromInt32((*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FpredefinedEntityName})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp + 8))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)))
  4429. if *(*TXML_Char)(unsafe.Pointer(bp + 17)) != 0 {
  4430. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4431. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+17, int32(1))
  4432. } else {
  4433. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4434. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4435. }
  4436. }
  4437. break
  4438. }
  4439. name = _poolStoreString(tls, dtd+160, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp + 8))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  4440. if !(name != 0) {
  4441. return int32(_XML_ERROR_NO_MEMORY)
  4442. }
  4443. entity = _lookup(tls, parser, dtd, name, uint64(0))
  4444. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  4445. /* First, determine if a check for an existing declaration is needed;
  4446. if yes, check that the entity exists, and that it is internal,
  4447. otherwise call the skipped entity or default handler.
  4448. */
  4449. if !((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  4450. if !(entity != 0) {
  4451. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  4452. } else {
  4453. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  4454. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  4455. }
  4456. }
  4457. } else {
  4458. if !(entity != 0) {
  4459. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4460. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, name, 0)
  4461. } else {
  4462. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4463. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4464. }
  4465. }
  4466. break
  4467. }
  4468. }
  4469. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  4470. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  4471. }
  4472. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  4473. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  4474. }
  4475. if (*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0 {
  4476. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities != 0) {
  4477. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4478. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TENTITY)(unsafe.Pointer(entity)).Fname, 0)
  4479. } else {
  4480. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4481. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4482. }
  4483. }
  4484. break
  4485. }
  4486. result = _processInternalEntity(tls, parser, entity, libc.Uint8FromInt32(0))
  4487. if result != int32(_XML_ERROR_NONE) {
  4488. return result
  4489. }
  4490. } else {
  4491. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  4492. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  4493. context = _getContext(tls, parser)
  4494. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  4495. if !(context != 0) {
  4496. return int32(_XML_ERROR_NO_MEMORY)
  4497. }
  4498. if !((*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg, context, (*TENTITY)(unsafe.Pointer(entity)).Fbase, (*TENTITY)(unsafe.Pointer(entity)).FsystemId, (*TENTITY)(unsafe.Pointer(entity)).FpublicId) != 0) {
  4499. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  4500. }
  4501. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  4502. } else {
  4503. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4504. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4505. }
  4506. }
  4507. }
  4508. case int32(m_XML_TOK_START_TAG_NO_ATTS):
  4509. /* fall through */
  4510. fallthrough
  4511. case int32(m_XML_TOK_START_TAG_WITH_ATTS):
  4512. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList != 0 {
  4513. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4514. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = (*TTAG)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList)).Fparent
  4515. } else {
  4516. tag = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(88))
  4517. if !(tag != 0) {
  4518. return int32(_XML_ERROR_NO_MEMORY)
  4519. }
  4520. (*TTAG)(unsafe.Pointer(tag)).Fbuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(libc.Int32FromInt32(m_INIT_TAG_BUF_SIZE)))
  4521. if !((*TTAG)(unsafe.Pointer(tag)).Fbuf != 0) {
  4522. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, tag)
  4523. return int32(_XML_ERROR_NO_MEMORY)
  4524. }
  4525. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(m_INIT_TAG_BUF_SIZE)
  4526. }
  4527. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  4528. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4529. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = tag
  4530. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = libc.UintptrFromInt32(0)
  4531. (*TTAG)(unsafe.Pointer(tag)).Fname.Fprefix = libc.UintptrFromInt32(0)
  4532. (*TTAG)(unsafe.Pointer(tag)).FrawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4533. (*TTAG)(unsafe.Pointer(tag)).FrawNameLength = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, (*TTAG)(unsafe.Pointer(tag)).FrawName)
  4534. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel++
  4535. rawNameEnd = (*TTAG)(unsafe.Pointer(tag)).FrawName + uintptr((*TTAG)(unsafe.Pointer(tag)).FrawNameLength)
  4536. *(*uintptr)(unsafe.Pointer(bp + 32)) = (*TTAG)(unsafe.Pointer(tag)).FrawName
  4537. *(*uintptr)(unsafe.Pointer(bp + 24)) = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4538. for {
  4539. convert_res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp+32, rawNameEnd, bp+24, (*TTAG)(unsafe.Pointer(tag)).FbufEnd-uintptr(1))
  4540. convLen = int32(int64(*(*uintptr)(unsafe.Pointer(bp + 24))) - int64((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  4541. if *(*uintptr)(unsafe.Pointer(bp + 32)) >= rawNameEnd || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  4542. (*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen = convLen
  4543. break
  4544. }
  4545. bufSize = int32(int64((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf)) << int32(1)
  4546. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TTAG)(unsafe.Pointer(tag)).Fbuf, libc.Uint64FromInt32(bufSize))
  4547. if temp == libc.UintptrFromInt32(0) {
  4548. return int32(_XML_ERROR_NO_MEMORY)
  4549. }
  4550. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4551. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4552. *(*uintptr)(unsafe.Pointer(bp + 24)) = temp + uintptr(convLen)
  4553. goto _2
  4554. _2:
  4555. }
  4556. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4557. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)))) = uint8('\000')
  4558. result1 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), tag+24, tag+80)
  4559. if result1 != 0 {
  4560. return result1
  4561. }
  4562. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4563. (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  4564. } else {
  4565. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4566. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4567. }
  4568. }
  4569. _poolClear(tls, parser+784)
  4570. case int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS):
  4571. /* fall through */
  4572. fallthrough
  4573. case int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS):
  4574. rawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4575. *(*uintptr)(unsafe.Pointer(bp + 40)) = libc.UintptrFromInt32(0)
  4576. noElmHandlers = libc.Uint8FromInt32(1)
  4577. (*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr = _poolStoreString(tls, parser+784, enc, rawName, rawName+uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, rawName)))
  4578. if !((*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr != 0) {
  4579. return int32(_XML_ERROR_NO_MEMORY)
  4580. }
  4581. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  4582. result2 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), bp+48, bp+40)
  4583. if result2 != int32(_XML_ERROR_NONE) {
  4584. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 40)))
  4585. return result2
  4586. }
  4587. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  4588. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4589. (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  4590. noElmHandlers = libc.Uint8FromInt32(0)
  4591. }
  4592. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4593. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4594. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(eventEndPP))
  4595. }
  4596. (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr)
  4597. noElmHandlers = libc.Uint8FromInt32(0)
  4598. }
  4599. if noElmHandlers != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4600. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4601. }
  4602. _poolClear(tls, parser+784)
  4603. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 40)))
  4604. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4605. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4606. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4607. } else {
  4608. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 8)), end, nextPtr)
  4609. }
  4610. }
  4611. case int32(m_XML_TOK_END_TAG):
  4612. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == startTagLevel {
  4613. return int32(_XML_ERROR_ASYNC_ENTITY)
  4614. } else {
  4615. tag1 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4616. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = (*TTAG)(unsafe.Pointer(tag1)).Fparent
  4617. (*TTAG)(unsafe.Pointer(tag1)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4618. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag1
  4619. rawName1 = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(2))
  4620. len1 = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, rawName1)
  4621. if len1 != (*TTAG)(unsafe.Pointer(tag1)).FrawNameLength || libc.Xmemcmp(tls, (*TTAG)(unsafe.Pointer(tag1)).FrawName, rawName1, libc.Uint64FromInt32(len1)) != 0 {
  4622. *(*uintptr)(unsafe.Pointer(eventPP)) = rawName1
  4623. return int32(_XML_ERROR_TAG_MISMATCH)
  4624. }
  4625. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel--
  4626. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4627. localPart = (*TTAG)(unsafe.Pointer(tag1)).Fname.FlocalPart
  4628. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && localPart != 0 {
  4629. /* localPart and prefix may have been overwritten in
  4630. tag->name.str, since this points to the binding->uri
  4631. buffer which gets re-used; so we have to add them again
  4632. */
  4633. uri = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fstr + uintptr((*TTAG)(unsafe.Pointer(tag1)).Fname.FuriLen)
  4634. /* don't need to check for space - already done in storeAtts() */
  4635. for *(*TXML_Char)(unsafe.Pointer(localPart)) != 0 {
  4636. v3 = uri
  4637. uri++
  4638. v4 = localPart
  4639. localPart++
  4640. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(v4))
  4641. }
  4642. prefix = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fprefix
  4643. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && prefix != 0 {
  4644. v5 = uri
  4645. uri++
  4646. *(*TXML_Char)(unsafe.Pointer(v5)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  4647. for *(*TXML_Char)(unsafe.Pointer(prefix)) != 0 {
  4648. v6 = uri
  4649. uri++
  4650. v7 = prefix
  4651. prefix++
  4652. *(*TXML_Char)(unsafe.Pointer(v6)) = *(*TXML_Char)(unsafe.Pointer(v7))
  4653. }
  4654. }
  4655. *(*TXML_Char)(unsafe.Pointer(uri)) = uint8('\000')
  4656. }
  4657. (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TTAG)(unsafe.Pointer(tag1)).Fname.Fstr)
  4658. } else {
  4659. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4660. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4661. }
  4662. }
  4663. for (*TTAG)(unsafe.Pointer(tag1)).Fbindings != 0 {
  4664. b = (*TTAG)(unsafe.Pointer(tag1)).Fbindings
  4665. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  4666. (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fname)
  4667. }
  4668. (*TTAG)(unsafe.Pointer(tag1)).Fbindings = (*TBINDING)(unsafe.Pointer((*TTAG)(unsafe.Pointer(tag1)).Fbindings)).FnextTagBinding
  4669. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  4670. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  4671. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  4672. }
  4673. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4674. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4675. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4676. } else {
  4677. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 8)), end, nextPtr)
  4678. }
  4679. }
  4680. }
  4681. case int32(m_XML_TOK_CHAR_REF):
  4682. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)))
  4683. if n < 0 {
  4684. return int32(_XML_ERROR_BAD_CHAR_REF)
  4685. }
  4686. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4687. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+88, XXmlUtf8Encode(tls, n, bp+88))
  4688. } else {
  4689. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4690. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4691. }
  4692. }
  4693. case int32(m_XML_TOK_XML_DECL):
  4694. return int32(_XML_ERROR_MISPLACED_XML_PI)
  4695. case int32(m_XML_TOK_DATA_NEWLINE):
  4696. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4697. *(*TXML_Char)(unsafe.Pointer(bp + 92)) = uint8(0xA)
  4698. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+92, int32(1))
  4699. } else {
  4700. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4701. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4702. }
  4703. }
  4704. case int32(m_XML_TOK_CDATA_SECT_OPEN):
  4705. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler != 0 {
  4706. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  4707. } else {
  4708. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4709. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, 0)
  4710. } else {
  4711. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4712. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4713. }
  4714. }
  4715. }
  4716. result3 = _doCdataSection(tls, parser, enc, bp+8, end, nextPtr, haveMore)
  4717. if result3 != int32(_XML_ERROR_NONE) {
  4718. return result3
  4719. } else {
  4720. if !(*(*uintptr)(unsafe.Pointer(bp + 8)) != 0) {
  4721. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_cdataSectionProcessor)
  4722. return result3
  4723. }
  4724. }
  4725. case -int32(5):
  4726. if haveMore != 0 {
  4727. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4728. return int32(_XML_ERROR_NONE)
  4729. }
  4730. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4731. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  4732. *(*uintptr)(unsafe.Pointer(bp + 96)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  4733. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+96, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  4734. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(int64(*(*uintptr)(unsafe.Pointer(bp + 96)))-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)))
  4735. } else {
  4736. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp)))))
  4737. }
  4738. } else {
  4739. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4740. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4741. }
  4742. }
  4743. /* We are at the end of the final buffer, should we check for
  4744. XML_SUSPENDED, XML_FINISHED?
  4745. */
  4746. if startTagLevel == 0 {
  4747. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  4748. return int32(_XML_ERROR_NO_ELEMENTS)
  4749. }
  4750. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4751. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  4752. return int32(_XML_ERROR_ASYNC_ENTITY)
  4753. }
  4754. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4755. return int32(_XML_ERROR_NONE)
  4756. case int32(m_XML_TOK_DATA_CHARS):
  4757. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  4758. if charDataHandler != 0 {
  4759. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  4760. for {
  4761. *(*uintptr)(unsafe.Pointer(bp + 104)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  4762. convert_res1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, *(*uintptr)(unsafe.Pointer(bp + 8)), bp+104, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  4763. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4764. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(int64(*(*uintptr)(unsafe.Pointer(bp + 104)))-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)))
  4765. if convert_res1 == int32(_XML_CONVERT_COMPLETED) || convert_res1 == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  4766. break
  4767. }
  4768. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4769. goto _8
  4770. _8:
  4771. }
  4772. } else {
  4773. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(int64(*(*uintptr)(unsafe.Pointer(bp + 8)))-int64(*(*uintptr)(unsafe.Pointer(bp)))))
  4774. }
  4775. } else {
  4776. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4777. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4778. }
  4779. }
  4780. case int32(m_XML_TOK_PI):
  4781. if !(_reportProcessingInstruction(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) {
  4782. return int32(_XML_ERROR_NO_MEMORY)
  4783. }
  4784. case int32(m_XML_TOK_COMMENT):
  4785. if !(_reportComment(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) {
  4786. return int32(_XML_ERROR_NO_MEMORY)
  4787. }
  4788. default:
  4789. /* All of the tokens produced by XmlContentTok() have their own
  4790. * explicit cases, so this default is not strictly necessary.
  4791. * However it is a useful safety net, so we retain the code and
  4792. * simply exclude it from the coverage tests.
  4793. *
  4794. * LCOV_EXCL_START
  4795. */
  4796. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4797. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4798. }
  4799. break
  4800. /* LCOV_EXCL_STOP */
  4801. }
  4802. v9 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4803. *(*uintptr)(unsafe.Pointer(bp)) = v9
  4804. *(*uintptr)(unsafe.Pointer(eventPP)) = v9
  4805. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4806. case int32(_XML_SUSPENDED):
  4807. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4808. return int32(_XML_ERROR_NONE)
  4809. case int32(_XML_FINISHED):
  4810. return int32(_XML_ERROR_ABORTED)
  4811. default:
  4812. }
  4813. goto _1
  4814. _1:
  4815. }
  4816. /* not reached */
  4817. return r
  4818. }
  4819. // C documentation
  4820. //
  4821. // /* This function does not call free() on the allocated memory, merely
  4822. // * moving it to the parser's m_freeBindingList where it can be freed or
  4823. // * reused as appropriate.
  4824. // */
  4825. func _freeBindings(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  4826. var b uintptr
  4827. _ = b
  4828. for bindings != 0 {
  4829. b = bindings
  4830. /* m_startNamespaceDeclHandler will have been called for this
  4831. * binding in addBindings(), so call the end handler now.
  4832. */
  4833. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  4834. (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fname)
  4835. }
  4836. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  4837. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  4838. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  4839. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  4840. }
  4841. }
  4842. // C documentation
  4843. //
  4844. // /* Precondition: all arguments must be non-NULL;
  4845. // Purpose:
  4846. // - normalize attributes
  4847. // - check attributes for well-formedness
  4848. // - generate namespace aware attribute names (URI, prefix)
  4849. // - build list of attributes for startElementHandler
  4850. // - default attributes
  4851. // - process namespace declarations (check and report them)
  4852. // - generate namespace aware element name (URI, prefix)
  4853. // */
  4854. func _storeAtts(tls *libc.TLS, parser TXML_Parser, enc uintptr, attStr uintptr, tagNamePtr uintptr, bindingsPtr uintptr) (r _XML_Error) {
  4855. bp := tls.Alloc(80)
  4856. defer tls.Free(80)
  4857. var appAtts, attId, b, binding, currAtt, da, dtd, elementType, id, localPart, name, p, s, s1, s2, temp, temp1, uri, v11, v18, v19, v20, v21, v24, v25, v28, v31, v32, v36 uintptr
  4858. var attIndex, i, j, j1, n, nDefaultAtts, nPrefixes, nsAttsSize, oldAttsSize, prefixLen, v13, v17, v2, v23, v30, v33, v38, v40, v6, v7, v8, v9 int32
  4859. var c TXML_Char
  4860. var isCdata TXML_Bool
  4861. var mask, uriHash, version, v14 uint64
  4862. var oldNsAttsPower, step, v10 uint8
  4863. var result, result1, result2 _XML_Error
  4864. var _ /* sip_key at bp+56 */ Tsipkey
  4865. var _ /* sip_state at bp+0 */ Tsiphash
  4866. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = appAtts, attId, attIndex, b, binding, c, currAtt, da, dtd, elementType, i, id, isCdata, j, j1, localPart, mask, n, nDefaultAtts, nPrefixes, name, nsAttsSize, oldAttsSize, oldNsAttsPower, p, prefixLen, result, result1, result2, s, s1, s2, step, temp, temp1, uri, uriHash, version, v10, v11, v13, v14, v17, v18, v19, v2, v20, v21, v23, v24, v25, v28, v30, v31, v32, v33, v36, v38, v40, v6, v7, v8, v9
  4867. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the attribute list for the application */
  4868. attIndex = 0
  4869. nPrefixes = 0
  4870. /* lookup the element type name */
  4871. elementType = _lookup(tls, parser, dtd+40, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr, uint64(0))
  4872. if !(elementType != 0) {
  4873. name = _poolCopyString(tls, dtd+160, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr)
  4874. if !(name != 0) {
  4875. return int32(_XML_ERROR_NO_MEMORY)
  4876. }
  4877. elementType = _lookup(tls, parser, dtd+40, name, uint64(40))
  4878. if !(elementType != 0) {
  4879. return int32(_XML_ERROR_NO_MEMORY)
  4880. }
  4881. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && !(_setElementTypePrefix(tls, parser, elementType) != 0) {
  4882. return int32(_XML_ERROR_NO_MEMORY)
  4883. }
  4884. }
  4885. nDefaultAtts = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FnDefaultAtts
  4886. /* get the attributes from the tokenizer */
  4887. n = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FgetAtts})))(tls, enc, attStr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  4888. if n+nDefaultAtts > (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize {
  4889. oldAttsSize = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize
  4890. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = n + nDefaultAtts + int32(m_INIT_ATTS_SIZE)
  4891. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts, libc.Uint64FromInt32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize)*libc.Uint64FromInt64(32))
  4892. if temp == libc.UintptrFromInt32(0) {
  4893. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = oldAttsSize
  4894. return int32(_XML_ERROR_NO_MEMORY)
  4895. }
  4896. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts = temp
  4897. if n > oldAttsSize {
  4898. (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FgetAtts})))(tls, enc, attStr, n, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  4899. }
  4900. }
  4901. appAtts = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts
  4902. i = 0
  4903. for {
  4904. if !(i < n) {
  4905. break
  4906. }
  4907. currAtt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32
  4908. /* add the name and value to the attribute list */
  4909. attId = _getAttributeId(tls, parser, enc, (*TATTRIBUTE)(unsafe.Pointer(currAtt)).Fname, (*TATTRIBUTE)(unsafe.Pointer(currAtt)).Fname+uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, (*TATTRIBUTE)(unsafe.Pointer(currAtt)).Fname)))
  4910. if !(attId != 0) {
  4911. return int32(_XML_ERROR_NO_MEMORY)
  4912. }
  4913. /* Detect duplicate attributes by their QNames. This does not work when
  4914. namespace processing is turned on and different prefixes for the same
  4915. namespace are used. For this case we have a check further down.
  4916. */
  4917. if *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) != 0 {
  4918. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  4919. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).Fname
  4920. }
  4921. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  4922. }
  4923. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(1)
  4924. v2 = attIndex
  4925. attIndex++
  4926. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v2)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname
  4927. if !((*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).Fnormalized != 0) {
  4928. isCdata = libc.Uint8FromInt32(1)
  4929. /* figure out whether declared as other than CDATA */
  4930. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized != 0 {
  4931. j = 0
  4932. for {
  4933. if !(j < nDefaultAtts) {
  4934. break
  4935. }
  4936. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*24))).Fid {
  4937. isCdata = (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*24))).FisCdata
  4938. break
  4939. }
  4940. goto _3
  4941. _3:
  4942. ;
  4943. j++
  4944. }
  4945. }
  4946. /* normalize the attribute value */
  4947. result = _storeAttributeValue(tls, parser, enc, isCdata, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).FvaluePtr, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).FvalueEnd, parser+784)
  4948. if result != 0 {
  4949. return result
  4950. }
  4951. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  4952. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  4953. } else {
  4954. /* the value did not need normalizing */
  4955. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = _poolStoreString(tls, parser+784, enc, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).FvaluePtr, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).FvalueEnd)
  4956. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) == uintptr(0) {
  4957. return int32(_XML_ERROR_NO_MEMORY)
  4958. }
  4959. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  4960. }
  4961. /* handle prefixed attribute names */
  4962. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix != 0 {
  4963. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0 {
  4964. /* deal with namespace declarations here */
  4965. result1 = _addBinding(tls, parser, (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix, attId, *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)), bindingsPtr)
  4966. if result1 != 0 {
  4967. return result1
  4968. }
  4969. attIndex--
  4970. } else {
  4971. /* deal with other prefixed names later */
  4972. attIndex++
  4973. nPrefixes++
  4974. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(2)
  4975. }
  4976. } else {
  4977. attIndex++
  4978. }
  4979. goto _1
  4980. _1:
  4981. ;
  4982. i++
  4983. }
  4984. /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */
  4985. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = attIndex
  4986. if (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FidAtt != 0 && *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FidAtt)).Fname + uintptr(-libc.Int32FromInt32(1)))) != 0 {
  4987. i = 0
  4988. for {
  4989. if !(i < attIndex) {
  4990. break
  4991. }
  4992. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) == (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FidAtt)).Fname {
  4993. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = i
  4994. break
  4995. }
  4996. goto _4
  4997. _4:
  4998. ;
  4999. i += int32(2)
  5000. }
  5001. } else {
  5002. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = -int32(1)
  5003. }
  5004. /* do attribute defaulting */
  5005. i = 0
  5006. for {
  5007. if !(i < nDefaultAtts) {
  5008. break
  5009. }
  5010. da = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(i)*24
  5011. if !(*(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) != 0) && (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue != 0 {
  5012. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fprefix != 0 {
  5013. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fxmlns != 0 {
  5014. result2 = _addBinding(tls, parser, (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fprefix, (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid, (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue, bindingsPtr)
  5015. if result2 != 0 {
  5016. return result2
  5017. }
  5018. } else {
  5019. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(2)
  5020. nPrefixes++
  5021. v6 = attIndex
  5022. attIndex++
  5023. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v6)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5024. v7 = attIndex
  5025. attIndex++
  5026. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v7)*8)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5027. }
  5028. } else {
  5029. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(1)
  5030. v8 = attIndex
  5031. attIndex++
  5032. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v8)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5033. v9 = attIndex
  5034. attIndex++
  5035. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v9)*8)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5036. }
  5037. }
  5038. goto _5
  5039. _5:
  5040. ;
  5041. i++
  5042. }
  5043. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = uintptr(0)
  5044. /* expand prefixed attribute names, check for duplicates,
  5045. and clear flags that say whether attributes were specified */
  5046. i = 0
  5047. if nPrefixes != 0 { /* hash table index */
  5048. version = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion
  5049. nsAttsSize = libc.Int32FromInt32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5050. oldNsAttsPower = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5051. /* size of hash table must be at least 2 * (# of prefixed attributes) */
  5052. if nPrefixes<<int32(1)>>(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower != 0 {
  5053. /* hash table size must also be a power of 2 and >= 8 */
  5054. for {
  5055. v11 = parser + 760
  5056. v10 = *(*uint8)(unsafe.Pointer(v11))
  5057. *(*uint8)(unsafe.Pointer(v11))++
  5058. if !(nPrefixes>>v10 != 0) {
  5059. break
  5060. }
  5061. }
  5062. if libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) < int32(3) {
  5063. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(3)
  5064. }
  5065. nsAttsSize = libc.Int32FromInt32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5066. temp1 = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts, libc.Uint64FromInt32(nsAttsSize)*libc.Uint64FromInt64(24))
  5067. if !(temp1 != 0) {
  5068. /* Restore actual size of memory in m_nsAtts */
  5069. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5070. return int32(_XML_ERROR_NO_MEMORY)
  5071. }
  5072. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = temp1
  5073. version = uint64(0) /* force re-initialization of m_nsAtts hash table */
  5074. }
  5075. /* using a version flag saves us from initializing m_nsAtts every time */
  5076. if !(version != 0) { /* initialize version flags when version wraps around */
  5077. version = uint64(m_INIT_ATTS_VERSION)
  5078. j1 = nsAttsSize
  5079. for {
  5080. if !(j1 != 0) {
  5081. break
  5082. }
  5083. j1--
  5084. v13 = j1
  5085. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(v13)*24))).Fversion = version
  5086. goto _12
  5087. _12:
  5088. }
  5089. }
  5090. version--
  5091. v14 = version
  5092. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = v14
  5093. /* expand prefixed names and check for duplicates */
  5094. for {
  5095. if !(i < attIndex) {
  5096. break
  5097. }
  5098. s = *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8))
  5099. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1))))) == int32(2) {
  5100. _copy_salt_to_sipkey(tls, parser, bp+56)
  5101. _sip24_init(tls, bp, bp+56)
  5102. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = uint8(0) /* clear flag */
  5103. id = _lookup(tls, parser, dtd+80, s, uint64(0))
  5104. if !(id != 0) || !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  5105. /* This code is walking through the appAtts array, dealing
  5106. * with (in this case) a prefixed attribute name. To be in
  5107. * the array, the attribute must have already been bound, so
  5108. * has to have passed through the hash table lookup once
  5109. * already. That implies that an entry for it already
  5110. * exists, so the lookup above will return a pointer to
  5111. * already allocated memory. There is no opportunaity for
  5112. * the allocator to fail, so the condition above cannot be
  5113. * fulfilled.
  5114. *
  5115. * Since it is difficult to be certain that the above
  5116. * analysis is complete, we retain the test and merely
  5117. * remove the code from coverage tests.
  5118. */
  5119. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  5120. }
  5121. b = (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fbinding
  5122. if !(b != 0) {
  5123. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5124. }
  5125. j1 = 0
  5126. for {
  5127. if !(j1 < (*TBINDING)(unsafe.Pointer(b)).FuriLen) {
  5128. break
  5129. }
  5130. c = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(j1)))
  5131. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5132. v17 = 0
  5133. } else {
  5134. v19 = parser + 784 + 24
  5135. v18 = *(*uintptr)(unsafe.Pointer(v19))
  5136. *(*uintptr)(unsafe.Pointer(v19))++
  5137. *(*TXML_Char)(unsafe.Pointer(v18)) = c
  5138. v17 = libc.Int32FromInt32(1)
  5139. }
  5140. if !(v17 != 0) {
  5141. return int32(_XML_ERROR_NO_MEMORY)
  5142. }
  5143. goto _16
  5144. _16:
  5145. ;
  5146. j1++
  5147. }
  5148. _sip24_update(tls, bp, (*TBINDING)(unsafe.Pointer(b)).Furi, libc.Uint64FromInt32((*TBINDING)(unsafe.Pointer(b)).FuriLen)*uint64(1))
  5149. for {
  5150. v20 = s
  5151. s++
  5152. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(v20))) != int32(m_ASCII_COLON)) {
  5153. break
  5154. }
  5155. }
  5156. _sip24_update(tls, bp, s, _keylen(tls, s)*uint64(1))
  5157. for { /* copies null terminator */
  5158. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5159. v23 = 0
  5160. } else {
  5161. v25 = parser + 784 + 24
  5162. v24 = *(*uintptr)(unsafe.Pointer(v25))
  5163. *(*uintptr)(unsafe.Pointer(v25))++
  5164. *(*TXML_Char)(unsafe.Pointer(v24)) = *(*TXML_Char)(unsafe.Pointer(s))
  5165. v23 = libc.Int32FromInt32(1)
  5166. }
  5167. if !(v23 != 0) {
  5168. return int32(_XML_ERROR_NO_MEMORY)
  5169. }
  5170. goto _22
  5171. _22:
  5172. ;
  5173. v21 = s
  5174. s++
  5175. if !(*(*TXML_Char)(unsafe.Pointer(v21)) != 0) {
  5176. break
  5177. }
  5178. }
  5179. uriHash = _sip24_final(tls, bp)
  5180. /* Check hash table for duplicate of expanded name (uriName).
  5181. Derived from code in lookup(parser, HASH_TABLE *table, ...).
  5182. */
  5183. step = uint8(0)
  5184. mask = libc.Uint64FromInt32(nsAttsSize - int32(1))
  5185. j1 = libc.Int32FromUint64(uriHash & mask) /* index into hash table */
  5186. for (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fversion == version {
  5187. /* for speed we compare stored hash values first */
  5188. if uriHash == (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fhash {
  5189. s1 = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5190. s2 = (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).FuriName
  5191. /* s1 is null terminated, but not s2 */
  5192. for {
  5193. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s2))) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) != 0) {
  5194. break
  5195. }
  5196. goto _26
  5197. _26:
  5198. ;
  5199. s1++
  5200. s2++
  5201. }
  5202. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  5203. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5204. }
  5205. }
  5206. if !(step != 0) {
  5207. step = uint8(uriHash & ^mask >> (libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  5208. }
  5209. if j1 < libc.Int32FromUint8(step) {
  5210. j1 += nsAttsSize - libc.Int32FromUint8(step)
  5211. } else {
  5212. j1 -= libc.Int32FromUint8(step)
  5213. }
  5214. }
  5215. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 { /* append namespace separator and prefix */
  5216. *(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fptr + uintptr(-libc.Int32FromInt32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5217. s = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fname
  5218. for {
  5219. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5220. v30 = 0
  5221. } else {
  5222. v32 = parser + 784 + 24
  5223. v31 = *(*uintptr)(unsafe.Pointer(v32))
  5224. *(*uintptr)(unsafe.Pointer(v32))++
  5225. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s))
  5226. v30 = libc.Int32FromInt32(1)
  5227. }
  5228. if !(v30 != 0) {
  5229. return int32(_XML_ERROR_NO_MEMORY)
  5230. }
  5231. goto _29
  5232. _29:
  5233. ;
  5234. v28 = s
  5235. s++
  5236. if !(*(*TXML_Char)(unsafe.Pointer(v28)) != 0) {
  5237. break
  5238. }
  5239. }
  5240. }
  5241. /* store expanded name in attribute list */
  5242. s = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5243. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5244. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) = s
  5245. /* fill empty slot with new version, uriName and hash value */
  5246. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fversion = version
  5247. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fhash = uriHash
  5248. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).FuriName = s
  5249. nPrefixes--
  5250. v33 = nPrefixes
  5251. if !(v33 != 0) {
  5252. i += int32(2)
  5253. break
  5254. }
  5255. } else { /* not prefixed */
  5256. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = uint8(0)
  5257. } /* clear flag */
  5258. goto _15
  5259. _15:
  5260. ;
  5261. i += int32(2)
  5262. }
  5263. }
  5264. /* clear flags for the remaining attributes */
  5265. for {
  5266. if !(i < attIndex) {
  5267. break
  5268. }
  5269. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) + uintptr(-libc.Int32FromInt32(1)))) = uint8(0)
  5270. goto _34
  5271. _34:
  5272. ;
  5273. i += int32(2)
  5274. }
  5275. binding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5276. for {
  5277. if !(binding != 0) {
  5278. break
  5279. }
  5280. *(*TXML_Char)(unsafe.Pointer((*Tattribute_id)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).FattId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(0)
  5281. goto _35
  5282. _35:
  5283. ;
  5284. binding = (*TBINDING)(unsafe.Pointer(binding)).FnextTagBinding
  5285. }
  5286. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  5287. return int32(_XML_ERROR_NONE)
  5288. }
  5289. /* expand the element type name */
  5290. if (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix != 0 {
  5291. binding = (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix)).Fbinding
  5292. if !(binding != 0) {
  5293. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5294. }
  5295. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5296. for {
  5297. v36 = localPart
  5298. localPart++
  5299. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(v36))) != int32(m_ASCII_COLON)) {
  5300. break
  5301. }
  5302. }
  5303. } else {
  5304. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  5305. binding = (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding
  5306. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5307. } else {
  5308. return int32(_XML_ERROR_NONE)
  5309. }
  5310. }
  5311. prefixLen = 0
  5312. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname != 0 {
  5313. for {
  5314. v38 = prefixLen
  5315. prefixLen++
  5316. if !(*(*TXML_Char)(unsafe.Pointer((*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname + uintptr(v38))) != 0) {
  5317. break
  5318. }
  5319. goto _37
  5320. _37:
  5321. } /* prefixLen includes null terminator */
  5322. }
  5323. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FlocalPart = localPart
  5324. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FuriLen = (*TBINDING)(unsafe.Pointer(binding)).FuriLen
  5325. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fprefix = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname
  5326. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FprefixLen = prefixLen
  5327. i = 0
  5328. for {
  5329. v40 = i
  5330. i++
  5331. if !(*(*TXML_Char)(unsafe.Pointer(localPart + uintptr(v40))) != 0) {
  5332. break
  5333. }
  5334. goto _39
  5335. _39:
  5336. } /* i includes null terminator */
  5337. n = i + (*TBINDING)(unsafe.Pointer(binding)).FuriLen + prefixLen
  5338. if n > (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc {
  5339. uri = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(n+libc.Int32FromInt32(m_EXPAND_SPARE))*libc.Uint64FromInt64(1))
  5340. if !(uri != 0) {
  5341. return int32(_XML_ERROR_NO_MEMORY)
  5342. }
  5343. (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc = n + int32(m_EXPAND_SPARE)
  5344. libc.Xmemcpy(tls, uri, (*TBINDING)(unsafe.Pointer(binding)).Furi, libc.Uint64FromInt32((*TBINDING)(unsafe.Pointer(binding)).FuriLen)*uint64(1))
  5345. p = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  5346. for {
  5347. if !(p != 0) {
  5348. break
  5349. }
  5350. if (*TTAG)(unsafe.Pointer(p)).Fname.Fstr == (*TBINDING)(unsafe.Pointer(binding)).Furi {
  5351. (*TTAG)(unsafe.Pointer(p)).Fname.Fstr = uri
  5352. }
  5353. goto _41
  5354. _41:
  5355. ;
  5356. p = (*TTAG)(unsafe.Pointer(p)).Fparent
  5357. }
  5358. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(binding)).Furi)
  5359. (*TBINDING)(unsafe.Pointer(binding)).Furi = uri
  5360. }
  5361. /* if m_namespaceSeparator != '\0' then uri includes it already */
  5362. uri = (*TBINDING)(unsafe.Pointer(binding)).Furi + uintptr((*TBINDING)(unsafe.Pointer(binding)).FuriLen)
  5363. libc.Xmemcpy(tls, uri, localPart, libc.Uint64FromInt32(i)*uint64(1))
  5364. /* we always have a namespace separator between localPart and prefix */
  5365. if prefixLen != 0 {
  5366. uri += uintptr(i - int32(1))
  5367. *(*TXML_Char)(unsafe.Pointer(uri)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator /* replace null terminator */
  5368. libc.Xmemcpy(tls, uri+uintptr(1), (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname, libc.Uint64FromInt32(prefixLen)*uint64(1))
  5369. }
  5370. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr = (*TBINDING)(unsafe.Pointer(binding)).Furi
  5371. return int32(_XML_ERROR_NONE)
  5372. }
  5373. // C documentation
  5374. //
  5375. // /* addBinding() overwrites the value of prefix->binding without checking.
  5376. // Therefore one must keep track of the old value outside of addBinding().
  5377. // */
  5378. func _addBinding(tls *libc.TLS, parser TXML_Parser, prefix uintptr, attId uintptr, uri uintptr, bindingsPtr uintptr) (r _XML_Error) {
  5379. var b, temp, v3 uintptr
  5380. var isXML, isXMLNS, mustBeXML TXML_Bool
  5381. var len1, v2 int32
  5382. _, _, _, _, _, _, _, _ = b, isXML, isXMLNS, len1, mustBeXML, temp, v2, v3
  5383. mustBeXML = libc.Uint8FromInt32(0)
  5384. isXML = libc.Uint8FromInt32(1)
  5385. isXMLNS = libc.Uint8FromInt32(1)
  5386. /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */
  5387. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 {
  5388. return int32(_XML_ERROR_UNDECLARING_PREFIX)
  5389. }
  5390. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname))) == int32(m_ASCII_x) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 1))) == int32(m_ASCII_m) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 2))) == int32(m_ASCII_l) {
  5391. /* Not allowed to bind xmlns */
  5392. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32(m_ASCII_n) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 4))) == int32(m_ASCII_s) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 5))) == int32('\000') {
  5393. return int32(_XML_ERROR_RESERVED_PREFIX_XMLNS)
  5394. }
  5395. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32('\000') {
  5396. mustBeXML = libc.Uint8FromInt32(1)
  5397. }
  5398. }
  5399. len1 = 0
  5400. for {
  5401. if !(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1))) != 0) {
  5402. break
  5403. }
  5404. if isXML != 0 && (len1 > _xmlLen || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != libc.Int32FromUint8(_xmlNamespace[len1])) {
  5405. isXML = libc.Uint8FromInt32(0)
  5406. }
  5407. if !(mustBeXML != 0) && isXMLNS != 0 && (len1 > _xmlnsLen || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != libc.Int32FromUint8(_xmlnsNamespace[len1])) {
  5408. isXMLNS = libc.Uint8FromInt32(0)
  5409. }
  5410. goto _1
  5411. _1:
  5412. ;
  5413. len1++
  5414. }
  5415. isXML = libc.BoolUint8(isXML != 0 && len1 == _xmlLen)
  5416. isXMLNS = libc.BoolUint8(isXMLNS != 0 && len1 == _xmlnsLen)
  5417. if libc.Int32FromUint8(mustBeXML) != libc.Int32FromUint8(isXML) {
  5418. if mustBeXML != 0 {
  5419. v2 = int32(_XML_ERROR_RESERVED_PREFIX_XML)
  5420. } else {
  5421. v2 = int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  5422. }
  5423. return v2
  5424. }
  5425. if isXMLNS != 0 {
  5426. return int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  5427. }
  5428. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  5429. len1++
  5430. }
  5431. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList != 0 {
  5432. b = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  5433. if len1 > (*TBINDING)(unsafe.Pointer(b)).FuriAlloc {
  5434. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TBINDING)(unsafe.Pointer(b)).Furi, libc.Uint64FromInt64(1)*libc.Uint64FromInt32(len1+libc.Int32FromInt32(m_EXPAND_SPARE)))
  5435. if temp == libc.UintptrFromInt32(0) {
  5436. return int32(_XML_ERROR_NO_MEMORY)
  5437. }
  5438. (*TBINDING)(unsafe.Pointer(b)).Furi = temp
  5439. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  5440. }
  5441. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  5442. } else {
  5443. b = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(48))
  5444. if !(b != 0) {
  5445. return int32(_XML_ERROR_NO_MEMORY)
  5446. }
  5447. (*TBINDING)(unsafe.Pointer(b)).Furi = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(1)*libc.Uint64FromInt32(len1+libc.Int32FromInt32(m_EXPAND_SPARE)))
  5448. if !((*TBINDING)(unsafe.Pointer(b)).Furi != 0) {
  5449. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  5450. return int32(_XML_ERROR_NO_MEMORY)
  5451. }
  5452. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  5453. }
  5454. (*TBINDING)(unsafe.Pointer(b)).FuriLen = len1
  5455. libc.Xmemcpy(tls, (*TBINDING)(unsafe.Pointer(b)).Furi, uri, libc.Uint64FromInt32(len1)*uint64(1))
  5456. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  5457. *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(len1-int32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5458. }
  5459. (*TBINDING)(unsafe.Pointer(b)).Fprefix = prefix
  5460. (*TBINDING)(unsafe.Pointer(b)).FattId = attId
  5461. (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding = (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding
  5462. /* NULL binding when default namespace undeclared */
  5463. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && prefix == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+304 {
  5464. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = libc.UintptrFromInt32(0)
  5465. } else {
  5466. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = b
  5467. }
  5468. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5469. *(*uintptr)(unsafe.Pointer(bindingsPtr)) = b
  5470. /* if attId == NULL then we are not starting a namespace scope */
  5471. if attId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler != 0 {
  5472. if (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0 {
  5473. v3 = uri
  5474. } else {
  5475. v3 = uintptr(0)
  5476. }
  5477. (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TPREFIX)(unsafe.Pointer(prefix)).Fname, v3)
  5478. }
  5479. return int32(_XML_ERROR_NONE)
  5480. }
  5481. var _xmlNamespace = [37]TXML_Char{
  5482. 0: uint8(m_ASCII_h),
  5483. 1: uint8(m_ASCII_t),
  5484. 2: uint8(m_ASCII_t),
  5485. 3: uint8(m_ASCII_p),
  5486. 4: uint8(m_ASCII_COLON),
  5487. 5: uint8(m_ASCII_SLASH),
  5488. 6: uint8(m_ASCII_SLASH),
  5489. 7: uint8(m_ASCII_w),
  5490. 8: uint8(m_ASCII_w),
  5491. 9: uint8(m_ASCII_w),
  5492. 10: uint8(m_ASCII_PERIOD),
  5493. 11: uint8(m_ASCII_w),
  5494. 12: uint8(m_ASCII_3),
  5495. 13: uint8(m_ASCII_PERIOD),
  5496. 14: uint8(m_ASCII_o),
  5497. 15: uint8(m_ASCII_r),
  5498. 16: uint8(m_ASCII_g),
  5499. 17: uint8(m_ASCII_SLASH),
  5500. 18: uint8(m_ASCII_X),
  5501. 19: uint8(m_ASCII_M),
  5502. 20: uint8(m_ASCII_L),
  5503. 21: uint8(m_ASCII_SLASH),
  5504. 22: uint8(m_ASCII_1),
  5505. 23: uint8(m_ASCII_9),
  5506. 24: uint8(m_ASCII_9),
  5507. 25: uint8(m_ASCII_8),
  5508. 26: uint8(m_ASCII_SLASH),
  5509. 27: uint8(m_ASCII_n),
  5510. 28: uint8(m_ASCII_a),
  5511. 29: uint8(m_ASCII_m),
  5512. 30: uint8(m_ASCII_e),
  5513. 31: uint8(m_ASCII_s),
  5514. 32: uint8(m_ASCII_p),
  5515. 33: uint8(m_ASCII_a),
  5516. 34: uint8(m_ASCII_c),
  5517. 35: uint8(m_ASCII_e),
  5518. }
  5519. var _xmlLen = libc.Int32FromUint64(libc.Uint64FromInt32(libc.Int32FromInt64(37))/libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  5520. var _xmlnsNamespace = [30]TXML_Char{
  5521. 0: uint8(m_ASCII_h),
  5522. 1: uint8(m_ASCII_t),
  5523. 2: uint8(m_ASCII_t),
  5524. 3: uint8(m_ASCII_p),
  5525. 4: uint8(m_ASCII_COLON),
  5526. 5: uint8(m_ASCII_SLASH),
  5527. 6: uint8(m_ASCII_SLASH),
  5528. 7: uint8(m_ASCII_w),
  5529. 8: uint8(m_ASCII_w),
  5530. 9: uint8(m_ASCII_w),
  5531. 10: uint8(m_ASCII_PERIOD),
  5532. 11: uint8(m_ASCII_w),
  5533. 12: uint8(m_ASCII_3),
  5534. 13: uint8(m_ASCII_PERIOD),
  5535. 14: uint8(m_ASCII_o),
  5536. 15: uint8(m_ASCII_r),
  5537. 16: uint8(m_ASCII_g),
  5538. 17: uint8(m_ASCII_SLASH),
  5539. 18: uint8(m_ASCII_2),
  5540. 19: uint8(m_ASCII_0),
  5541. 20: uint8(m_ASCII_0),
  5542. 21: uint8(m_ASCII_0),
  5543. 22: uint8(m_ASCII_SLASH),
  5544. 23: uint8(m_ASCII_x),
  5545. 24: uint8(m_ASCII_m),
  5546. 25: uint8(m_ASCII_l),
  5547. 26: uint8(m_ASCII_n),
  5548. 27: uint8(m_ASCII_s),
  5549. 28: uint8(m_ASCII_SLASH),
  5550. }
  5551. var _xmlnsLen = libc.Int32FromUint64(libc.Uint64FromInt32(libc.Int32FromInt64(30))/libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  5552. // C documentation
  5553. //
  5554. // /* The idea here is to avoid using stack for each CDATA section when
  5555. // the whole file is parsed with one call.
  5556. // */
  5557. func _cdataSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  5558. bp := tls.Alloc(16)
  5559. defer tls.Free(16)
  5560. *(*uintptr)(unsafe.Pointer(bp)) = _start
  5561. var result _XML_Error
  5562. _ = result
  5563. result = _doCdataSection(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, bp, end, endPtr, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0)))
  5564. if result != int32(_XML_ERROR_NONE) {
  5565. return result
  5566. }
  5567. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  5568. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 { /* we are parsing an external entity */
  5569. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  5570. return _externalEntityContentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  5571. } else {
  5572. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  5573. return _contentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  5574. }
  5575. }
  5576. return result
  5577. }
  5578. // C documentation
  5579. //
  5580. // /* startPtr gets set to non-null if the section is closed, and to null if
  5581. // the section is not yet closed.
  5582. // */
  5583. func _doCdataSection(tls *libc.TLS, parser TXML_Parser, enc uintptr, startPtr uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool) (r _XML_Error) {
  5584. bp := tls.Alloc(32)
  5585. defer tls.Free(32)
  5586. var charDataHandler TXML_CharacterDataHandler
  5587. var convert_res _XML_Convert_Result
  5588. var eventEndPP, eventPP, v3 uintptr
  5589. var tok int32
  5590. var _ /* c at bp+16 */ TXML_Char
  5591. var _ /* dataPtr at bp+24 */ uintptr
  5592. var _ /* next at bp+8 */ uintptr
  5593. var _ /* s at bp+0 */ uintptr
  5594. _, _, _, _, _, _ = charDataHandler, convert_res, eventEndPP, eventPP, tok, v3
  5595. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  5596. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  5597. eventPP = parser + 544
  5598. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  5599. eventEndPP = parser + 552
  5600. } else {
  5601. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  5602. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  5603. }
  5604. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  5605. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  5606. for {
  5607. *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(bp)) /* in case of XML_TOK_NONE or XML_TOK_PARTIAL */
  5608. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 2*8))})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+8)
  5609. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  5610. switch tok {
  5611. case int32(m_XML_TOK_CDATA_SECT_CLOSE):
  5612. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler != 0 {
  5613. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  5614. } else {
  5615. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  5616. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, 0)
  5617. } else {
  5618. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5619. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  5620. }
  5621. }
  5622. }
  5623. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  5624. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  5625. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  5626. return int32(_XML_ERROR_ABORTED)
  5627. } else {
  5628. return int32(_XML_ERROR_NONE)
  5629. }
  5630. fallthrough
  5631. case int32(m_XML_TOK_DATA_NEWLINE):
  5632. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  5633. *(*TXML_Char)(unsafe.Pointer(bp + 16)) = uint8(0xA)
  5634. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+16, int32(1))
  5635. } else {
  5636. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5637. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  5638. }
  5639. }
  5640. case int32(m_XML_TOK_DATA_CHARS):
  5641. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  5642. if charDataHandler != 0 {
  5643. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  5644. for {
  5645. *(*uintptr)(unsafe.Pointer(bp + 24)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  5646. convert_res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, *(*uintptr)(unsafe.Pointer(bp + 8)), bp+24, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  5647. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  5648. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(int64(*(*uintptr)(unsafe.Pointer(bp + 24)))-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)))
  5649. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  5650. break
  5651. }
  5652. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  5653. goto _2
  5654. _2:
  5655. }
  5656. } else {
  5657. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(int64(*(*uintptr)(unsafe.Pointer(bp + 8)))-int64(*(*uintptr)(unsafe.Pointer(bp)))))
  5658. }
  5659. } else {
  5660. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5661. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  5662. }
  5663. }
  5664. case m_XML_TOK_INVALID:
  5665. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  5666. return int32(_XML_ERROR_INVALID_TOKEN)
  5667. case -int32(2):
  5668. if haveMore != 0 {
  5669. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  5670. return int32(_XML_ERROR_NONE)
  5671. }
  5672. return int32(_XML_ERROR_PARTIAL_CHAR)
  5673. case -int32(1):
  5674. fallthrough
  5675. case -int32(4):
  5676. if haveMore != 0 {
  5677. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  5678. return int32(_XML_ERROR_NONE)
  5679. }
  5680. return int32(_XML_ERROR_UNCLOSED_CDATA_SECTION)
  5681. default:
  5682. /* Every token returned by XmlCdataSectionTok() has its own
  5683. * explicit case, so this default case will never be executed.
  5684. * We retain it as a safety net and exclude it from the coverage
  5685. * statistics.
  5686. *
  5687. * LCOV_EXCL_START
  5688. */
  5689. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  5690. return int32(_XML_ERROR_UNEXPECTED_STATE)
  5691. /* LCOV_EXCL_STOP */
  5692. }
  5693. v3 = *(*uintptr)(unsafe.Pointer(bp + 8))
  5694. *(*uintptr)(unsafe.Pointer(bp)) = v3
  5695. *(*uintptr)(unsafe.Pointer(eventPP)) = v3
  5696. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  5697. case int32(_XML_SUSPENDED):
  5698. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  5699. return int32(_XML_ERROR_NONE)
  5700. case int32(_XML_FINISHED):
  5701. return int32(_XML_ERROR_ABORTED)
  5702. default:
  5703. }
  5704. goto _1
  5705. _1:
  5706. }
  5707. /* not reached */
  5708. return r
  5709. }
  5710. // C documentation
  5711. //
  5712. // /* The idea here is to avoid using stack for each IGNORE section when
  5713. // the whole file is parsed with one call.
  5714. // */
  5715. func _ignoreSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  5716. bp := tls.Alloc(16)
  5717. defer tls.Free(16)
  5718. *(*uintptr)(unsafe.Pointer(bp)) = _start
  5719. var result _XML_Error
  5720. _ = result
  5721. result = _doIgnoreSection(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, bp, end, endPtr, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0)))
  5722. if result != int32(_XML_ERROR_NONE) {
  5723. return result
  5724. }
  5725. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  5726. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  5727. return _prologProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  5728. }
  5729. return result
  5730. }
  5731. // C documentation
  5732. //
  5733. // /* startPtr gets set to non-null is the section is closed, and to null
  5734. // if the section is not yet closed.
  5735. // */
  5736. func _doIgnoreSection(tls *libc.TLS, parser TXML_Parser, enc uintptr, startPtr uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool) (r _XML_Error) {
  5737. bp := tls.Alloc(16)
  5738. defer tls.Free(16)
  5739. var eventEndPP, eventPP, s uintptr
  5740. var tok int32
  5741. var _ /* next at bp+0 */ uintptr
  5742. _, _, _, _ = eventEndPP, eventPP, s, tok
  5743. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  5744. s = *(*uintptr)(unsafe.Pointer(startPtr))
  5745. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  5746. eventPP = parser + 544
  5747. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  5748. eventEndPP = parser + 552
  5749. } else {
  5750. /* It's not entirely clear, but it seems the following two lines
  5751. * of code cannot be executed. The only occasions on which 'enc'
  5752. * is not 'encoding' are when this function is called
  5753. * from the internal entity processing, and IGNORE sections are an
  5754. * error in internal entities.
  5755. *
  5756. * Since it really isn't clear that this is true, we keep the code
  5757. * and just remove it from our coverage tests.
  5758. *
  5759. * LCOV_EXCL_START
  5760. */
  5761. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  5762. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  5763. /* LCOV_EXCL_STOP */
  5764. }
  5765. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  5766. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  5767. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 3*8))})))(tls, enc, s, end, bp)
  5768. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  5769. switch tok {
  5770. case int32(m_XML_TOK_IGNORE_SECT):
  5771. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5772. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  5773. }
  5774. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  5775. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  5776. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  5777. return int32(_XML_ERROR_ABORTED)
  5778. } else {
  5779. return int32(_XML_ERROR_NONE)
  5780. }
  5781. fallthrough
  5782. case m_XML_TOK_INVALID:
  5783. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  5784. return int32(_XML_ERROR_INVALID_TOKEN)
  5785. case -int32(2):
  5786. if haveMore != 0 {
  5787. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  5788. return int32(_XML_ERROR_NONE)
  5789. }
  5790. return int32(_XML_ERROR_PARTIAL_CHAR)
  5791. case -int32(1):
  5792. fallthrough
  5793. case -int32(4):
  5794. if haveMore != 0 {
  5795. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  5796. return int32(_XML_ERROR_NONE)
  5797. }
  5798. return int32(_XML_ERROR_SYNTAX) /* XML_ERROR_UNCLOSED_IGNORE_SECTION */
  5799. default:
  5800. /* All of the tokens that XmlIgnoreSectionTok() returns have
  5801. * explicit cases to handle them, so this default case is never
  5802. * executed. We keep it as a safety net anyway, and remove it
  5803. * from our test coverage statistics.
  5804. *
  5805. * LCOV_EXCL_START
  5806. */
  5807. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  5808. return int32(_XML_ERROR_UNEXPECTED_STATE)
  5809. /* LCOV_EXCL_STOP */
  5810. }
  5811. /* not reached */
  5812. return r
  5813. }
  5814. func _initializeEncoding(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  5815. var s uintptr
  5816. var v1 func(*libc.TLS, uintptr, uintptr, uintptr) int32
  5817. _, _ = s, v1
  5818. s = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName
  5819. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  5820. v1 = XXmlInitEncodingNS
  5821. } else {
  5822. v1 = XXmlInitEncoding
  5823. }
  5824. if v1(tls, parser+296, parser+288, s) != 0 {
  5825. return int32(_XML_ERROR_NONE)
  5826. }
  5827. return _handleUnknownEncoding(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName)
  5828. }
  5829. func _processXmlDecl(tls *libc.TLS, parser TXML_Parser, isGeneralTextEntity int32, s uintptr, next uintptr) (r _XML_Error) {
  5830. bp := tls.Alloc(48)
  5831. defer tls.Free(48)
  5832. var result _XML_Error
  5833. var storedEncName, storedversion uintptr
  5834. var v1 func(*libc.TLS, int32, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) int32
  5835. var _ /* encodingName at bp+0 */ uintptr
  5836. var _ /* newEncoding at bp+8 */ uintptr
  5837. var _ /* standalone at bp+32 */ int32
  5838. var _ /* version at bp+16 */ uintptr
  5839. var _ /* versionend at bp+24 */ uintptr
  5840. _, _, _, _ = result, storedEncName, storedversion, v1
  5841. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  5842. storedEncName = libc.UintptrFromInt32(0)
  5843. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  5844. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  5845. storedversion = libc.UintptrFromInt32(0)
  5846. *(*int32)(unsafe.Pointer(bp + 32)) = -int32(1)
  5847. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  5848. v1 = XXmlParseXmlDeclNS
  5849. } else {
  5850. v1 = XXmlParseXmlDecl
  5851. }
  5852. if !(v1(tls, isGeneralTextEntity, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, next, parser+544, bp+16, bp+24, bp, bp+8, bp+32) != 0) {
  5853. if isGeneralTextEntity != 0 {
  5854. return int32(_XML_ERROR_TEXT_DECL)
  5855. } else {
  5856. return int32(_XML_ERROR_XML_DECL)
  5857. }
  5858. }
  5859. if !(isGeneralTextEntity != 0) && *(*int32)(unsafe.Pointer(bp + 32)) == int32(1) {
  5860. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).Fstandalone = libc.Uint8FromInt32(1)
  5861. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing == int32(_XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) {
  5862. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  5863. }
  5864. }
  5865. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler != 0 {
  5866. if *(*uintptr)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) {
  5867. storedEncName = _poolStoreString(tls, parser+832, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp))+uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FnameLength})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp)))))
  5868. if !(storedEncName != 0) {
  5869. return int32(_XML_ERROR_NO_MEMORY)
  5870. }
  5871. (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fptr
  5872. }
  5873. if *(*uintptr)(unsafe.Pointer(bp + 16)) != 0 {
  5874. storedversion = _poolStoreString(tls, parser+832, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24))-uintptr((*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FminBytesPerChar))
  5875. if !(storedversion != 0) {
  5876. return int32(_XML_ERROR_NO_MEMORY)
  5877. }
  5878. }
  5879. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, storedversion, storedEncName, *(*int32)(unsafe.Pointer(bp + 32)))
  5880. } else {
  5881. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5882. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, next)
  5883. }
  5884. }
  5885. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName == libc.UintptrFromInt32(0) {
  5886. if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 {
  5887. /* Check that the specified encoding does not conflict with what
  5888. * the parser has already deduced. Do we have the same number
  5889. * of bytes in the smallest representation of a character? If
  5890. * this is UTF-16, is it the same endianness?
  5891. */
  5892. if (*TENCODING)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FminBytesPerChar != (*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FminBytesPerChar || (*TENCODING)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FminBytesPerChar == int32(2) && *(*uintptr)(unsafe.Pointer(bp + 8)) != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  5893. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  5894. return int32(_XML_ERROR_INCORRECT_ENCODING)
  5895. }
  5896. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = *(*uintptr)(unsafe.Pointer(bp + 8))
  5897. } else {
  5898. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  5899. if !(storedEncName != 0) {
  5900. storedEncName = _poolStoreString(tls, parser+832, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp))+uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FnameLength})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp)))))
  5901. if !(storedEncName != 0) {
  5902. return int32(_XML_ERROR_NO_MEMORY)
  5903. }
  5904. }
  5905. result = _handleUnknownEncoding(tls, parser, storedEncName)
  5906. _poolClear(tls, parser+832)
  5907. if result == int32(_XML_ERROR_UNKNOWN_ENCODING) {
  5908. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  5909. }
  5910. return result
  5911. }
  5912. }
  5913. }
  5914. if storedEncName != 0 || storedversion != 0 {
  5915. _poolClear(tls, parser+832)
  5916. }
  5917. return int32(_XML_ERROR_NONE)
  5918. }
  5919. func _handleUnknownEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Error) {
  5920. bp := tls.Alloc(1056)
  5921. defer tls.Free(1056)
  5922. var enc uintptr
  5923. var i int32
  5924. var v2 func(*libc.TLS, uintptr, uintptr, TCONVERTER, uintptr) uintptr
  5925. var _ /* info at bp+0 */ TXML_Encoding
  5926. _, _, _ = enc, i, v2
  5927. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler != 0 {
  5928. i = 0
  5929. for {
  5930. if !(i < int32(256)) {
  5931. break
  5932. }
  5933. *(*int32)(unsafe.Pointer(bp + uintptr(i)*4)) = -int32(1)
  5934. goto _1
  5935. _1:
  5936. ;
  5937. i++
  5938. }
  5939. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert = libc.UintptrFromInt32(0)
  5940. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata = libc.UintptrFromInt32(0)
  5941. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease = libc.UintptrFromInt32(0)
  5942. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData, encodingName, bp) != 0 {
  5943. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(XXmlSizeOfUnknownEncoding(tls)))
  5944. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem != 0) {
  5945. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != 0 {
  5946. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  5947. }
  5948. return int32(_XML_ERROR_NO_MEMORY)
  5949. }
  5950. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  5951. v2 = XXmlInitUnknownEncodingNS
  5952. } else {
  5953. v2 = XXmlInitUnknownEncoding
  5954. }
  5955. enc = v2(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem, bp, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  5956. if enc != 0 {
  5957. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata
  5958. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease
  5959. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = enc
  5960. return int32(_XML_ERROR_NONE)
  5961. }
  5962. }
  5963. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != libc.UintptrFromInt32(0) {
  5964. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  5965. }
  5966. }
  5967. return int32(_XML_ERROR_UNKNOWN_ENCODING)
  5968. }
  5969. func _prologInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  5970. var result _XML_Error
  5971. _ = result
  5972. result = _initializeEncoding(tls, parser)
  5973. if result != int32(_XML_ERROR_NONE) {
  5974. return result
  5975. }
  5976. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  5977. return _prologProcessor(tls, parser, s, end, nextPtr)
  5978. }
  5979. func _externalParEntInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  5980. var result _XML_Error
  5981. _ = result
  5982. result = _initializeEncoding(tls, parser)
  5983. if result != int32(_XML_ERROR_NONE) {
  5984. return result
  5985. }
  5986. /* we know now that XML_Parse(Buffer) has been called,
  5987. so we consider the external parameter entity read */
  5988. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).FparamEntityRead = libc.Uint8FromInt32(1)
  5989. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue != 0 {
  5990. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueInitProcessor)
  5991. return _entityValueInitProcessor(tls, parser, s, end, nextPtr)
  5992. } else {
  5993. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntProcessor)
  5994. return _externalParEntProcessor(tls, parser, s, end, nextPtr)
  5995. }
  5996. return r
  5997. }
  5998. func _entityValueInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  5999. bp := tls.Alloc(16)
  6000. defer tls.Free(16)
  6001. var result _XML_Error
  6002. var start uintptr
  6003. var tok int32
  6004. var _ /* next at bp+0 */ uintptr
  6005. _, _, _ = result, start, tok
  6006. start = s
  6007. *(*uintptr)(unsafe.Pointer(bp)) = start
  6008. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6009. for {
  6010. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, bp)
  6011. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  6012. if tok <= 0 {
  6013. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6014. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6015. return int32(_XML_ERROR_NONE)
  6016. }
  6017. switch tok {
  6018. case m_XML_TOK_INVALID:
  6019. return int32(_XML_ERROR_INVALID_TOKEN)
  6020. case -int32(1):
  6021. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6022. case -int32(2):
  6023. return int32(_XML_ERROR_PARTIAL_CHAR)
  6024. case -int32(4): /* start == end */
  6025. fallthrough
  6026. default:
  6027. break
  6028. }
  6029. /* found end of entity value - can store it now */
  6030. return _storeEntityValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end)
  6031. } else {
  6032. if tok == int32(m_XML_TOK_XML_DECL) {
  6033. result = _processXmlDecl(tls, parser, 0, start, *(*uintptr)(unsafe.Pointer(bp)))
  6034. if result != int32(_XML_ERROR_NONE) {
  6035. return result
  6036. }
  6037. /* At this point, m_parsingStatus.parsing cannot be XML_SUSPENDED. For
  6038. * that to happen, a parameter entity parsing handler must have attempted
  6039. * to suspend the parser, which fails and raises an error. The parser can
  6040. * be aborted, but can't be suspended.
  6041. */
  6042. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6043. return int32(_XML_ERROR_ABORTED)
  6044. }
  6045. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6046. /* stop scanning for text declaration - we found one */
  6047. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueProcessor)
  6048. return _entityValueProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, nextPtr)
  6049. } else {
  6050. if tok == int32(m_XML_TOK_BOM) && *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  6051. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6052. return int32(_XML_ERROR_NONE)
  6053. } else {
  6054. if tok == int32(m_XML_TOK_INSTANCE_START) {
  6055. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6056. return int32(_XML_ERROR_SYNTAX)
  6057. }
  6058. }
  6059. }
  6060. }
  6061. start = *(*uintptr)(unsafe.Pointer(bp))
  6062. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6063. goto _1
  6064. _1:
  6065. }
  6066. return r
  6067. }
  6068. func _externalParEntProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6069. bp := tls.Alloc(16)
  6070. defer tls.Free(16)
  6071. var tok int32
  6072. var _ /* next at bp+0 */ uintptr
  6073. _ = tok
  6074. *(*uintptr)(unsafe.Pointer(bp)) = s
  6075. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, bp)
  6076. if tok <= 0 {
  6077. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6078. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6079. return int32(_XML_ERROR_NONE)
  6080. }
  6081. switch tok {
  6082. case m_XML_TOK_INVALID:
  6083. return int32(_XML_ERROR_INVALID_TOKEN)
  6084. case -int32(1):
  6085. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6086. case -int32(2):
  6087. return int32(_XML_ERROR_PARTIAL_CHAR)
  6088. case -int32(4): /* start == end */
  6089. fallthrough
  6090. default:
  6091. break
  6092. }
  6093. } else {
  6094. if tok == int32(m_XML_TOK_BOM) {
  6095. s = *(*uintptr)(unsafe.Pointer(bp))
  6096. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, bp)
  6097. }
  6098. }
  6099. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6100. return _doProlog(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, tok, *(*uintptr)(unsafe.Pointer(bp)), nextPtr, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0)), libc.Uint8FromInt32(1))
  6101. }
  6102. func _entityValueProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6103. bp := tls.Alloc(16)
  6104. defer tls.Free(16)
  6105. var enc, start uintptr
  6106. var tok int32
  6107. var _ /* next at bp+0 */ uintptr
  6108. _, _, _ = enc, start, tok
  6109. start = s
  6110. *(*uintptr)(unsafe.Pointer(bp)) = s
  6111. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6112. for {
  6113. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, start, end, bp)
  6114. if tok <= 0 {
  6115. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6116. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6117. return int32(_XML_ERROR_NONE)
  6118. }
  6119. switch tok {
  6120. case m_XML_TOK_INVALID:
  6121. return int32(_XML_ERROR_INVALID_TOKEN)
  6122. case -int32(1):
  6123. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6124. case -int32(2):
  6125. return int32(_XML_ERROR_PARTIAL_CHAR)
  6126. case -int32(4): /* start == end */
  6127. fallthrough
  6128. default:
  6129. break
  6130. }
  6131. /* found end of entity value - can store it now */
  6132. return _storeEntityValue(tls, parser, enc, s, end)
  6133. }
  6134. start = *(*uintptr)(unsafe.Pointer(bp))
  6135. goto _1
  6136. _1:
  6137. }
  6138. return r
  6139. }
  6140. func _prologProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6141. bp := tls.Alloc(16)
  6142. defer tls.Free(16)
  6143. var tok int32
  6144. var _ /* next at bp+0 */ uintptr
  6145. _ = tok
  6146. *(*uintptr)(unsafe.Pointer(bp)) = s
  6147. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, bp)
  6148. return _doProlog(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, tok, *(*uintptr)(unsafe.Pointer(bp)), nextPtr, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0)), libc.Uint8FromInt32(1))
  6149. }
  6150. func _doProlog(tls *libc.TLS, parser TXML_Parser, enc uintptr, s uintptr, end uintptr, tok int32, _next uintptr, nextPtr uintptr, haveMore TXML_Bool, allowClosingDoctype TXML_Bool) (r _XML_Error) {
  6151. bp := tls.Alloc(16)
  6152. defer tls.Free(16)
  6153. *(*uintptr)(unsafe.Pointer(bp)) = _next
  6154. var attVal, content, dtd, el, entity, entity1, entity2, eventEndPP, eventPP, model, name, name1, name2, name3, new_connector, new_scaff_index, nxt, prefix, pubId, systemId, tem, tem1, v65, v67, v68, v70, v71, v74, v75, v77, v78, v86, p80 uintptr
  6155. var betweenDecl, hadParamEntityRefs, hadParamEntityRefs1, handleDefault TXML_Bool
  6156. var myindex, myindex1, nameLen, role, v66, v69, v73, v76, v82, v84, v85, v88 int32
  6157. var quant _XML_Content_Quant
  6158. var result, result1, result2, result3, result4, result5 _XML_Error
  6159. var v72, v79, v83 bool
  6160. var v81 uint32
  6161. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = attVal, betweenDecl, content, dtd, el, entity, entity1, entity2, eventEndPP, eventPP, hadParamEntityRefs, hadParamEntityRefs1, handleDefault, model, myindex, myindex1, name, name1, name2, name3, nameLen, new_connector, new_scaff_index, nxt, prefix, pubId, quant, result, result1, result2, result3, result4, result5, role, systemId, tem, tem1, v65, v66, v67, v68, v69, v70, v71, v72, v73, v74, v75, v76, v77, v78, v79, v81, v82, v83, v84, v85, v86, v88, p80
  6162. /* save one level of indirection */
  6163. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  6164. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6165. eventPP = parser + 544
  6166. eventEndPP = parser + 552
  6167. } else {
  6168. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6169. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6170. }
  6171. for {
  6172. handleDefault = libc.Uint8FromInt32(1)
  6173. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6174. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6175. if tok <= 0 {
  6176. if haveMore != 0 && tok != m_XML_TOK_INVALID {
  6177. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6178. return int32(_XML_ERROR_NONE)
  6179. }
  6180. switch tok {
  6181. case m_XML_TOK_INVALID:
  6182. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6183. return int32(_XML_ERROR_INVALID_TOKEN)
  6184. case -int32(1):
  6185. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6186. case -int32(2):
  6187. return int32(_XML_ERROR_PARTIAL_CHAR)
  6188. case -int32(m_XML_TOK_PROLOG_S):
  6189. tok = -tok
  6190. case -int32(4):
  6191. /* for internal PE NOT referenced between declarations */
  6192. if enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding && !((*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities)).FbetweenDecl != 0) {
  6193. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6194. return int32(_XML_ERROR_NONE)
  6195. }
  6196. /* WFC: PE Between Declarations - must check that PE contains
  6197. complete markup, not only for external PEs, but also for
  6198. internal PEs if the reference occurs between declarations.
  6199. */
  6200. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6201. if (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPROLOG_STATE)(unsafe.Pointer(parser + 496)).Fhandler})))(tls, parser+496, -int32(4), end, end, enc) == int32(_XML_ROLE_ERROR) {
  6202. return int32(_XML_ERROR_INCOMPLETE_PE)
  6203. }
  6204. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6205. return int32(_XML_ERROR_NONE)
  6206. }
  6207. return int32(_XML_ERROR_NO_ELEMENTS)
  6208. default:
  6209. tok = -tok
  6210. *(*uintptr)(unsafe.Pointer(bp)) = end
  6211. break
  6212. }
  6213. }
  6214. role = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPROLOG_STATE)(unsafe.Pointer(parser + 496)).Fhandler})))(tls, parser+496, tok, s, *(*uintptr)(unsafe.Pointer(bp)), enc)
  6215. switch role {
  6216. case int32(_XML_ROLE_XML_DECL):
  6217. goto _2
  6218. case int32(_XML_ROLE_DOCTYPE_NAME):
  6219. goto _3
  6220. case int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET):
  6221. goto _4
  6222. case int32(_XML_ROLE_TEXT_DECL):
  6223. goto _5
  6224. case int32(_XML_ROLE_DOCTYPE_PUBLIC_ID):
  6225. goto _6
  6226. case int32(_XML_ROLE_ENTITY_PUBLIC_ID):
  6227. goto _7
  6228. case int32(_XML_ROLE_DOCTYPE_CLOSE):
  6229. goto _8
  6230. case int32(_XML_ROLE_INSTANCE_START):
  6231. goto _9
  6232. case int32(_XML_ROLE_ATTLIST_ELEMENT_NAME):
  6233. goto _10
  6234. case int32(_XML_ROLE_ATTRIBUTE_NAME):
  6235. goto _11
  6236. case int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA):
  6237. goto _12
  6238. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ID):
  6239. goto _13
  6240. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREF):
  6241. goto _14
  6242. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREFS):
  6243. goto _15
  6244. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITY):
  6245. goto _16
  6246. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITIES):
  6247. goto _17
  6248. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN):
  6249. goto _18
  6250. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS):
  6251. goto _19
  6252. case int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE):
  6253. goto _20
  6254. case int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE):
  6255. goto _21
  6256. case int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE):
  6257. goto _22
  6258. case int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE):
  6259. goto _23
  6260. case int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE):
  6261. goto _24
  6262. case int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE):
  6263. goto _25
  6264. case int32(_XML_ROLE_ENTITY_VALUE):
  6265. goto _26
  6266. case int32(_XML_ROLE_DOCTYPE_SYSTEM_ID):
  6267. goto _27
  6268. case int32(_XML_ROLE_ENTITY_SYSTEM_ID):
  6269. goto _28
  6270. case int32(_XML_ROLE_ENTITY_COMPLETE):
  6271. goto _29
  6272. case int32(_XML_ROLE_ENTITY_NOTATION_NAME):
  6273. goto _30
  6274. case int32(_XML_ROLE_GENERAL_ENTITY_NAME):
  6275. goto _31
  6276. case int32(_XML_ROLE_PARAM_ENTITY_NAME):
  6277. goto _32
  6278. case int32(_XML_ROLE_NOTATION_NAME):
  6279. goto _33
  6280. case int32(_XML_ROLE_NOTATION_PUBLIC_ID):
  6281. goto _34
  6282. case int32(_XML_ROLE_NOTATION_SYSTEM_ID):
  6283. goto _35
  6284. case int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID):
  6285. goto _36
  6286. case int32(_XML_ROLE_ERROR):
  6287. goto _37
  6288. case int32(_XML_ROLE_IGNORE_SECT):
  6289. goto _38
  6290. case int32(_XML_ROLE_GROUP_OPEN):
  6291. goto _39
  6292. case int32(_XML_ROLE_GROUP_SEQUENCE):
  6293. goto _40
  6294. case int32(_XML_ROLE_GROUP_CHOICE):
  6295. goto _41
  6296. case int32(_XML_ROLE_INNER_PARAM_ENTITY_REF):
  6297. goto _42
  6298. case int32(_XML_ROLE_PARAM_ENTITY_REF):
  6299. goto _43
  6300. case int32(_XML_ROLE_ELEMENT_NAME):
  6301. goto _44
  6302. case int32(_XML_ROLE_CONTENT_EMPTY):
  6303. goto _45
  6304. case int32(_XML_ROLE_CONTENT_ANY):
  6305. goto _46
  6306. case int32(_XML_ROLE_CONTENT_PCDATA):
  6307. goto _47
  6308. case int32(_XML_ROLE_CONTENT_ELEMENT):
  6309. goto _48
  6310. case int32(_XML_ROLE_CONTENT_ELEMENT_OPT):
  6311. goto _49
  6312. case int32(_XML_ROLE_CONTENT_ELEMENT_REP):
  6313. goto _50
  6314. case int32(_XML_ROLE_CONTENT_ELEMENT_PLUS):
  6315. goto _51
  6316. case int32(_XML_ROLE_GROUP_CLOSE):
  6317. goto _52
  6318. case int32(_XML_ROLE_GROUP_CLOSE_OPT):
  6319. goto _53
  6320. case int32(_XML_ROLE_GROUP_CLOSE_REP):
  6321. goto _54
  6322. case int32(_XML_ROLE_GROUP_CLOSE_PLUS):
  6323. goto _55
  6324. case int32(_XML_ROLE_PI):
  6325. goto _56
  6326. case int32(_XML_ROLE_COMMENT):
  6327. goto _57
  6328. case int32(_XML_ROLE_NONE):
  6329. goto _58
  6330. case int32(_XML_ROLE_DOCTYPE_NONE):
  6331. goto _59
  6332. case int32(_XML_ROLE_ENTITY_NONE):
  6333. goto _60
  6334. case int32(_XML_ROLE_NOTATION_NONE):
  6335. goto _61
  6336. case int32(_XML_ROLE_ATTLIST_NONE):
  6337. goto _62
  6338. case int32(_XML_ROLE_ELEMENT_NONE):
  6339. goto _63
  6340. }
  6341. goto _64
  6342. _2:
  6343. ;
  6344. result = _processXmlDecl(tls, parser, 0, s, *(*uintptr)(unsafe.Pointer(bp)))
  6345. if result != int32(_XML_ERROR_NONE) {
  6346. return result
  6347. }
  6348. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6349. handleDefault = libc.Uint8FromInt32(0)
  6350. goto _64
  6351. _3:
  6352. ;
  6353. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6354. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = _poolStoreString(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6355. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0) {
  6356. return int32(_XML_ERROR_NO_MEMORY)
  6357. }
  6358. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6359. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  6360. handleDefault = libc.Uint8FromInt32(0)
  6361. }
  6362. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0) /* always initialize to NULL */
  6363. goto _64
  6364. _4:
  6365. ;
  6366. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6367. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid, int32(1))
  6368. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  6369. _poolClear(tls, parser+784)
  6370. handleDefault = libc.Uint8FromInt32(0)
  6371. }
  6372. goto _64
  6373. _5:
  6374. ;
  6375. result1 = _processXmlDecl(tls, parser, int32(1), s, *(*uintptr)(unsafe.Pointer(bp)))
  6376. if result1 != int32(_XML_ERROR_NONE) {
  6377. return result1
  6378. }
  6379. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6380. handleDefault = libc.Uint8FromInt32(0)
  6381. goto _64
  6382. _6:
  6383. ;
  6384. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  6385. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6386. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  6387. return int32(_XML_ERROR_NO_MEMORY)
  6388. }
  6389. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6390. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6391. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FisPublicId})))(tls, enc, s, *(*uintptr)(unsafe.Pointer(bp)), eventPP) != 0) {
  6392. return int32(_XML_ERROR_PUBLICID)
  6393. }
  6394. pubId = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6395. if !(pubId != 0) {
  6396. return int32(_XML_ERROR_NO_MEMORY)
  6397. }
  6398. _normalizePublicId(tls, pubId)
  6399. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6400. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = pubId
  6401. handleDefault = libc.Uint8FromInt32(0)
  6402. goto alreadyChecked
  6403. }
  6404. /* fall through */
  6405. _7:
  6406. ;
  6407. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FisPublicId})))(tls, enc, s, *(*uintptr)(unsafe.Pointer(bp)), eventPP) != 0) {
  6408. return int32(_XML_ERROR_PUBLICID)
  6409. }
  6410. goto alreadyChecked
  6411. alreadyChecked:
  6412. ;
  6413. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  6414. tem = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6415. if !(tem != 0) {
  6416. return int32(_XML_ERROR_NO_MEMORY)
  6417. }
  6418. _normalizePublicId(tls, tem)
  6419. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = tem
  6420. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  6421. /* Don't suppress the default handler if we fell through from
  6422. * the XML_ROLE_DOCTYPE_PUBLIC_ID case.
  6423. */
  6424. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_PUBLIC_ID) {
  6425. handleDefault = libc.Uint8FromInt32(0)
  6426. }
  6427. }
  6428. goto _64
  6429. _8:
  6430. ;
  6431. if libc.Int32FromUint8(allowClosingDoctype) != libc.Int32FromUint8(libc.Uint8FromInt32(1)) {
  6432. /* Must not close doctype from within expanded parameter entities */
  6433. return int32(_XML_ERROR_INVALID_TOKEN)
  6434. }
  6435. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0 {
  6436. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid, 0)
  6437. _poolClear(tls, parser+784)
  6438. handleDefault = libc.Uint8FromInt32(0)
  6439. }
  6440. /* parser->m_doctypeSysid will be non-NULL in the case of a previous
  6441. XML_ROLE_DOCTYPE_SYSTEM_ID, even if parser->m_startDoctypeDeclHandler
  6442. was not set, indicating an external subset
  6443. */
  6444. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0 || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6445. hadParamEntityRefs = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  6446. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6447. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  6448. entity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6449. if !(entity != 0) {
  6450. /* The external subset name "#" will have already been
  6451. * inserted into the hash table at the start of the
  6452. * external entity parsing, so no allocation will happen
  6453. * and lookup() cannot fail.
  6454. */
  6455. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  6456. }
  6457. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6458. (*TENTITY)(unsafe.Pointer(entity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  6459. }
  6460. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  6461. if !((*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg, uintptr(0), (*TENTITY)(unsafe.Pointer(entity)).Fbase, (*TENTITY)(unsafe.Pointer(entity)).FsystemId, (*TENTITY)(unsafe.Pointer(entity)).FpublicId) != 0) {
  6462. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  6463. }
  6464. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  6465. if !((*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler != 0 && !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg) != 0) {
  6466. return int32(_XML_ERROR_NOT_STANDALONE)
  6467. }
  6468. } else {
  6469. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0) {
  6470. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs
  6471. }
  6472. }
  6473. /* end of DTD - no need to update dtd->keepProcessing */
  6474. }
  6475. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  6476. }
  6477. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler != 0 {
  6478. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  6479. handleDefault = libc.Uint8FromInt32(0)
  6480. }
  6481. goto _64
  6482. _9:
  6483. ;
  6484. /* if there is no DOCTYPE declaration then now is the
  6485. last chance to read the foreign DTD
  6486. */
  6487. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6488. hadParamEntityRefs1 = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  6489. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6490. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  6491. entity1 = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6492. if !(entity1 != 0) {
  6493. return int32(_XML_ERROR_NO_MEMORY)
  6494. }
  6495. (*TENTITY)(unsafe.Pointer(entity1)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  6496. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  6497. if !((*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg, uintptr(0), (*TENTITY)(unsafe.Pointer(entity1)).Fbase, (*TENTITY)(unsafe.Pointer(entity1)).FsystemId, (*TENTITY)(unsafe.Pointer(entity1)).FpublicId) != 0) {
  6498. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  6499. }
  6500. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  6501. if !((*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler != 0 && !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg) != 0) {
  6502. return int32(_XML_ERROR_NOT_STANDALONE)
  6503. }
  6504. } else {
  6505. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs1
  6506. }
  6507. /* end of DTD - no need to update dtd->keepProcessing */
  6508. }
  6509. }
  6510. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  6511. return _contentProcessor(tls, parser, s, end, nextPtr)
  6512. _10:
  6513. ;
  6514. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6515. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  6516. return int32(_XML_ERROR_NO_MEMORY)
  6517. }
  6518. goto checkAttListDeclHandler
  6519. _11:
  6520. ;
  6521. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = _getAttributeId(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6522. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId != 0) {
  6523. return int32(_XML_ERROR_NO_MEMORY)
  6524. }
  6525. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  6526. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  6527. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  6528. goto checkAttListDeclHandler
  6529. _12:
  6530. ;
  6531. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(1)
  6532. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeCDATA))
  6533. goto checkAttListDeclHandler
  6534. _13:
  6535. ;
  6536. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(1)
  6537. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeID))
  6538. goto checkAttListDeclHandler
  6539. _14:
  6540. ;
  6541. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREF))
  6542. goto checkAttListDeclHandler
  6543. _15:
  6544. ;
  6545. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREFS))
  6546. goto checkAttListDeclHandler
  6547. _16:
  6548. ;
  6549. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITY))
  6550. goto checkAttListDeclHandler
  6551. _17:
  6552. ;
  6553. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITIES))
  6554. goto checkAttListDeclHandler
  6555. _18:
  6556. ;
  6557. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKEN))
  6558. goto checkAttListDeclHandler
  6559. _19:
  6560. ;
  6561. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKENS))
  6562. goto checkAttListDeclHandler
  6563. checkAttListDeclHandler:
  6564. ;
  6565. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  6566. handleDefault = libc.Uint8FromInt32(0)
  6567. }
  6568. goto _64
  6569. _21:
  6570. ;
  6571. _20:
  6572. ;
  6573. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  6574. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  6575. prefix = uintptr(unsafe.Pointer(&_enumValueSep))
  6576. } else {
  6577. if role == int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE) {
  6578. v65 = uintptr(unsafe.Pointer(&_notationPrefix))
  6579. } else {
  6580. v65 = uintptr(unsafe.Pointer(&_enumValueStart))
  6581. }
  6582. prefix = v65
  6583. }
  6584. if !(_poolAppendString(tls, parser+784, prefix) != 0) {
  6585. return int32(_XML_ERROR_NO_MEMORY)
  6586. }
  6587. if !(_poolAppend(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  6588. return int32(_XML_ERROR_NO_MEMORY)
  6589. }
  6590. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  6591. handleDefault = libc.Uint8FromInt32(0)
  6592. }
  6593. goto _64
  6594. _23:
  6595. ;
  6596. _22:
  6597. ;
  6598. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  6599. if !(_defineAttribute(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId, uintptr(0), parser) != 0) {
  6600. return int32(_XML_ERROR_NO_MEMORY)
  6601. }
  6602. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  6603. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_LPAREN) || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_N) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType + 1))) == int32(m_ASCII_O) {
  6604. /* Enumerated or Notation type */
  6605. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  6606. v66 = 0
  6607. } else {
  6608. v68 = parser + 784 + 24
  6609. v67 = *(*uintptr)(unsafe.Pointer(v68))
  6610. *(*uintptr)(unsafe.Pointer(v68))++
  6611. *(*TXML_Char)(unsafe.Pointer(v67)) = uint8(m_ASCII_RPAREN)
  6612. v66 = libc.Int32FromInt32(1)
  6613. }
  6614. if v72 = !(v66 != 0); !v72 {
  6615. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  6616. v69 = 0
  6617. } else {
  6618. v71 = parser + 784 + 24
  6619. v70 = *(*uintptr)(unsafe.Pointer(v71))
  6620. *(*uintptr)(unsafe.Pointer(v71))++
  6621. *(*TXML_Char)(unsafe.Pointer(v70)) = uint8('\000')
  6622. v69 = libc.Int32FromInt32(1)
  6623. }
  6624. }
  6625. if v72 || !(v69 != 0) {
  6626. return int32(_XML_ERROR_NO_MEMORY)
  6627. }
  6628. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  6629. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6630. }
  6631. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  6632. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TELEMENT_TYPE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType)).Fname, (*TATTRIBUTE_ID)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId)).Fname, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType, uintptr(0), libc.BoolInt32(role == int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE)))
  6633. _poolClear(tls, parser+784)
  6634. handleDefault = libc.Uint8FromInt32(0)
  6635. }
  6636. }
  6637. goto _64
  6638. _25:
  6639. ;
  6640. _24:
  6641. ;
  6642. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  6643. result2 = _storeAttributeValue(tls, parser, enc, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), dtd+160)
  6644. if result2 != 0 {
  6645. return result2
  6646. }
  6647. attVal = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  6648. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  6649. /* ID attributes aren't allowed to have a default */
  6650. if !(_defineAttribute(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata, libc.Uint8FromInt32(0), attVal, parser) != 0) {
  6651. return int32(_XML_ERROR_NO_MEMORY)
  6652. }
  6653. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  6654. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_LPAREN) || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_N) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType + 1))) == int32(m_ASCII_O) {
  6655. /* Enumerated or Notation type */
  6656. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  6657. v73 = 0
  6658. } else {
  6659. v75 = parser + 784 + 24
  6660. v74 = *(*uintptr)(unsafe.Pointer(v75))
  6661. *(*uintptr)(unsafe.Pointer(v75))++
  6662. *(*TXML_Char)(unsafe.Pointer(v74)) = uint8(m_ASCII_RPAREN)
  6663. v73 = libc.Int32FromInt32(1)
  6664. }
  6665. if v79 = !(v73 != 0); !v79 {
  6666. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  6667. v76 = 0
  6668. } else {
  6669. v78 = parser + 784 + 24
  6670. v77 = *(*uintptr)(unsafe.Pointer(v78))
  6671. *(*uintptr)(unsafe.Pointer(v78))++
  6672. *(*TXML_Char)(unsafe.Pointer(v77)) = uint8('\000')
  6673. v76 = libc.Int32FromInt32(1)
  6674. }
  6675. }
  6676. if v79 || !(v76 != 0) {
  6677. return int32(_XML_ERROR_NO_MEMORY)
  6678. }
  6679. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  6680. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6681. }
  6682. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  6683. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TELEMENT_TYPE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType)).Fname, (*TATTRIBUTE_ID)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId)).Fname, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType, attVal, libc.BoolInt32(role == int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE)))
  6684. _poolClear(tls, parser+784)
  6685. handleDefault = libc.Uint8FromInt32(0)
  6686. }
  6687. }
  6688. goto _64
  6689. _26:
  6690. ;
  6691. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  6692. result3 = _storeEntityValue(tls, parser, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6693. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  6694. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextPtr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart
  6695. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextLen = int32(int64((*TSTRING_POOL)(unsafe.Pointer(dtd+208)).Fptr) - int64((*TSTRING_POOL)(unsafe.Pointer(dtd+208)).Fstart))
  6696. (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fptr
  6697. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  6698. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  6699. (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname, libc.Int32FromUint8((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param), (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextPtr, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextLen, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase, uintptr(0), uintptr(0), uintptr(0))
  6700. handleDefault = libc.Uint8FromInt32(0)
  6701. }
  6702. } else {
  6703. (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart
  6704. }
  6705. if result3 != int32(_XML_ERROR_NONE) {
  6706. return result3
  6707. }
  6708. }
  6709. goto _64
  6710. _27:
  6711. ;
  6712. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  6713. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6714. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6715. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6716. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid == libc.UintptrFromInt32(0) {
  6717. return int32(_XML_ERROR_NO_MEMORY)
  6718. }
  6719. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6720. handleDefault = libc.Uint8FromInt32(0)
  6721. } else {
  6722. /* use externalSubsetName to make parser->m_doctypeSysid non-NULL
  6723. for the case where no parser->m_startDoctypeDeclHandler is set */
  6724. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = uintptr(unsafe.Pointer(&_externalSubsetName))
  6725. }
  6726. if !((*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0) && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler != 0 && !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg) != 0) {
  6727. return int32(_XML_ERROR_NOT_STANDALONE)
  6728. }
  6729. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  6730. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6731. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  6732. return int32(_XML_ERROR_NO_MEMORY)
  6733. }
  6734. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  6735. }
  6736. /* fall through */
  6737. _28:
  6738. ;
  6739. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  6740. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6741. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId != 0) {
  6742. return int32(_XML_ERROR_NO_MEMORY)
  6743. }
  6744. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  6745. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  6746. /* Don't suppress the default handler if we fell through from
  6747. * the XML_ROLE_DOCTYPE_SYSTEM_ID case.
  6748. */
  6749. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_SYSTEM_ID) {
  6750. handleDefault = libc.Uint8FromInt32(0)
  6751. }
  6752. }
  6753. goto _64
  6754. _29:
  6755. ;
  6756. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  6757. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  6758. (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname, libc.Int32FromUint8((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param), uintptr(0), 0, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fbase, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId, uintptr(0))
  6759. handleDefault = libc.Uint8FromInt32(0)
  6760. }
  6761. goto _64
  6762. _30:
  6763. ;
  6764. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  6765. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6766. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation != 0) {
  6767. return int32(_XML_ERROR_NO_MEMORY)
  6768. }
  6769. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  6770. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler != 0 {
  6771. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  6772. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fbase, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation)
  6773. handleDefault = libc.Uint8FromInt32(0)
  6774. } else {
  6775. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  6776. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  6777. (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname, 0, uintptr(0), 0, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fbase, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation)
  6778. handleDefault = libc.Uint8FromInt32(0)
  6779. }
  6780. }
  6781. }
  6782. goto _64
  6783. _31:
  6784. ;
  6785. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FpredefinedEntityName})))(tls, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  6786. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  6787. goto _64
  6788. }
  6789. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  6790. name = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6791. if !(name != 0) {
  6792. return int32(_XML_ERROR_NO_MEMORY)
  6793. }
  6794. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd, name, uint64(64))
  6795. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  6796. return int32(_XML_ERROR_NO_MEMORY)
  6797. }
  6798. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name {
  6799. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  6800. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  6801. } else {
  6802. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  6803. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  6804. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(0)
  6805. /* if we have a parent parser or are reading an internal parameter
  6806. entity, then the entity declaration is not considered "internal"
  6807. */
  6808. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_internal = libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  6809. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  6810. handleDefault = libc.Uint8FromInt32(0)
  6811. }
  6812. }
  6813. } else {
  6814. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  6815. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  6816. }
  6817. goto _64
  6818. _32:
  6819. ;
  6820. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  6821. name1 = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6822. if !(name1 != 0) {
  6823. return int32(_XML_ERROR_NO_MEMORY)
  6824. }
  6825. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, name1, uint64(64))
  6826. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  6827. return int32(_XML_ERROR_NO_MEMORY)
  6828. }
  6829. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name1 {
  6830. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  6831. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  6832. } else {
  6833. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  6834. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  6835. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(1)
  6836. /* if we have a parent parser or are reading an internal parameter
  6837. entity, then the entity declaration is not considered "internal"
  6838. */
  6839. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_internal = libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  6840. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  6841. handleDefault = libc.Uint8FromInt32(0)
  6842. }
  6843. }
  6844. } else {
  6845. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  6846. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  6847. }
  6848. goto _64
  6849. _33:
  6850. ;
  6851. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  6852. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  6853. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  6854. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = _poolStoreString(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6855. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0) {
  6856. return int32(_XML_ERROR_NO_MEMORY)
  6857. }
  6858. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6859. handleDefault = libc.Uint8FromInt32(0)
  6860. }
  6861. goto _64
  6862. _34:
  6863. ;
  6864. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FisPublicId})))(tls, enc, s, *(*uintptr)(unsafe.Pointer(bp)), eventPP) != 0) {
  6865. return int32(_XML_ERROR_PUBLICID)
  6866. }
  6867. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 { /* means m_notationDeclHandler != NULL */
  6868. tem1 = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6869. if !(tem1 != 0) {
  6870. return int32(_XML_ERROR_NO_MEMORY)
  6871. }
  6872. _normalizePublicId(tls, tem1)
  6873. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = tem1
  6874. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6875. handleDefault = libc.Uint8FromInt32(0)
  6876. }
  6877. goto _64
  6878. _35:
  6879. ;
  6880. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  6881. systemId = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6882. if !(systemId != 0) {
  6883. return int32(_XML_ERROR_NO_MEMORY)
  6884. }
  6885. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  6886. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase, systemId, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId)
  6887. handleDefault = libc.Uint8FromInt32(0)
  6888. }
  6889. _poolClear(tls, parser+784)
  6890. goto _64
  6891. _36:
  6892. ;
  6893. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  6894. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  6895. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase, uintptr(0), (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId)
  6896. handleDefault = libc.Uint8FromInt32(0)
  6897. }
  6898. _poolClear(tls, parser+784)
  6899. goto _64
  6900. _37:
  6901. ;
  6902. switch tok {
  6903. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  6904. /* PE references in internal subset are
  6905. not allowed within declarations. */
  6906. return int32(_XML_ERROR_PARAM_ENTITY_REF)
  6907. case int32(m_XML_TOK_XML_DECL):
  6908. return int32(_XML_ERROR_MISPLACED_XML_PI)
  6909. default:
  6910. return int32(_XML_ERROR_SYNTAX)
  6911. }
  6912. _38:
  6913. ;
  6914. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6915. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6916. }
  6917. handleDefault = libc.Uint8FromInt32(0)
  6918. result4 = _doIgnoreSection(tls, parser, enc, bp, end, nextPtr, haveMore)
  6919. if result4 != int32(_XML_ERROR_NONE) {
  6920. return result4
  6921. } else {
  6922. if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) {
  6923. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_ignoreSectionProcessor)
  6924. return result4
  6925. }
  6926. }
  6927. goto _64
  6928. _39:
  6929. ;
  6930. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize {
  6931. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize != 0 {
  6932. p80 = parser + 888
  6933. *(*uint32)(unsafe.Pointer(p80)) *= uint32(2)
  6934. new_connector = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector, uint64(*(*uint32)(unsafe.Pointer(p80))))
  6935. if new_connector == libc.UintptrFromInt32(0) {
  6936. *(*uint32)(unsafe.Pointer(parser + 888)) /= uint32(2)
  6937. return int32(_XML_ERROR_NO_MEMORY)
  6938. }
  6939. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = new_connector
  6940. if (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0 {
  6941. new_scaff_index = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex, uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize)*libc.Uint64FromInt64(4))
  6942. if new_scaff_index == libc.UintptrFromInt32(0) {
  6943. return int32(_XML_ERROR_NO_MEMORY)
  6944. }
  6945. (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex = new_scaff_index
  6946. }
  6947. } else {
  6948. v81 = libc.Uint32FromInt32(32)
  6949. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = v81
  6950. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, uint64(v81))
  6951. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector != 0) {
  6952. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  6953. return int32(_XML_ERROR_NO_MEMORY)
  6954. }
  6955. }
  6956. }
  6957. *(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = uint8(0)
  6958. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  6959. myindex = _nextScaffoldPart(tls, parser)
  6960. if myindex < 0 {
  6961. return int32(_XML_ERROR_NO_MEMORY)
  6962. }
  6963. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel)*4)) = myindex
  6964. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel++
  6965. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex)*32))).Ftype1 = int32(_XML_CTYPE_SEQ)
  6966. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  6967. handleDefault = libc.Uint8FromInt32(0)
  6968. }
  6969. }
  6970. goto _64
  6971. _40:
  6972. ;
  6973. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel)))) == int32(m_ASCII_PIPE) {
  6974. return int32(_XML_ERROR_SYNTAX)
  6975. }
  6976. *(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = uint8(m_ASCII_COMMA)
  6977. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  6978. handleDefault = libc.Uint8FromInt32(0)
  6979. }
  6980. goto _64
  6981. _41:
  6982. ;
  6983. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel)))) == int32(m_ASCII_COMMA) {
  6984. return int32(_XML_ERROR_SYNTAX)
  6985. }
  6986. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && !(*(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) != 0) && (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*32))).Ftype1 != int32(_XML_CTYPE_MIXED) {
  6987. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*32))).Ftype1 = int32(_XML_CTYPE_CHOICE)
  6988. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  6989. handleDefault = libc.Uint8FromInt32(0)
  6990. }
  6991. }
  6992. *(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = uint8(m_ASCII_PIPE)
  6993. goto _64
  6994. _43:
  6995. ;
  6996. _42:
  6997. ;
  6998. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6999. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0) {
  7000. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7001. } else {
  7002. name2 = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7003. if !(name2 != 0) {
  7004. return int32(_XML_ERROR_NO_MEMORY)
  7005. }
  7006. entity2 = _lookup(tls, parser, dtd+264, name2, uint64(0))
  7007. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7008. /* first, determine if a check for an existing declaration is needed;
  7009. if yes, check that the entity exists, and that it is internal,
  7010. otherwise call the skipped entity handler
  7011. */
  7012. if v83 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v83 {
  7013. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  7014. v82 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  7015. } else {
  7016. v82 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  7017. }
  7018. }
  7019. if v83 && v82 != 0 {
  7020. if !(entity2 != 0) {
  7021. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  7022. } else {
  7023. if !((*TENTITY)(unsafe.Pointer(entity2)).Fis_internal != 0) {
  7024. /* It's hard to exhaustively search the code to be sure,
  7025. * but there doesn't seem to be a way of executing the
  7026. * following line. There are two cases:
  7027. *
  7028. * If 'standalone' is false, the DTD must have no
  7029. * parameter entities or we wouldn't have passed the outer
  7030. * 'if' statement. That measn the only entity in the hash
  7031. * table is the external subset name "#" which cannot be
  7032. * given as a parameter entity name in XML syntax, so the
  7033. * lookup must have returned NULL and we don't even reach
  7034. * the test for an internal entity.
  7035. *
  7036. * If 'standalone' is true, it does not seem to be
  7037. * possible to create entities taking this code path that
  7038. * are not internal entities, so fail the test above.
  7039. *
  7040. * Because this analysis is very uncertain, the code is
  7041. * being left in place and merely removed from the
  7042. * coverage test statistics.
  7043. */
  7044. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE) /* LCOV_EXCL_LINE */
  7045. }
  7046. }
  7047. } else {
  7048. if !(entity2 != 0) {
  7049. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7050. /* cannot report skipped entities in declarations */
  7051. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  7052. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, name2, int32(1))
  7053. handleDefault = libc.Uint8FromInt32(0)
  7054. }
  7055. goto _64
  7056. }
  7057. }
  7058. if (*TENTITY)(unsafe.Pointer(entity2)).Fopen != 0 {
  7059. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  7060. }
  7061. if (*TENTITY)(unsafe.Pointer(entity2)).FtextPtr != 0 {
  7062. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) {
  7063. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  7064. } else {
  7065. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  7066. }
  7067. betweenDecl = libc.Uint8FromInt32(v84)
  7068. result5 = _processInternalEntity(tls, parser, entity2, betweenDecl)
  7069. if result5 != int32(_XML_ERROR_NONE) {
  7070. return result5
  7071. }
  7072. handleDefault = libc.Uint8FromInt32(0)
  7073. goto _64
  7074. }
  7075. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  7076. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  7077. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(1)
  7078. if !((*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg, uintptr(0), (*TENTITY)(unsafe.Pointer(entity2)).Fbase, (*TENTITY)(unsafe.Pointer(entity2)).FsystemId, (*TENTITY)(unsafe.Pointer(entity2)).FpublicId) != 0) {
  7079. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7080. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  7081. }
  7082. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7083. handleDefault = libc.Uint8FromInt32(0)
  7084. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  7085. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7086. goto _64
  7087. }
  7088. } else {
  7089. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7090. goto _64
  7091. }
  7092. }
  7093. if !((*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler != 0 && !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg) != 0) {
  7094. return int32(_XML_ERROR_NOT_STANDALONE)
  7095. }
  7096. goto _64
  7097. /* Element declaration stuff */
  7098. _44:
  7099. ;
  7100. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7101. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7102. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  7103. return int32(_XML_ERROR_NO_MEMORY)
  7104. }
  7105. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel = 0
  7106. (*TDTD)(unsafe.Pointer(dtd)).FscaffCount = uint32(0)
  7107. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(1)
  7108. handleDefault = libc.Uint8FromInt32(0)
  7109. }
  7110. goto _64
  7111. _46:
  7112. ;
  7113. _45:
  7114. ;
  7115. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7116. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7117. content = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(32))
  7118. if !(content != 0) {
  7119. return int32(_XML_ERROR_NO_MEMORY)
  7120. }
  7121. (*TXML_Content)(unsafe.Pointer(content)).Fquant = int32(_XML_CQUANT_NONE)
  7122. (*TXML_Content)(unsafe.Pointer(content)).Fname = libc.UintptrFromInt32(0)
  7123. (*TXML_Content)(unsafe.Pointer(content)).Fnumchildren = uint32(0)
  7124. (*TXML_Content)(unsafe.Pointer(content)).Fchildren = libc.UintptrFromInt32(0)
  7125. if role == int32(_XML_ROLE_CONTENT_ANY) {
  7126. v85 = int32(_XML_CTYPE_ANY)
  7127. } else {
  7128. v85 = int32(_XML_CTYPE_EMPTY)
  7129. }
  7130. (*TXML_Content)(unsafe.Pointer(content)).Ftype1 = v85
  7131. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7132. (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TELEMENT_TYPE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType)).Fname, content)
  7133. handleDefault = libc.Uint8FromInt32(0)
  7134. }
  7135. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7136. }
  7137. goto _64
  7138. _47:
  7139. ;
  7140. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7141. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*32))).Ftype1 = int32(_XML_CTYPE_MIXED)
  7142. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7143. handleDefault = libc.Uint8FromInt32(0)
  7144. }
  7145. }
  7146. goto _64
  7147. _48:
  7148. ;
  7149. quant = int32(_XML_CQUANT_NONE)
  7150. goto elementContent
  7151. _49:
  7152. ;
  7153. quant = int32(_XML_CQUANT_OPT)
  7154. goto elementContent
  7155. _50:
  7156. ;
  7157. quant = int32(_XML_CQUANT_REP)
  7158. goto elementContent
  7159. _51:
  7160. ;
  7161. quant = int32(_XML_CQUANT_PLUS)
  7162. goto elementContent
  7163. elementContent:
  7164. ;
  7165. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7166. if quant == int32(_XML_CQUANT_NONE) {
  7167. v86 = *(*uintptr)(unsafe.Pointer(bp))
  7168. } else {
  7169. v86 = *(*uintptr)(unsafe.Pointer(bp)) - uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  7170. }
  7171. nxt = v86
  7172. myindex1 = _nextScaffoldPart(tls, parser)
  7173. if myindex1 < 0 {
  7174. return int32(_XML_ERROR_NO_MEMORY)
  7175. }
  7176. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Ftype1 = int32(_XML_CTYPE_NAME)
  7177. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Fquant = quant
  7178. el = _getElementType(tls, parser, enc, s, nxt)
  7179. if !(el != 0) {
  7180. return int32(_XML_ERROR_NO_MEMORY)
  7181. }
  7182. name3 = (*TELEMENT_TYPE)(unsafe.Pointer(el)).Fname
  7183. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Fname = name3
  7184. nameLen = 0
  7185. for {
  7186. v88 = nameLen
  7187. nameLen++
  7188. if !(*(*TXML_Char)(unsafe.Pointer(name3 + uintptr(v88))) != 0) {
  7189. break
  7190. }
  7191. goto _87
  7192. _87:
  7193. }
  7194. *(*uint32)(unsafe.Pointer(dtd + 336)) += libc.Uint32FromInt32(nameLen)
  7195. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7196. handleDefault = libc.Uint8FromInt32(0)
  7197. }
  7198. }
  7199. goto _64
  7200. _52:
  7201. ;
  7202. quant = int32(_XML_CQUANT_NONE)
  7203. goto closeGroup
  7204. _53:
  7205. ;
  7206. quant = int32(_XML_CQUANT_OPT)
  7207. goto closeGroup
  7208. _54:
  7209. ;
  7210. quant = int32(_XML_CQUANT_REP)
  7211. goto closeGroup
  7212. _55:
  7213. ;
  7214. quant = int32(_XML_CQUANT_PLUS)
  7215. goto closeGroup
  7216. closeGroup:
  7217. ;
  7218. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7219. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7220. handleDefault = libc.Uint8FromInt32(0)
  7221. }
  7222. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel--
  7223. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel)*4)))*32))).Fquant = quant
  7224. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel == 0 {
  7225. if !(handleDefault != 0) {
  7226. model = _build_model(tls, parser)
  7227. if !(model != 0) {
  7228. return int32(_XML_ERROR_NO_MEMORY)
  7229. }
  7230. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7231. (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TELEMENT_TYPE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType)).Fname, model)
  7232. }
  7233. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7234. (*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen = uint32(0)
  7235. }
  7236. }
  7237. goto _64
  7238. /* End element declaration stuff */
  7239. _56:
  7240. ;
  7241. if !(_reportProcessingInstruction(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7242. return int32(_XML_ERROR_NO_MEMORY)
  7243. }
  7244. handleDefault = libc.Uint8FromInt32(0)
  7245. goto _64
  7246. _57:
  7247. ;
  7248. if !(_reportComment(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7249. return int32(_XML_ERROR_NO_MEMORY)
  7250. }
  7251. handleDefault = libc.Uint8FromInt32(0)
  7252. goto _64
  7253. _58:
  7254. ;
  7255. switch tok {
  7256. case int32(m_XML_TOK_BOM):
  7257. handleDefault = libc.Uint8FromInt32(0)
  7258. break
  7259. }
  7260. goto _64
  7261. _59:
  7262. ;
  7263. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7264. handleDefault = libc.Uint8FromInt32(0)
  7265. }
  7266. goto _64
  7267. _60:
  7268. ;
  7269. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7270. handleDefault = libc.Uint8FromInt32(0)
  7271. }
  7272. goto _64
  7273. _61:
  7274. ;
  7275. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7276. handleDefault = libc.Uint8FromInt32(0)
  7277. }
  7278. goto _64
  7279. _62:
  7280. ;
  7281. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7282. handleDefault = libc.Uint8FromInt32(0)
  7283. }
  7284. goto _64
  7285. _63:
  7286. ;
  7287. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7288. handleDefault = libc.Uint8FromInt32(0)
  7289. }
  7290. goto _64
  7291. _64:
  7292. ; /* end of big switch */
  7293. if handleDefault != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7294. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7295. }
  7296. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  7297. case int32(_XML_SUSPENDED):
  7298. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7299. return int32(_XML_ERROR_NONE)
  7300. case int32(_XML_FINISHED):
  7301. return int32(_XML_ERROR_ABORTED)
  7302. default:
  7303. s = *(*uintptr)(unsafe.Pointer(bp))
  7304. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, s, end, bp)
  7305. }
  7306. goto _1
  7307. _1:
  7308. }
  7309. /* not reached */
  7310. return r
  7311. }
  7312. var _externalSubsetName = [2]TXML_Char{
  7313. 0: uint8(m_ASCII_HASH),
  7314. }
  7315. var _atypeCDATA = [6]TXML_Char{
  7316. 0: uint8(m_ASCII_C),
  7317. 1: uint8(m_ASCII_D),
  7318. 2: uint8(m_ASCII_A),
  7319. 3: uint8(m_ASCII_T),
  7320. 4: uint8(m_ASCII_A),
  7321. }
  7322. var _atypeID = [3]TXML_Char{
  7323. 0: uint8(m_ASCII_I),
  7324. 1: uint8(m_ASCII_D),
  7325. }
  7326. var _atypeIDREF = [6]TXML_Char{
  7327. 0: uint8(m_ASCII_I),
  7328. 1: uint8(m_ASCII_D),
  7329. 2: uint8(m_ASCII_R),
  7330. 3: uint8(m_ASCII_E),
  7331. 4: uint8(m_ASCII_F),
  7332. }
  7333. var _atypeIDREFS = [7]TXML_Char{
  7334. 0: uint8(m_ASCII_I),
  7335. 1: uint8(m_ASCII_D),
  7336. 2: uint8(m_ASCII_R),
  7337. 3: uint8(m_ASCII_E),
  7338. 4: uint8(m_ASCII_F),
  7339. 5: uint8(m_ASCII_S),
  7340. }
  7341. var _atypeENTITY = [7]TXML_Char{
  7342. 0: uint8(m_ASCII_E),
  7343. 1: uint8(m_ASCII_N),
  7344. 2: uint8(m_ASCII_T),
  7345. 3: uint8(m_ASCII_I),
  7346. 4: uint8(m_ASCII_T),
  7347. 5: uint8(m_ASCII_Y),
  7348. }
  7349. var _atypeENTITIES = [9]TXML_Char{
  7350. 0: uint8(m_ASCII_E),
  7351. 1: uint8(m_ASCII_N),
  7352. 2: uint8(m_ASCII_T),
  7353. 3: uint8(m_ASCII_I),
  7354. 4: uint8(m_ASCII_T),
  7355. 5: uint8(m_ASCII_I),
  7356. 6: uint8(m_ASCII_E),
  7357. 7: uint8(m_ASCII_S),
  7358. }
  7359. var _atypeNMTOKEN = [8]TXML_Char{
  7360. 0: uint8(m_ASCII_N),
  7361. 1: uint8(m_ASCII_M),
  7362. 2: uint8(m_ASCII_T),
  7363. 3: uint8(m_ASCII_O),
  7364. 4: uint8(m_ASCII_K),
  7365. 5: uint8(m_ASCII_E),
  7366. 6: uint8(m_ASCII_N),
  7367. }
  7368. var _atypeNMTOKENS = [9]TXML_Char{
  7369. 0: uint8(m_ASCII_N),
  7370. 1: uint8(m_ASCII_M),
  7371. 2: uint8(m_ASCII_T),
  7372. 3: uint8(m_ASCII_O),
  7373. 4: uint8(m_ASCII_K),
  7374. 5: uint8(m_ASCII_E),
  7375. 6: uint8(m_ASCII_N),
  7376. 7: uint8(m_ASCII_S),
  7377. }
  7378. var _notationPrefix = [10]TXML_Char{
  7379. 0: uint8(m_ASCII_N),
  7380. 1: uint8(m_ASCII_O),
  7381. 2: uint8(m_ASCII_T),
  7382. 3: uint8(m_ASCII_A),
  7383. 4: uint8(m_ASCII_T),
  7384. 5: uint8(m_ASCII_I),
  7385. 6: uint8(m_ASCII_O),
  7386. 7: uint8(m_ASCII_N),
  7387. 8: uint8(m_ASCII_LPAREN),
  7388. }
  7389. var _enumValueSep = [2]TXML_Char{
  7390. 0: uint8(m_ASCII_PIPE),
  7391. }
  7392. var _enumValueStart = [2]TXML_Char{
  7393. 0: uint8(m_ASCII_LPAREN),
  7394. }
  7395. func _epilogProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  7396. bp := tls.Alloc(16)
  7397. defer tls.Free(16)
  7398. var tok int32
  7399. var v2 uintptr
  7400. var _ /* next at bp+0 */ uintptr
  7401. _, _ = tok, v2
  7402. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  7403. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = s
  7404. for {
  7405. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  7406. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, bp)
  7407. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  7408. switch tok {
  7409. /* report partial linebreak - it might be the last token */
  7410. case -int32(m_XML_TOK_PROLOG_S):
  7411. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7412. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  7413. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  7414. return int32(_XML_ERROR_ABORTED)
  7415. }
  7416. }
  7417. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7418. return int32(_XML_ERROR_NONE)
  7419. case -int32(4):
  7420. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7421. return int32(_XML_ERROR_NONE)
  7422. case int32(m_XML_TOK_PROLOG_S):
  7423. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7424. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  7425. }
  7426. case int32(m_XML_TOK_PI):
  7427. if !(_reportProcessingInstruction(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7428. return int32(_XML_ERROR_NO_MEMORY)
  7429. }
  7430. case int32(m_XML_TOK_COMMENT):
  7431. if !(_reportComment(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7432. return int32(_XML_ERROR_NO_MEMORY)
  7433. }
  7434. case m_XML_TOK_INVALID:
  7435. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  7436. return int32(_XML_ERROR_INVALID_TOKEN)
  7437. case -int32(1):
  7438. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  7439. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7440. return int32(_XML_ERROR_NONE)
  7441. }
  7442. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  7443. case -int32(2):
  7444. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  7445. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7446. return int32(_XML_ERROR_NONE)
  7447. }
  7448. return int32(_XML_ERROR_PARTIAL_CHAR)
  7449. default:
  7450. return int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT)
  7451. }
  7452. v2 = *(*uintptr)(unsafe.Pointer(bp))
  7453. s = v2
  7454. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v2
  7455. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  7456. case int32(_XML_SUSPENDED):
  7457. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7458. return int32(_XML_ERROR_NONE)
  7459. case int32(_XML_FINISHED):
  7460. return int32(_XML_ERROR_ABORTED)
  7461. default:
  7462. }
  7463. goto _1
  7464. _1:
  7465. }
  7466. return r
  7467. }
  7468. func _processInternalEntity(tls *libc.TLS, parser TXML_Parser, entity uintptr, betweenDecl TXML_Bool) (r _XML_Error) {
  7469. bp := tls.Alloc(16)
  7470. defer tls.Free(16)
  7471. var openEntity, textEnd, textStart uintptr
  7472. var result _XML_Error
  7473. var tok int32
  7474. var _ /* next at bp+0 */ uintptr
  7475. _, _, _, _, _ = openEntity, result, textEnd, textStart, tok
  7476. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities != 0 {
  7477. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  7478. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  7479. } else {
  7480. openEntity = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(40))
  7481. if !(openEntity != 0) {
  7482. return int32(_XML_ERROR_NO_MEMORY)
  7483. }
  7484. }
  7485. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  7486. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = 0
  7487. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  7488. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = openEntity
  7489. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity = entity
  7490. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FstartTagLevel = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel
  7491. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FbetweenDecl = betweenDecl
  7492. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventPtr = libc.UintptrFromInt32(0)
  7493. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventEndPtr = libc.UintptrFromInt32(0)
  7494. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr
  7495. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  7496. /* Set a safe default value in case 'next' does not get set */
  7497. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  7498. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  7499. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, textStart, textEnd, bp)
  7500. result = _doProlog(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, textStart, textEnd, tok, *(*uintptr)(unsafe.Pointer(bp)), bp, libc.Uint8FromInt32(0), libc.Uint8FromInt32(0))
  7501. } else {
  7502. result = _doContent(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, textStart, textEnd, bp, libc.Uint8FromInt32(0))
  7503. }
  7504. if result == int32(_XML_ERROR_NONE) {
  7505. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  7506. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(textStart))
  7507. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_internalEntityProcessor)
  7508. } else {
  7509. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  7510. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  7511. /* put openEntity back in list of free instances */
  7512. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  7513. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  7514. }
  7515. }
  7516. return result
  7517. }
  7518. func _internalEntityProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  7519. bp := tls.Alloc(16)
  7520. defer tls.Free(16)
  7521. var entity, openEntity, textEnd, textStart uintptr
  7522. var result _XML_Error
  7523. var tok, tok1, v1 int32
  7524. var _ /* next at bp+0 */ uintptr
  7525. _, _, _, _, _, _, _, _ = entity, openEntity, result, textEnd, textStart, tok, tok1, v1
  7526. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  7527. if !(openEntity != 0) {
  7528. return int32(_XML_ERROR_UNEXPECTED_STATE)
  7529. }
  7530. entity = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity
  7531. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).Fprocessed)
  7532. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  7533. /* Set a safe default value in case 'next' does not get set */
  7534. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  7535. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  7536. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, textStart, textEnd, bp)
  7537. result = _doProlog(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, textStart, textEnd, tok, *(*uintptr)(unsafe.Pointer(bp)), bp, libc.Uint8FromInt32(0), libc.Uint8FromInt32(1))
  7538. } else {
  7539. result = _doContent(tls, parser, (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FstartTagLevel, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, textStart, textEnd, bp, libc.Uint8FromInt32(0))
  7540. }
  7541. if result != int32(_XML_ERROR_NONE) {
  7542. return result
  7543. } else {
  7544. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  7545. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64((*TENTITY)(unsafe.Pointer(entity)).FtextPtr))
  7546. return result
  7547. } else {
  7548. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  7549. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  7550. /* put openEntity back in list of free instances */
  7551. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  7552. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  7553. }
  7554. }
  7555. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  7556. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  7557. tok1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, bp)
  7558. return _doProlog(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, tok1, *(*uintptr)(unsafe.Pointer(bp)), nextPtr, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0)), libc.Uint8FromInt32(1))
  7559. } else {
  7560. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  7561. /* see externalEntityContentProcessor vs contentProcessor */
  7562. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  7563. v1 = int32(1)
  7564. } else {
  7565. v1 = 0
  7566. }
  7567. return _doContent(tls, parser, v1, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, nextPtr, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0)))
  7568. }
  7569. return r
  7570. }
  7571. func _errorProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  7572. _ = s
  7573. _ = end
  7574. _ = nextPtr
  7575. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  7576. }
  7577. func _storeAttributeValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, isCdata TXML_Bool, ptr uintptr, end uintptr, pool uintptr) (r _XML_Error) {
  7578. var result _XML_Error
  7579. var v1 int32
  7580. var v2, v3 uintptr
  7581. _, _, _, _ = result, v1, v2, v3
  7582. result = _appendAttributeValue(tls, parser, enc, isCdata, ptr, end, pool)
  7583. if result != 0 {
  7584. return result
  7585. }
  7586. if !(isCdata != 0) && int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) != 0 && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  7587. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr--
  7588. }
  7589. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  7590. v1 = 0
  7591. } else {
  7592. v3 = pool + 24
  7593. v2 = *(*uintptr)(unsafe.Pointer(v3))
  7594. *(*uintptr)(unsafe.Pointer(v3))++
  7595. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8('\000')
  7596. v1 = libc.Int32FromInt32(1)
  7597. }
  7598. if !(v1 != 0) {
  7599. return int32(_XML_ERROR_NO_MEMORY)
  7600. }
  7601. return int32(_XML_ERROR_NONE)
  7602. }
  7603. func _appendAttributeValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, isCdata TXML_Bool, ptr uintptr, end uintptr, pool uintptr) (r _XML_Error) {
  7604. bp := tls.Alloc(16)
  7605. defer tls.Free(16)
  7606. var ch TXML_Char
  7607. var checkEntityDecl uint8
  7608. var dtd, entity, name, textEnd, v10, v11, v4, v5, v7, v8 uintptr
  7609. var i, n, tok, v12, v3, v6, v9 int32
  7610. var result _XML_Error
  7611. var v13 bool
  7612. var _ /* buf at bp+8 */ [4]TXML_Char
  7613. var _ /* next at bp+0 */ uintptr
  7614. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ch, checkEntityDecl, dtd, entity, i, n, name, result, textEnd, tok, v10, v11, v12, v13, v3, v4, v5, v6, v7, v8, v9
  7615. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  7616. for {
  7617. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 32))})))(tls, enc, ptr, end, bp)
  7618. switch tok {
  7619. case -int32(4):
  7620. return int32(_XML_ERROR_NONE)
  7621. case m_XML_TOK_INVALID:
  7622. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7623. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  7624. }
  7625. return int32(_XML_ERROR_INVALID_TOKEN)
  7626. case -int32(1):
  7627. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7628. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  7629. }
  7630. return int32(_XML_ERROR_INVALID_TOKEN)
  7631. case int32(m_XML_TOK_CHAR_REF):
  7632. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, ptr)
  7633. if n < 0 {
  7634. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7635. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  7636. }
  7637. return int32(_XML_ERROR_BAD_CHAR_REF)
  7638. }
  7639. if !(isCdata != 0) && n == int32(0x20) && (int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) == 0 || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20)) {
  7640. break
  7641. }
  7642. n = XXmlUtf8Encode(tls, n, bp+8)
  7643. /* The XmlEncode() functions can never return 0 here. That
  7644. * error return happens if the code point passed in is either
  7645. * negative or greater than or equal to 0x110000. The
  7646. * XmlCharRefNumber() functions will all return a number
  7647. * strictly less than 0x110000 or a negative value if an error
  7648. * occurred. The negative value is intercepted above, so
  7649. * XmlEncode() is never passed a value it might return an
  7650. * error for.
  7651. */
  7652. i = 0
  7653. for {
  7654. if !(i < n) {
  7655. break
  7656. }
  7657. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  7658. v3 = 0
  7659. } else {
  7660. v5 = pool + 24
  7661. v4 = *(*uintptr)(unsafe.Pointer(v5))
  7662. *(*uintptr)(unsafe.Pointer(v5))++
  7663. *(*TXML_Char)(unsafe.Pointer(v4)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 8)))[i]
  7664. v3 = libc.Int32FromInt32(1)
  7665. }
  7666. if !(v3 != 0) {
  7667. return int32(_XML_ERROR_NO_MEMORY)
  7668. }
  7669. goto _2
  7670. _2:
  7671. ;
  7672. i++
  7673. }
  7674. case int32(m_XML_TOK_DATA_CHARS):
  7675. if !(_poolAppend(tls, pool, enc, ptr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7676. return int32(_XML_ERROR_NO_MEMORY)
  7677. }
  7678. case -int32(3):
  7679. *(*uintptr)(unsafe.Pointer(bp)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  7680. /* fall through */
  7681. fallthrough
  7682. case int32(m_XML_TOK_ATTRIBUTE_VALUE_S):
  7683. fallthrough
  7684. case int32(m_XML_TOK_DATA_NEWLINE):
  7685. if !(isCdata != 0) && (int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) == 0 || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20)) {
  7686. break
  7687. }
  7688. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  7689. v6 = 0
  7690. } else {
  7691. v8 = pool + 24
  7692. v7 = *(*uintptr)(unsafe.Pointer(v8))
  7693. *(*uintptr)(unsafe.Pointer(v8))++
  7694. *(*TXML_Char)(unsafe.Pointer(v7)) = uint8(0x20)
  7695. v6 = libc.Int32FromInt32(1)
  7696. }
  7697. if !(v6 != 0) {
  7698. return int32(_XML_ERROR_NO_MEMORY)
  7699. }
  7700. case int32(m_XML_TOK_ENTITY_REF):
  7701. ch = libc.Uint8FromInt32((*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FpredefinedEntityName})))(tls, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)))
  7702. if ch != 0 {
  7703. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  7704. v9 = 0
  7705. } else {
  7706. v11 = pool + 24
  7707. v10 = *(*uintptr)(unsafe.Pointer(v11))
  7708. *(*uintptr)(unsafe.Pointer(v11))++
  7709. *(*TXML_Char)(unsafe.Pointer(v10)) = ch
  7710. v9 = libc.Int32FromInt32(1)
  7711. }
  7712. if !(v9 != 0) {
  7713. return int32(_XML_ERROR_NO_MEMORY)
  7714. }
  7715. break
  7716. }
  7717. name = _poolStoreString(tls, parser+832, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7718. if !(name != 0) {
  7719. return int32(_XML_ERROR_NO_MEMORY)
  7720. }
  7721. entity = _lookup(tls, parser, dtd, name, uint64(0))
  7722. (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fstart
  7723. /* First, determine if a check for an existing declaration is needed;
  7724. if yes, check that the entity exists, and that it is internal.
  7725. */
  7726. if pool == dtd+160 { /* are we called from prolog? */
  7727. if v13 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v13 {
  7728. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  7729. v12 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  7730. } else {
  7731. v12 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  7732. }
  7733. }
  7734. checkEntityDecl = libc.BoolUint8(v13 && v12 != 0)
  7735. } else { /* if (pool == &parser->m_tempPool): we are called from content */
  7736. checkEntityDecl = libc.BoolUint8(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0)
  7737. }
  7738. if checkEntityDecl != 0 {
  7739. if !(entity != 0) {
  7740. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  7741. } else {
  7742. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  7743. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  7744. }
  7745. }
  7746. } else {
  7747. if !(entity != 0) {
  7748. /* Cannot report skipped entity here - see comments on
  7749. parser->m_skippedEntityHandler.
  7750. if (parser->m_skippedEntityHandler)
  7751. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  7752. */
  7753. /* Cannot call the default handler because this would be
  7754. out of sync with the call to the startElementHandler.
  7755. if ((pool == &parser->m_tempPool) && parser->m_defaultHandler)
  7756. reportDefault(parser, enc, ptr, next);
  7757. */
  7758. break
  7759. }
  7760. }
  7761. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  7762. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7763. /* It does not appear that this line can be executed.
  7764. *
  7765. * The "if (entity->open)" check catches recursive entity
  7766. * definitions. In order to be called with an open
  7767. * entity, it must have gone through this code before and
  7768. * been through the recursive call to
  7769. * appendAttributeValue() some lines below. That call
  7770. * sets the local encoding ("enc") to the parser's
  7771. * internal encoding (internal_utf8 or internal_utf16),
  7772. * which can never be the same as the principle encoding.
  7773. * It doesn't appear there is another code path that gets
  7774. * here with entity->open being TRUE.
  7775. *
  7776. * Since it is not certain that this logic is watertight,
  7777. * we keep the line and merely exclude it from coverage
  7778. * tests.
  7779. */
  7780. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr /* LCOV_EXCL_LINE */
  7781. }
  7782. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  7783. }
  7784. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  7785. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7786. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  7787. }
  7788. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  7789. }
  7790. if !((*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0) {
  7791. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7792. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  7793. }
  7794. return int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF)
  7795. } else {
  7796. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  7797. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  7798. result = _appendAttributeValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, isCdata, (*TENTITY)(unsafe.Pointer(entity)).FtextPtr, textEnd, pool)
  7799. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  7800. if result != 0 {
  7801. return result
  7802. }
  7803. }
  7804. default:
  7805. /* The only token returned by XmlAttributeValueTok() that does
  7806. * not have an explicit case here is XML_TOK_PARTIAL_CHAR.
  7807. * Getting that would require an entity name to contain an
  7808. * incomplete XML character (e.g. \xE2\x82); however previous
  7809. * tokenisers will have already recognised and rejected such
  7810. * names before XmlAttributeValueTok() gets a look-in. This
  7811. * default case should be retained as a safety net, but the code
  7812. * excluded from coverage tests.
  7813. *
  7814. * LCOV_EXCL_START
  7815. */
  7816. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7817. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  7818. }
  7819. return int32(_XML_ERROR_UNEXPECTED_STATE)
  7820. /* LCOV_EXCL_STOP */
  7821. }
  7822. ptr = *(*uintptr)(unsafe.Pointer(bp))
  7823. goto _1
  7824. _1:
  7825. }
  7826. /* not reached */
  7827. return r
  7828. }
  7829. func _storeEntityValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, entityTextPtr uintptr, entityTextEnd uintptr) (r _XML_Error) {
  7830. bp := tls.Alloc(16)
  7831. defer tls.Free(16)
  7832. var dtd, entity, name, pool, v2, v3, v5, v6 uintptr
  7833. var i, n, oldInEntityValue, tok int32
  7834. var result _XML_Error
  7835. var _ /* buf at bp+8 */ [4]TXML_Char
  7836. var _ /* next at bp+0 */ uintptr
  7837. _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, entity, i, n, name, oldInEntityValue, pool, result, tok, v2, v3, v5, v6
  7838. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  7839. pool = dtd + 208
  7840. result = int32(_XML_ERROR_NONE)
  7841. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  7842. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = int32(1)
  7843. /* never return Null for the value argument in EntityDeclHandler,
  7844. since this would indicate an external entity; therefore we
  7845. have to make sure that entityValuePool.start is not null */
  7846. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0) {
  7847. if !(_poolGrow(tls, pool) != 0) {
  7848. return int32(_XML_ERROR_NO_MEMORY)
  7849. }
  7850. }
  7851. for {
  7852. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 32 + 1*8))})))(tls, enc, entityTextPtr, entityTextEnd, bp)
  7853. switch tok {
  7854. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  7855. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7856. name = _poolStoreString(tls, parser+784, enc, entityTextPtr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7857. if !(name != 0) {
  7858. result = int32(_XML_ERROR_NO_MEMORY)
  7859. goto endEntityValue
  7860. }
  7861. entity = _lookup(tls, parser, dtd+264, name, uint64(0))
  7862. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  7863. if !(entity != 0) {
  7864. /* not a well-formedness error - see XML 1.0: WFC Entity Declared */
  7865. /* cannot report skipped entity here - see comments on
  7866. parser->m_skippedEntityHandler
  7867. if (parser->m_skippedEntityHandler)
  7868. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  7869. */
  7870. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7871. goto endEntityValue
  7872. }
  7873. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  7874. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7875. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  7876. }
  7877. result = int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  7878. goto endEntityValue
  7879. }
  7880. if (*TENTITY)(unsafe.Pointer(entity)).FsystemId != 0 {
  7881. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  7882. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  7883. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  7884. if !((*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg, uintptr(0), (*TENTITY)(unsafe.Pointer(entity)).Fbase, (*TENTITY)(unsafe.Pointer(entity)).FsystemId, (*TENTITY)(unsafe.Pointer(entity)).FpublicId) != 0) {
  7885. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  7886. result = int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  7887. goto endEntityValue
  7888. }
  7889. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  7890. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  7891. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7892. }
  7893. } else {
  7894. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7895. }
  7896. } else {
  7897. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  7898. result = _storeEntityValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, (*TENTITY)(unsafe.Pointer(entity)).FtextPtr, (*TENTITY)(unsafe.Pointer(entity)).FtextPtr+uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen))
  7899. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  7900. if result != 0 {
  7901. goto endEntityValue
  7902. }
  7903. }
  7904. break
  7905. }
  7906. /* In the internal subset, PE references are not legal
  7907. within markup declarations, e.g entity values in this case. */
  7908. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  7909. result = int32(_XML_ERROR_PARAM_ENTITY_REF)
  7910. goto endEntityValue
  7911. case -int32(4):
  7912. result = int32(_XML_ERROR_NONE)
  7913. goto endEntityValue
  7914. case int32(m_XML_TOK_ENTITY_REF):
  7915. fallthrough
  7916. case int32(m_XML_TOK_DATA_CHARS):
  7917. if !(_poolAppend(tls, pool, enc, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7918. result = int32(_XML_ERROR_NO_MEMORY)
  7919. goto endEntityValue
  7920. }
  7921. case -int32(3):
  7922. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  7923. /* fall through */
  7924. fallthrough
  7925. case int32(m_XML_TOK_DATA_NEWLINE):
  7926. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  7927. result = int32(_XML_ERROR_NO_MEMORY)
  7928. goto endEntityValue
  7929. }
  7930. v3 = pool + 24
  7931. v2 = *(*uintptr)(unsafe.Pointer(v3))
  7932. *(*uintptr)(unsafe.Pointer(v3))++
  7933. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(0xA)
  7934. case int32(m_XML_TOK_CHAR_REF):
  7935. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, entityTextPtr)
  7936. if n < 0 {
  7937. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7938. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  7939. }
  7940. result = int32(_XML_ERROR_BAD_CHAR_REF)
  7941. goto endEntityValue
  7942. }
  7943. n = XXmlUtf8Encode(tls, n, bp+8)
  7944. /* The XmlEncode() functions can never return 0 here. That
  7945. * error return happens if the code point passed in is either
  7946. * negative or greater than or equal to 0x110000. The
  7947. * XmlCharRefNumber() functions will all return a number
  7948. * strictly less than 0x110000 or a negative value if an error
  7949. * occurred. The negative value is intercepted above, so
  7950. * XmlEncode() is never passed a value it might return an
  7951. * error for.
  7952. */
  7953. i = 0
  7954. for {
  7955. if !(i < n) {
  7956. break
  7957. }
  7958. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  7959. result = int32(_XML_ERROR_NO_MEMORY)
  7960. goto endEntityValue
  7961. }
  7962. v6 = pool + 24
  7963. v5 = *(*uintptr)(unsafe.Pointer(v6))
  7964. *(*uintptr)(unsafe.Pointer(v6))++
  7965. *(*TXML_Char)(unsafe.Pointer(v5)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 8)))[i]
  7966. goto _4
  7967. _4:
  7968. ;
  7969. i++
  7970. }
  7971. case -int32(1):
  7972. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7973. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  7974. }
  7975. result = int32(_XML_ERROR_INVALID_TOKEN)
  7976. goto endEntityValue
  7977. case m_XML_TOK_INVALID:
  7978. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7979. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  7980. }
  7981. result = int32(_XML_ERROR_INVALID_TOKEN)
  7982. goto endEntityValue
  7983. default:
  7984. /* This default case should be unnecessary -- all the tokens
  7985. * that XmlEntityValueTok() can return have their own explicit
  7986. * cases -- but should be retained for safety. We do however
  7987. * exclude it from the coverage statistics.
  7988. *
  7989. * LCOV_EXCL_START
  7990. */
  7991. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7992. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  7993. }
  7994. result = int32(_XML_ERROR_UNEXPECTED_STATE)
  7995. goto endEntityValue
  7996. /* LCOV_EXCL_STOP */
  7997. }
  7998. entityTextPtr = *(*uintptr)(unsafe.Pointer(bp))
  7999. goto _1
  8000. _1:
  8001. }
  8002. goto endEntityValue
  8003. endEntityValue:
  8004. ;
  8005. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  8006. return result
  8007. }
  8008. func _normalizeLines(tls *libc.TLS, s uintptr) {
  8009. var p, v2, v3, v4, v5 uintptr
  8010. _, _, _, _, _ = p, v2, v3, v4, v5
  8011. for {
  8012. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  8013. return
  8014. }
  8015. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8016. break
  8017. }
  8018. goto _1
  8019. _1:
  8020. ;
  8021. s++
  8022. }
  8023. p = s
  8024. for cond := true; cond; cond = *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  8025. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8026. v2 = p
  8027. p++
  8028. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(0xA)
  8029. s++
  8030. v3 = s
  8031. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(v3))) == int32(0xA) {
  8032. s++
  8033. }
  8034. } else {
  8035. v4 = p
  8036. p++
  8037. v5 = s
  8038. s++
  8039. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(v5))
  8040. }
  8041. }
  8042. *(*TXML_Char)(unsafe.Pointer(p)) = uint8('\000')
  8043. }
  8044. func _reportProcessingInstruction(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8045. var data, target, tem uintptr
  8046. _, _, _ = data, target, tem
  8047. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler != 0) {
  8048. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8049. _reportDefault(tls, parser, enc, start, end)
  8050. }
  8051. return int32(1)
  8052. }
  8053. start += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar * int32(2))
  8054. tem = start + uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, start))
  8055. target = _poolStoreString(tls, parser+784, enc, start, tem)
  8056. if !(target != 0) {
  8057. return 0
  8058. }
  8059. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  8060. data = _poolStoreString(tls, parser+784, enc, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FskipS})))(tls, enc, tem), end-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(2)))
  8061. if !(data != 0) {
  8062. return 0
  8063. }
  8064. _normalizeLines(tls, data)
  8065. (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, target, data)
  8066. _poolClear(tls, parser+784)
  8067. return int32(1)
  8068. }
  8069. func _reportComment(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8070. var data uintptr
  8071. _ = data
  8072. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler != 0) {
  8073. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8074. _reportDefault(tls, parser, enc, start, end)
  8075. }
  8076. return int32(1)
  8077. }
  8078. data = _poolStoreString(tls, parser+784, enc, start+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(4)), end-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(3)))
  8079. if !(data != 0) {
  8080. return 0
  8081. }
  8082. _normalizeLines(tls, data)
  8083. (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, data)
  8084. _poolClear(tls, parser+784)
  8085. return int32(1)
  8086. }
  8087. func _reportDefault(tls *libc.TLS, parser TXML_Parser, enc uintptr, _s uintptr, end uintptr) {
  8088. bp := tls.Alloc(16)
  8089. defer tls.Free(16)
  8090. *(*uintptr)(unsafe.Pointer(bp)) = _s
  8091. var convert_res _XML_Convert_Result
  8092. var eventEndPP, eventPP uintptr
  8093. var _ /* dataPtr at bp+8 */ uintptr
  8094. _, _, _ = convert_res, eventEndPP, eventPP
  8095. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  8096. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8097. eventPP = parser + 544
  8098. eventEndPP = parser + 552
  8099. } else {
  8100. /* To get here, two things must be true; the parser must be
  8101. * using a character encoding that is not the same as the
  8102. * encoding passed in, and the encoding passed in must need
  8103. * conversion to the internal format (UTF-8 unless XML_UNICODE
  8104. * is defined). The only occasions on which the encoding passed
  8105. * in is not the same as the parser's encoding are when it is
  8106. * the internal encoding (e.g. a previously defined parameter
  8107. * entity, already converted to internal format). This by
  8108. * definition doesn't need conversion, so the whole branch never
  8109. * gets executed.
  8110. *
  8111. * For safety's sake we don't delete these lines and merely
  8112. * exclude them from coverage statistics.
  8113. *
  8114. * LCOV_EXCL_START
  8115. */
  8116. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8117. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  8118. /* LCOV_EXCL_STOP */
  8119. }
  8120. for cond := true; cond; cond = convert_res != int32(_XML_CONVERT_COMPLETED) && convert_res != int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  8121. *(*uintptr)(unsafe.Pointer(bp + 8)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  8122. convert_res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+8, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  8123. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8124. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(int64(*(*uintptr)(unsafe.Pointer(bp + 8)))-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)))
  8125. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8126. }
  8127. } else {
  8128. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp)))))
  8129. }
  8130. }
  8131. func _defineAttribute(tls *libc.TLS, type1 uintptr, attId uintptr, isCdata TXML_Bool, isId TXML_Bool, value uintptr, parser TXML_Parser) (r int32) {
  8132. var att, temp uintptr
  8133. var count, i int32
  8134. _, _, _, _ = att, count, i, temp
  8135. if value != 0 || isId != 0 {
  8136. i = 0
  8137. for {
  8138. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts) {
  8139. break
  8140. }
  8141. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr(i)*24))).Fid {
  8142. return int32(1)
  8143. }
  8144. goto _1
  8145. _1:
  8146. ;
  8147. i++
  8148. }
  8149. if isId != 0 && !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt != 0) && !((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0) {
  8150. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt = attId
  8151. }
  8152. }
  8153. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts == (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts {
  8154. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts == 0 {
  8155. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = int32(8)
  8156. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts)*libc.Uint64FromInt64(24))
  8157. if !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts != 0) {
  8158. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = 0
  8159. return 0
  8160. }
  8161. } else {
  8162. count = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts * int32(2)
  8163. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts, libc.Uint64FromInt32(count)*libc.Uint64FromInt64(24))
  8164. if temp == libc.UintptrFromInt32(0) {
  8165. return 0
  8166. }
  8167. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = count
  8168. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts = temp
  8169. }
  8170. }
  8171. att = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts)*24
  8172. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fid = attId
  8173. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fvalue = value
  8174. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).FisCdata = isCdata
  8175. if !(isCdata != 0) {
  8176. (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized = libc.Uint8FromInt32(1)
  8177. }
  8178. *(*int32)(unsafe.Pointer(type1 + 24)) += int32(1)
  8179. return int32(1)
  8180. }
  8181. func _setElementTypePrefix(tls *libc.TLS, parser TXML_Parser, elementType uintptr) (r int32) {
  8182. var dtd, name, prefix, s, v4, v5, v7, v8 uintptr
  8183. var v3, v6 int32
  8184. _, _, _, _, _, _, _, _, _, _ = dtd, name, prefix, s, v3, v4, v5, v6, v7, v8
  8185. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8186. name = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8187. for {
  8188. if !(*(*TXML_Char)(unsafe.Pointer(name)) != 0) {
  8189. break
  8190. }
  8191. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_COLON) {
  8192. s = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8193. for {
  8194. if !(s != name) {
  8195. break
  8196. }
  8197. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8198. v3 = 0
  8199. } else {
  8200. v5 = dtd + 160 + 24
  8201. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8202. *(*uintptr)(unsafe.Pointer(v5))++
  8203. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  8204. v3 = libc.Int32FromInt32(1)
  8205. }
  8206. if !(v3 != 0) {
  8207. return 0
  8208. }
  8209. goto _2
  8210. _2:
  8211. ;
  8212. s++
  8213. }
  8214. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8215. v6 = 0
  8216. } else {
  8217. v8 = dtd + 160 + 24
  8218. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8219. *(*uintptr)(unsafe.Pointer(v8))++
  8220. *(*TXML_Char)(unsafe.Pointer(v7)) = uint8('\000')
  8221. v6 = libc.Int32FromInt32(1)
  8222. }
  8223. if !(v6 != 0) {
  8224. return 0
  8225. }
  8226. prefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart, uint64(16))
  8227. if !(prefix != 0) {
  8228. return 0
  8229. }
  8230. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart {
  8231. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8232. } else {
  8233. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8234. }
  8235. (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix = prefix
  8236. break
  8237. }
  8238. goto _1
  8239. _1:
  8240. ;
  8241. name++
  8242. }
  8243. return int32(1)
  8244. }
  8245. func _getAttributeId(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r uintptr) {
  8246. var dtd, id, name, v10, v11, v2, v3, v7, v8 uintptr
  8247. var i, j, v1, v6, v9 int32
  8248. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, i, id, j, name, v1, v10, v11, v2, v3, v6, v7, v8, v9
  8249. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8250. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8251. v1 = 0
  8252. } else {
  8253. v3 = dtd + 160 + 24
  8254. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8255. *(*uintptr)(unsafe.Pointer(v3))++
  8256. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8('\000')
  8257. v1 = libc.Int32FromInt32(1)
  8258. }
  8259. if !(v1 != 0) {
  8260. return libc.UintptrFromInt32(0)
  8261. }
  8262. name = _poolStoreString(tls, dtd+160, enc, start, end)
  8263. if !(name != 0) {
  8264. return libc.UintptrFromInt32(0)
  8265. }
  8266. /* skip quotation mark - its storage will be re-used (like in name[-1]) */
  8267. name++
  8268. id = _lookup(tls, parser, dtd+80, name, uint64(24))
  8269. if !(id != 0) {
  8270. return libc.UintptrFromInt32(0)
  8271. }
  8272. if (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fname != name {
  8273. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8274. } else {
  8275. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8276. if !!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  8277. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_x) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 1))) == int32(m_ASCII_m) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 2))) == int32(m_ASCII_l) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 3))) == int32(m_ASCII_n) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 4))) == int32(m_ASCII_s) && (libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32(m_ASCII_COLON)) {
  8278. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') {
  8279. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = dtd + 304
  8280. } else {
  8281. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+120, name+uintptr(6), uint64(16))
  8282. }
  8283. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fxmlns = libc.Uint8FromInt32(1)
  8284. } else {
  8285. i = 0
  8286. for {
  8287. if !(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i))) != 0) {
  8288. break
  8289. }
  8290. /* attributes without prefix are *not* in the default namespace */
  8291. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i)))) == int32(m_ASCII_COLON) {
  8292. j = 0
  8293. for {
  8294. if !(j < i) {
  8295. break
  8296. }
  8297. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8298. v6 = 0
  8299. } else {
  8300. v8 = dtd + 160 + 24
  8301. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8302. *(*uintptr)(unsafe.Pointer(v8))++
  8303. *(*TXML_Char)(unsafe.Pointer(v7)) = *(*TXML_Char)(unsafe.Pointer(name + uintptr(j)))
  8304. v6 = libc.Int32FromInt32(1)
  8305. }
  8306. if !(v6 != 0) {
  8307. return libc.UintptrFromInt32(0)
  8308. }
  8309. goto _5
  8310. _5:
  8311. ;
  8312. j++
  8313. }
  8314. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8315. v9 = 0
  8316. } else {
  8317. v11 = dtd + 160 + 24
  8318. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8319. *(*uintptr)(unsafe.Pointer(v11))++
  8320. *(*TXML_Char)(unsafe.Pointer(v10)) = uint8('\000')
  8321. v9 = libc.Int32FromInt32(1)
  8322. }
  8323. if !(v9 != 0) {
  8324. return libc.UintptrFromInt32(0)
  8325. }
  8326. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart, uint64(16))
  8327. if !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  8328. return libc.UintptrFromInt32(0)
  8329. }
  8330. if (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart {
  8331. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8332. } else {
  8333. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8334. }
  8335. break
  8336. }
  8337. goto _4
  8338. _4:
  8339. ;
  8340. i++
  8341. }
  8342. }
  8343. }
  8344. }
  8345. return id
  8346. }
  8347. func _getContext(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  8348. bp := tls.Alloc(16)
  8349. defer tls.Free(16)
  8350. var dtd, e, prefix, s, s1, v10, v11, v15, v16, v18, v19, v2, v22, v23, v26, v27, v3, v31, v32, v34, v35, v6, v7 uintptr
  8351. var i, i1, len1, len11, v1, v14, v17, v21, v25, v30, v33, v5, v9 int32
  8352. var needSep TXML_Bool
  8353. var v12, v28 bool
  8354. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  8355. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, e, i, i1, len1, len11, needSep, prefix, s, s1, v1, v10, v11, v12, v14, v15, v16, v17, v18, v19, v2, v21, v22, v23, v25, v26, v27, v28, v3, v30, v31, v32, v33, v34, v35, v5, v6, v7, v9
  8356. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8357. needSep = libc.Uint8FromInt32(0)
  8358. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  8359. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8360. v1 = 0
  8361. } else {
  8362. v3 = parser + 784 + 24
  8363. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8364. *(*uintptr)(unsafe.Pointer(v3))++
  8365. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(m_ASCII_EQUALS)
  8366. v1 = libc.Int32FromInt32(1)
  8367. }
  8368. if !(v1 != 0) {
  8369. return libc.UintptrFromInt32(0)
  8370. }
  8371. len1 = (*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).FuriLen
  8372. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  8373. len1--
  8374. }
  8375. i = 0
  8376. for {
  8377. if !(i < len1) {
  8378. break
  8379. }
  8380. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8381. v5 = 0
  8382. } else {
  8383. v7 = parser + 784 + 24
  8384. v6 = *(*uintptr)(unsafe.Pointer(v7))
  8385. *(*uintptr)(unsafe.Pointer(v7))++
  8386. *(*TXML_Char)(unsafe.Pointer(v6)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).Furi + uintptr(i)))
  8387. v5 = libc.Int32FromInt32(1)
  8388. }
  8389. if !(v5 != 0) {
  8390. /* Because of memory caching, I don't believe this line can be
  8391. * executed.
  8392. *
  8393. * This is part of a loop copying the default prefix binding
  8394. * URI into the parser's temporary string pool. Previously,
  8395. * that URI was copied into the same string pool, with a
  8396. * terminating NUL character, as part of setContext(). When
  8397. * the pool was cleared, that leaves a block definitely big
  8398. * enough to hold the URI on the free block list of the pool.
  8399. * The URI copy in getContext() therefore cannot run out of
  8400. * memory.
  8401. *
  8402. * If the pool is used between the setContext() and
  8403. * getContext() calls, the worst it can do is leave a bigger
  8404. * block on the front of the free list. Given that this is
  8405. * all somewhat inobvious and program logic can be changed, we
  8406. * don't delete the line but we do exclude it from the test
  8407. * coverage statistics.
  8408. */
  8409. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  8410. }
  8411. goto _4
  8412. _4:
  8413. ;
  8414. i++
  8415. }
  8416. needSep = libc.Uint8FromInt32(1)
  8417. }
  8418. _hashTableIterInit(tls, bp, dtd+120)
  8419. for {
  8420. prefix = _hashTableIterNext(tls, bp)
  8421. if !(prefix != 0) {
  8422. break
  8423. }
  8424. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0) {
  8425. /* This test appears to be (justifiable) paranoia. There does
  8426. * not seem to be a way of injecting a prefix without a binding
  8427. * that doesn't get errored long before this function is called.
  8428. * The test should remain for safety's sake, so we instead
  8429. * exclude the following line from the coverage statistics.
  8430. */
  8431. goto _8 /* LCOV_EXCL_LINE */
  8432. }
  8433. if v12 = needSep != 0; v12 {
  8434. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8435. v9 = 0
  8436. } else {
  8437. v11 = parser + 784 + 24
  8438. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8439. *(*uintptr)(unsafe.Pointer(v11))++
  8440. *(*TXML_Char)(unsafe.Pointer(v10)) = uint8(m_ASCII_FF)
  8441. v9 = libc.Int32FromInt32(1)
  8442. }
  8443. }
  8444. if v12 && !(v9 != 0) {
  8445. return libc.UintptrFromInt32(0)
  8446. }
  8447. s = (*TPREFIX)(unsafe.Pointer(prefix)).Fname
  8448. for {
  8449. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  8450. break
  8451. }
  8452. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8453. v14 = 0
  8454. } else {
  8455. v16 = parser + 784 + 24
  8456. v15 = *(*uintptr)(unsafe.Pointer(v16))
  8457. *(*uintptr)(unsafe.Pointer(v16))++
  8458. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  8459. v14 = libc.Int32FromInt32(1)
  8460. }
  8461. if !(v14 != 0) {
  8462. return libc.UintptrFromInt32(0)
  8463. }
  8464. goto _13
  8465. _13:
  8466. ;
  8467. s++
  8468. }
  8469. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8470. v17 = 0
  8471. } else {
  8472. v19 = parser + 784 + 24
  8473. v18 = *(*uintptr)(unsafe.Pointer(v19))
  8474. *(*uintptr)(unsafe.Pointer(v19))++
  8475. *(*TXML_Char)(unsafe.Pointer(v18)) = uint8(m_ASCII_EQUALS)
  8476. v17 = libc.Int32FromInt32(1)
  8477. }
  8478. if !(v17 != 0) {
  8479. return libc.UintptrFromInt32(0)
  8480. }
  8481. len11 = (*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).FuriLen
  8482. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  8483. len11--
  8484. }
  8485. i1 = 0
  8486. for {
  8487. if !(i1 < len11) {
  8488. break
  8489. }
  8490. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8491. v21 = 0
  8492. } else {
  8493. v23 = parser + 784 + 24
  8494. v22 = *(*uintptr)(unsafe.Pointer(v23))
  8495. *(*uintptr)(unsafe.Pointer(v23))++
  8496. *(*TXML_Char)(unsafe.Pointer(v22)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).Furi + uintptr(i1)))
  8497. v21 = libc.Int32FromInt32(1)
  8498. }
  8499. if !(v21 != 0) {
  8500. return libc.UintptrFromInt32(0)
  8501. }
  8502. goto _20
  8503. _20:
  8504. ;
  8505. i1++
  8506. }
  8507. needSep = libc.Uint8FromInt32(1)
  8508. goto _8
  8509. _8:
  8510. }
  8511. _hashTableIterInit(tls, bp, dtd)
  8512. for {
  8513. e = _hashTableIterNext(tls, bp)
  8514. if !(e != 0) {
  8515. break
  8516. }
  8517. if !((*TENTITY)(unsafe.Pointer(e)).Fopen != 0) {
  8518. goto _24
  8519. }
  8520. if v28 = needSep != 0; v28 {
  8521. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8522. v25 = 0
  8523. } else {
  8524. v27 = parser + 784 + 24
  8525. v26 = *(*uintptr)(unsafe.Pointer(v27))
  8526. *(*uintptr)(unsafe.Pointer(v27))++
  8527. *(*TXML_Char)(unsafe.Pointer(v26)) = uint8(m_ASCII_FF)
  8528. v25 = libc.Int32FromInt32(1)
  8529. }
  8530. }
  8531. if v28 && !(v25 != 0) {
  8532. return libc.UintptrFromInt32(0)
  8533. }
  8534. s1 = (*TENTITY)(unsafe.Pointer(e)).Fname
  8535. for {
  8536. if !(*(*TXML_Char)(unsafe.Pointer(s1)) != 0) {
  8537. break
  8538. }
  8539. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8540. v30 = 0
  8541. } else {
  8542. v32 = parser + 784 + 24
  8543. v31 = *(*uintptr)(unsafe.Pointer(v32))
  8544. *(*uintptr)(unsafe.Pointer(v32))++
  8545. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s1))
  8546. v30 = libc.Int32FromInt32(1)
  8547. }
  8548. if !(v30 != 0) {
  8549. return uintptr(0)
  8550. }
  8551. goto _29
  8552. _29:
  8553. ;
  8554. s1++
  8555. }
  8556. needSep = libc.Uint8FromInt32(1)
  8557. goto _24
  8558. _24:
  8559. }
  8560. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8561. v33 = 0
  8562. } else {
  8563. v35 = parser + 784 + 24
  8564. v34 = *(*uintptr)(unsafe.Pointer(v35))
  8565. *(*uintptr)(unsafe.Pointer(v35))++
  8566. *(*TXML_Char)(unsafe.Pointer(v34)) = uint8('\000')
  8567. v33 = libc.Int32FromInt32(1)
  8568. }
  8569. if !(v33 != 0) {
  8570. return libc.UintptrFromInt32(0)
  8571. }
  8572. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  8573. }
  8574. func _setContext(tls *libc.TLS, parser TXML_Parser, context uintptr) (r TXML_Bool) {
  8575. var dtd, e, prefix, s, v10, v12, v13, v15, v16, v2, v3, v5, v6, v9 uintptr
  8576. var v1, v11, v14, v4, v8 int32
  8577. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, e, prefix, s, v1, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v8, v9
  8578. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  8579. s = context
  8580. for libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  8581. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_FF) || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  8582. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8583. v1 = 0
  8584. } else {
  8585. v3 = parser + 784 + 24
  8586. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8587. *(*uintptr)(unsafe.Pointer(v3))++
  8588. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8('\000')
  8589. v1 = libc.Int32FromInt32(1)
  8590. }
  8591. if !(v1 != 0) {
  8592. return libc.Uint8FromInt32(0)
  8593. }
  8594. e = _lookup(tls, parser, dtd, (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, uint64(0))
  8595. if e != 0 {
  8596. (*TENTITY)(unsafe.Pointer(e)).Fopen = libc.Uint8FromInt32(1)
  8597. }
  8598. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) != int32('\000') {
  8599. s++
  8600. }
  8601. context = s
  8602. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  8603. } else {
  8604. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_EQUALS) {
  8605. if int64((*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart) == 0 {
  8606. prefix = dtd + 304
  8607. } else {
  8608. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8609. v4 = 0
  8610. } else {
  8611. v6 = parser + 784 + 24
  8612. v5 = *(*uintptr)(unsafe.Pointer(v6))
  8613. *(*uintptr)(unsafe.Pointer(v6))++
  8614. *(*TXML_Char)(unsafe.Pointer(v5)) = uint8('\000')
  8615. v4 = libc.Int32FromInt32(1)
  8616. }
  8617. if !(v4 != 0) {
  8618. return libc.Uint8FromInt32(0)
  8619. }
  8620. prefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, uint64(16))
  8621. if !(prefix != 0) {
  8622. return libc.Uint8FromInt32(0)
  8623. }
  8624. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart {
  8625. (*TPREFIX)(unsafe.Pointer(prefix)).Fname = _poolCopyString(tls, dtd+160, (*TPREFIX)(unsafe.Pointer(prefix)).Fname)
  8626. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0) {
  8627. return libc.Uint8FromInt32(0)
  8628. }
  8629. }
  8630. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  8631. }
  8632. context = s + uintptr(1)
  8633. for {
  8634. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32(m_ASCII_FF) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000')) {
  8635. break
  8636. }
  8637. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8638. v8 = 0
  8639. } else {
  8640. v10 = parser + 784 + 24
  8641. v9 = *(*uintptr)(unsafe.Pointer(v10))
  8642. *(*uintptr)(unsafe.Pointer(v10))++
  8643. *(*TXML_Char)(unsafe.Pointer(v9)) = *(*TXML_Char)(unsafe.Pointer(context))
  8644. v8 = libc.Int32FromInt32(1)
  8645. }
  8646. if !(v8 != 0) {
  8647. return libc.Uint8FromInt32(0)
  8648. }
  8649. goto _7
  8650. _7:
  8651. ;
  8652. context++
  8653. }
  8654. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8655. v11 = 0
  8656. } else {
  8657. v13 = parser + 784 + 24
  8658. v12 = *(*uintptr)(unsafe.Pointer(v13))
  8659. *(*uintptr)(unsafe.Pointer(v13))++
  8660. *(*TXML_Char)(unsafe.Pointer(v12)) = uint8('\000')
  8661. v11 = libc.Int32FromInt32(1)
  8662. }
  8663. if !(v11 != 0) {
  8664. return libc.Uint8FromInt32(0)
  8665. }
  8666. if _addBinding(tls, parser, prefix, libc.UintptrFromInt32(0), (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, parser+704) != int32(_XML_ERROR_NONE) {
  8667. return libc.Uint8FromInt32(0)
  8668. }
  8669. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  8670. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  8671. context++
  8672. }
  8673. s = context
  8674. } else {
  8675. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8676. v14 = 0
  8677. } else {
  8678. v16 = parser + 784 + 24
  8679. v15 = *(*uintptr)(unsafe.Pointer(v16))
  8680. *(*uintptr)(unsafe.Pointer(v16))++
  8681. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  8682. v14 = libc.Int32FromInt32(1)
  8683. }
  8684. if !(v14 != 0) {
  8685. return libc.Uint8FromInt32(0)
  8686. }
  8687. s++
  8688. }
  8689. }
  8690. }
  8691. return libc.Uint8FromInt32(1)
  8692. }
  8693. func _normalizePublicId(tls *libc.TLS, publicId uintptr) {
  8694. var p, s, v2, v3 uintptr
  8695. _, _, _, _ = p, s, v2, v3
  8696. p = publicId
  8697. s = publicId
  8698. for {
  8699. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  8700. break
  8701. }
  8702. switch libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) {
  8703. case int32(0x20):
  8704. fallthrough
  8705. case int32(0xD):
  8706. fallthrough
  8707. case int32(0xA):
  8708. if p != publicId && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) != int32(0x20) {
  8709. v2 = p
  8710. p++
  8711. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(0x20)
  8712. }
  8713. default:
  8714. v3 = p
  8715. p++
  8716. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  8717. }
  8718. goto _1
  8719. _1:
  8720. ;
  8721. s++
  8722. }
  8723. if p != publicId && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  8724. p--
  8725. }
  8726. *(*TXML_Char)(unsafe.Pointer(p)) = uint8('\000')
  8727. }
  8728. func _dtdCreate(tls *libc.TLS, ms uintptr) (r uintptr) {
  8729. var p uintptr
  8730. _ = p
  8731. p = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Fmalloc_fcn})))(tls, uint64(360))
  8732. if p == libc.UintptrFromInt32(0) {
  8733. return p
  8734. }
  8735. _poolInit(tls, p+160, ms)
  8736. _poolInit(tls, p+208, ms)
  8737. _hashTableInit(tls, p, ms)
  8738. _hashTableInit(tls, p+40, ms)
  8739. _hashTableInit(tls, p+80, ms)
  8740. _hashTableInit(tls, p+120, ms)
  8741. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  8742. _hashTableInit(tls, p+264, ms)
  8743. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  8744. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  8745. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  8746. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  8747. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  8748. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  8749. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  8750. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  8751. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  8752. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  8753. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  8754. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  8755. return p
  8756. }
  8757. func _dtdReset(tls *libc.TLS, p uintptr, ms uintptr) {
  8758. bp := tls.Alloc(16)
  8759. defer tls.Free(16)
  8760. var e uintptr
  8761. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  8762. _ = e
  8763. _hashTableIterInit(tls, bp, p+40)
  8764. for {
  8765. e = _hashTableIterNext(tls, bp)
  8766. if !(e != 0) {
  8767. break
  8768. }
  8769. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  8770. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  8771. }
  8772. goto _1
  8773. _1:
  8774. }
  8775. _hashTableClear(tls, p)
  8776. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  8777. _hashTableClear(tls, p+264)
  8778. _hashTableClear(tls, p+40)
  8779. _hashTableClear(tls, p+80)
  8780. _hashTableClear(tls, p+120)
  8781. _poolClear(tls, p+160)
  8782. _poolClear(tls, p+208)
  8783. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  8784. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  8785. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  8786. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  8787. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  8788. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  8789. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  8790. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  8791. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  8792. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  8793. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  8794. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  8795. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  8796. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  8797. }
  8798. func _dtdDestroy(tls *libc.TLS, p uintptr, isDocEntity TXML_Bool, ms uintptr) {
  8799. bp := tls.Alloc(16)
  8800. defer tls.Free(16)
  8801. var e uintptr
  8802. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  8803. _ = e
  8804. _hashTableIterInit(tls, bp, p+40)
  8805. for {
  8806. e = _hashTableIterNext(tls, bp)
  8807. if !(e != 0) {
  8808. break
  8809. }
  8810. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  8811. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  8812. }
  8813. goto _1
  8814. _1:
  8815. }
  8816. _hashTableDestroy(tls, p)
  8817. _hashTableDestroy(tls, p+264)
  8818. _hashTableDestroy(tls, p+40)
  8819. _hashTableDestroy(tls, p+80)
  8820. _hashTableDestroy(tls, p+120)
  8821. _poolDestroy(tls, p+160)
  8822. _poolDestroy(tls, p+208)
  8823. if isDocEntity != 0 {
  8824. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  8825. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  8826. }
  8827. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, p)
  8828. }
  8829. // C documentation
  8830. //
  8831. // /* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise.
  8832. // The new DTD has already been initialized.
  8833. // */
  8834. func _dtdCopy(tls *libc.TLS, oldParser TXML_Parser, newDtd uintptr, oldDtd uintptr, ms uintptr) (r int32) {
  8835. bp := tls.Alloc(16)
  8836. defer tls.Free(16)
  8837. var i, v3, v7 int32
  8838. var name, name1, name2, newA, newE, oldA, oldE, oldP, v4, v5 uintptr
  8839. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  8840. _, _, _, _, _, _, _, _, _, _, _, _, _ = i, name, name1, name2, newA, newE, oldA, oldE, oldP, v3, v4, v5, v7
  8841. /* Copy the prefix table. */
  8842. _hashTableIterInit(tls, bp, oldDtd+120)
  8843. for {
  8844. oldP = _hashTableIterNext(tls, bp)
  8845. if !(oldP != 0) {
  8846. break
  8847. }
  8848. name = _poolCopyString(tls, newDtd+160, (*TPREFIX)(unsafe.Pointer(oldP)).Fname)
  8849. if !(name != 0) {
  8850. return 0
  8851. }
  8852. if !(_lookup(tls, oldParser, newDtd+120, name, uint64(16)) != 0) {
  8853. return 0
  8854. }
  8855. goto _1
  8856. _1:
  8857. }
  8858. _hashTableIterInit(tls, bp, oldDtd+80)
  8859. /* Copy the attribute id table. */
  8860. for {
  8861. oldA = _hashTableIterNext(tls, bp)
  8862. if !(oldA != 0) {
  8863. break
  8864. }
  8865. /* Remember to allocate the scratch byte before the name. */
  8866. if (*TSTRING_POOL)(unsafe.Pointer(newDtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(newDtd+160)).Fend && !(_poolGrow(tls, newDtd+160) != 0) {
  8867. v3 = 0
  8868. } else {
  8869. v5 = newDtd + 160 + 24
  8870. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8871. *(*uintptr)(unsafe.Pointer(v5))++
  8872. *(*TXML_Char)(unsafe.Pointer(v4)) = uint8('\000')
  8873. v3 = libc.Int32FromInt32(1)
  8874. }
  8875. if !(v3 != 0) {
  8876. return 0
  8877. }
  8878. name1 = _poolCopyString(tls, newDtd+160, (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fname)
  8879. if !(name1 != 0) {
  8880. return 0
  8881. }
  8882. name1++
  8883. newA = _lookup(tls, oldParser, newDtd+80, name1, uint64(24))
  8884. if !(newA != 0) {
  8885. return 0
  8886. }
  8887. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).FmaybeTokenized = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).FmaybeTokenized
  8888. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix != 0 {
  8889. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fxmlns = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fxmlns
  8890. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix == oldDtd+304 {
  8891. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = newDtd + 304
  8892. } else {
  8893. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = _lookup(tls, oldParser, newDtd+120, (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix)).Fname, uint64(0))
  8894. }
  8895. }
  8896. goto _2
  8897. _2:
  8898. }
  8899. /* Copy the element type table. */
  8900. _hashTableIterInit(tls, bp, oldDtd+40)
  8901. for {
  8902. oldE = _hashTableIterNext(tls, bp)
  8903. if !(oldE != 0) {
  8904. break
  8905. }
  8906. name2 = _poolCopyString(tls, newDtd+160, (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fname)
  8907. if !(name2 != 0) {
  8908. return 0
  8909. }
  8910. newE = _lookup(tls, oldParser, newDtd+40, name2, uint64(40))
  8911. if !(newE != 0) {
  8912. return 0
  8913. }
  8914. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts != 0 {
  8915. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Fmalloc_fcn})))(tls, libc.Uint64FromInt32((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts)*uint64(24))
  8916. if !((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts != 0) {
  8917. return 0
  8918. }
  8919. }
  8920. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt != 0 {
  8921. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FidAtt = _lookup(tls, oldParser, newDtd+80, (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt)).Fname, uint64(0))
  8922. }
  8923. v7 = (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts
  8924. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts = v7
  8925. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FallocDefaultAtts = v7
  8926. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix != 0 {
  8927. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).Fprefix = _lookup(tls, oldParser, newDtd+120, (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix)).Fname, uint64(0))
  8928. }
  8929. i = 0
  8930. for {
  8931. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts) {
  8932. break
  8933. }
  8934. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fid = _lookup(tls, oldParser, newDtd+80, (*TATTRIBUTE_ID)(unsafe.Pointer((*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).Fid)).Fname, uint64(0))
  8935. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).FisCdata = (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).FisCdata
  8936. if (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).Fvalue != 0 {
  8937. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue = _poolCopyString(tls, newDtd+160, (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).Fvalue)
  8938. if !((*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue != 0) {
  8939. return 0
  8940. }
  8941. } else {
  8942. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue = libc.UintptrFromInt32(0)
  8943. }
  8944. goto _8
  8945. _8:
  8946. ;
  8947. i++
  8948. }
  8949. goto _6
  8950. _6:
  8951. }
  8952. /* Copy the entity tables. */
  8953. if !(_copyEntityTable(tls, oldParser, newDtd, newDtd+160, oldDtd) != 0) {
  8954. return 0
  8955. }
  8956. if !(_copyEntityTable(tls, oldParser, newDtd+264, newDtd+160, oldDtd+264) != 0) {
  8957. return 0
  8958. }
  8959. (*TDTD)(unsafe.Pointer(newDtd)).FparamEntityRead = (*TDTD)(unsafe.Pointer(oldDtd)).FparamEntityRead
  8960. (*TDTD)(unsafe.Pointer(newDtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(oldDtd)).FkeepProcessing
  8961. (*TDTD)(unsafe.Pointer(newDtd)).FhasParamEntityRefs = (*TDTD)(unsafe.Pointer(oldDtd)).FhasParamEntityRefs
  8962. (*TDTD)(unsafe.Pointer(newDtd)).Fstandalone = (*TDTD)(unsafe.Pointer(oldDtd)).Fstandalone
  8963. /* Don't want deep copying for scaffolding */
  8964. (*TDTD)(unsafe.Pointer(newDtd)).Fin_eldecl = (*TDTD)(unsafe.Pointer(oldDtd)).Fin_eldecl
  8965. (*TDTD)(unsafe.Pointer(newDtd)).Fscaffold = (*TDTD)(unsafe.Pointer(oldDtd)).Fscaffold
  8966. (*TDTD)(unsafe.Pointer(newDtd)).FcontentStringLen = (*TDTD)(unsafe.Pointer(oldDtd)).FcontentStringLen
  8967. (*TDTD)(unsafe.Pointer(newDtd)).FscaffSize = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffSize
  8968. (*TDTD)(unsafe.Pointer(newDtd)).FscaffLevel = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffLevel
  8969. (*TDTD)(unsafe.Pointer(newDtd)).FscaffIndex = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffIndex
  8970. return int32(1)
  8971. }
  8972. /* End dtdCopy */
  8973. func _copyEntityTable(tls *libc.TLS, oldParser TXML_Parser, newTable uintptr, newPool uintptr, oldTable uintptr) (r int32) {
  8974. bp := tls.Alloc(16)
  8975. defer tls.Free(16)
  8976. var cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2 uintptr
  8977. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  8978. _, _, _, _, _, _, _, _, _ = cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2
  8979. cachedOldBase = libc.UintptrFromInt32(0)
  8980. cachedNewBase = libc.UintptrFromInt32(0)
  8981. _hashTableIterInit(tls, bp, oldTable)
  8982. for {
  8983. oldE = _hashTableIterNext(tls, bp)
  8984. if !(oldE != 0) {
  8985. break
  8986. }
  8987. name = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fname)
  8988. if !(name != 0) {
  8989. return 0
  8990. }
  8991. newE = _lookup(tls, oldParser, newTable, name, uint64(64))
  8992. if !(newE != 0) {
  8993. return 0
  8994. }
  8995. if (*TENTITY)(unsafe.Pointer(oldE)).FsystemId != 0 {
  8996. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FsystemId)
  8997. if !(tem != 0) {
  8998. return 0
  8999. }
  9000. (*TENTITY)(unsafe.Pointer(newE)).FsystemId = tem
  9001. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase != 0 {
  9002. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase == cachedOldBase {
  9003. (*TENTITY)(unsafe.Pointer(newE)).Fbase = cachedNewBase
  9004. } else {
  9005. cachedOldBase = (*TENTITY)(unsafe.Pointer(oldE)).Fbase
  9006. tem = _poolCopyString(tls, newPool, cachedOldBase)
  9007. if !(tem != 0) {
  9008. return 0
  9009. }
  9010. v2 = tem
  9011. (*TENTITY)(unsafe.Pointer(newE)).Fbase = v2
  9012. cachedNewBase = v2
  9013. }
  9014. }
  9015. if (*TENTITY)(unsafe.Pointer(oldE)).FpublicId != 0 {
  9016. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FpublicId)
  9017. if !(tem != 0) {
  9018. return 0
  9019. }
  9020. (*TENTITY)(unsafe.Pointer(newE)).FpublicId = tem
  9021. }
  9022. } else {
  9023. tem1 = _poolCopyStringN(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FtextPtr, (*TENTITY)(unsafe.Pointer(oldE)).FtextLen)
  9024. if !(tem1 != 0) {
  9025. return 0
  9026. }
  9027. (*TENTITY)(unsafe.Pointer(newE)).FtextPtr = tem1
  9028. (*TENTITY)(unsafe.Pointer(newE)).FtextLen = (*TENTITY)(unsafe.Pointer(oldE)).FtextLen
  9029. }
  9030. if (*TENTITY)(unsafe.Pointer(oldE)).Fnotation != 0 {
  9031. tem2 = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fnotation)
  9032. if !(tem2 != 0) {
  9033. return 0
  9034. }
  9035. (*TENTITY)(unsafe.Pointer(newE)).Fnotation = tem2
  9036. }
  9037. (*TENTITY)(unsafe.Pointer(newE)).Fis_param = (*TENTITY)(unsafe.Pointer(oldE)).Fis_param
  9038. (*TENTITY)(unsafe.Pointer(newE)).Fis_internal = (*TENTITY)(unsafe.Pointer(oldE)).Fis_internal
  9039. goto _1
  9040. _1:
  9041. }
  9042. return int32(1)
  9043. }
  9044. func _keyeq(tls *libc.TLS, s1 TKEY, s2 TKEY) (r TXML_Bool) {
  9045. for {
  9046. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s2)))) {
  9047. break
  9048. }
  9049. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  9050. return libc.Uint8FromInt32(1)
  9051. }
  9052. goto _1
  9053. _1:
  9054. ;
  9055. s1++
  9056. s2++
  9057. }
  9058. return libc.Uint8FromInt32(0)
  9059. }
  9060. func _keylen(tls *libc.TLS, s TKEY) (r Tsize_t) {
  9061. var len1 Tsize_t
  9062. _ = len1
  9063. len1 = uint64(0)
  9064. for {
  9065. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9066. break
  9067. }
  9068. goto _1
  9069. _1:
  9070. ;
  9071. s++
  9072. len1++
  9073. }
  9074. return len1
  9075. }
  9076. func _copy_salt_to_sipkey(tls *libc.TLS, parser TXML_Parser, key uintptr) {
  9077. *(*Tuint64_t)(unsafe.Pointer(key)) = uint64(0)
  9078. *(*Tuint64_t)(unsafe.Pointer(key + 1*8)) = _get_hash_secret_salt(tls, parser)
  9079. }
  9080. func _hash(tls *libc.TLS, parser TXML_Parser, s TKEY) (r uint64) {
  9081. bp := tls.Alloc(80)
  9082. defer tls.Free(80)
  9083. var _ /* key at bp+56 */ Tsipkey
  9084. var _ /* state at bp+0 */ Tsiphash
  9085. _ = __ccgo_fp(_sip24_valid)
  9086. _copy_salt_to_sipkey(tls, parser, bp+56)
  9087. _sip24_init(tls, bp, bp+56)
  9088. _sip24_update(tls, bp, s, _keylen(tls, s)*uint64(1))
  9089. return _sip24_final(tls, bp)
  9090. }
  9091. func _lookup(tls *libc.TLS, parser TXML_Parser, table uintptr, name TKEY, createSize Tsize_t) (r uintptr) {
  9092. var h, mask, newHash, newMask uint64
  9093. var i, j, newSize, tsize, tsize1 Tsize_t
  9094. var newPower, step uint8
  9095. var newV uintptr
  9096. _, _, _, _, _, _, _, _, _, _, _, _ = h, i, j, mask, newHash, newMask, newPower, newSize, newV, step, tsize, tsize1
  9097. if (*THASH_TABLE)(unsafe.Pointer(table)).Fsize == uint64(0) {
  9098. if !(createSize != 0) {
  9099. return libc.UintptrFromInt32(0)
  9100. }
  9101. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = uint8(m_INIT_POWER)
  9102. /* table->size is a power of 2 */
  9103. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = libc.Uint64FromInt32(1) << libc.Int32FromInt32(m_INIT_POWER)
  9104. tsize = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize * uint64(8)
  9105. (*THASH_TABLE)(unsafe.Pointer(table)).Fv = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Fmalloc_fcn})))(tls, tsize)
  9106. if !((*THASH_TABLE)(unsafe.Pointer(table)).Fv != 0) {
  9107. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = uint64(0)
  9108. return libc.UintptrFromInt32(0)
  9109. }
  9110. libc.Xmemset(tls, (*THASH_TABLE)(unsafe.Pointer(table)).Fv, 0, tsize)
  9111. i = _hash(tls, parser, name) & ((*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(1))
  9112. } else {
  9113. h = _hash(tls, parser, name)
  9114. mask = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(1)
  9115. step = uint8(0)
  9116. i = h & mask
  9117. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9118. if _keyeq(tls, name, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname) != 0 {
  9119. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9120. }
  9121. if !(step != 0) {
  9122. step = uint8(h & ^mask >> (libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9123. }
  9124. if i < uint64(step) {
  9125. i += (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(step)
  9126. } else {
  9127. i -= uint64(step)
  9128. }
  9129. }
  9130. if !(createSize != 0) {
  9131. return libc.UintptrFromInt32(0)
  9132. }
  9133. /* check for overflow (table is half full) */
  9134. if (*THASH_TABLE)(unsafe.Pointer(table)).Fused>>(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-int32(1)) != 0 {
  9135. newPower = libc.Uint8FromInt32(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower) + int32(1))
  9136. newSize = libc.Uint64FromInt32(1) << newPower
  9137. newMask = newSize - uint64(1)
  9138. tsize1 = newSize * uint64(8)
  9139. newV = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Fmalloc_fcn})))(tls, tsize1)
  9140. if !(newV != 0) {
  9141. return libc.UintptrFromInt32(0)
  9142. }
  9143. libc.Xmemset(tls, newV, 0, tsize1)
  9144. i = uint64(0)
  9145. for {
  9146. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9147. break
  9148. }
  9149. if *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9150. newHash = _hash(tls, parser, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname)
  9151. j = newHash & newMask
  9152. step = uint8(0)
  9153. for *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*8)) != 0 {
  9154. if !(step != 0) {
  9155. step = uint8(newHash & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9156. }
  9157. if j < uint64(step) {
  9158. j += newSize - uint64(step)
  9159. } else {
  9160. j -= uint64(step)
  9161. }
  9162. }
  9163. *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*8)) = *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9164. }
  9165. goto _2
  9166. _2:
  9167. ;
  9168. i++
  9169. }
  9170. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Ffree_fcn})))(tls, (*THASH_TABLE)(unsafe.Pointer(table)).Fv)
  9171. (*THASH_TABLE)(unsafe.Pointer(table)).Fv = newV
  9172. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = newPower
  9173. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = newSize
  9174. i = h & newMask
  9175. step = uint8(0)
  9176. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9177. if !(step != 0) {
  9178. step = uint8(h & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9179. }
  9180. if i < uint64(step) {
  9181. i += newSize - uint64(step)
  9182. } else {
  9183. i -= uint64(step)
  9184. }
  9185. }
  9186. }
  9187. }
  9188. *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Fmalloc_fcn})))(tls, createSize)
  9189. if !(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0) {
  9190. return libc.UintptrFromInt32(0)
  9191. }
  9192. libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)), 0, createSize)
  9193. (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname = name
  9194. (*THASH_TABLE)(unsafe.Pointer(table)).Fused++
  9195. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9196. }
  9197. func _hashTableClear(tls *libc.TLS, table uintptr) {
  9198. var i Tsize_t
  9199. _ = i
  9200. i = uint64(0)
  9201. for {
  9202. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9203. break
  9204. }
  9205. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Ffree_fcn})))(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))
  9206. *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) = libc.UintptrFromInt32(0)
  9207. goto _1
  9208. _1:
  9209. ;
  9210. i++
  9211. }
  9212. (*THASH_TABLE)(unsafe.Pointer(table)).Fused = uint64(0)
  9213. }
  9214. func _hashTableDestroy(tls *libc.TLS, table uintptr) {
  9215. var i Tsize_t
  9216. _ = i
  9217. i = uint64(0)
  9218. for {
  9219. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9220. break
  9221. }
  9222. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Ffree_fcn})))(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))
  9223. goto _1
  9224. _1:
  9225. ;
  9226. i++
  9227. }
  9228. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Ffree_fcn})))(tls, (*THASH_TABLE)(unsafe.Pointer(table)).Fv)
  9229. }
  9230. func _hashTableInit(tls *libc.TLS, p uintptr, ms uintptr) {
  9231. (*THASH_TABLE)(unsafe.Pointer(p)).Fpower = uint8(0)
  9232. (*THASH_TABLE)(unsafe.Pointer(p)).Fsize = uint64(0)
  9233. (*THASH_TABLE)(unsafe.Pointer(p)).Fused = uint64(0)
  9234. (*THASH_TABLE)(unsafe.Pointer(p)).Fv = libc.UintptrFromInt32(0)
  9235. (*THASH_TABLE)(unsafe.Pointer(p)).Fmem = ms
  9236. }
  9237. func _hashTableIterInit(tls *libc.TLS, iter uintptr, table uintptr) {
  9238. var v1 uintptr
  9239. _ = v1
  9240. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp = (*THASH_TABLE)(unsafe.Pointer(table)).Fv
  9241. if (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != 0 {
  9242. v1 = (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp + uintptr((*THASH_TABLE)(unsafe.Pointer(table)).Fsize)*8
  9243. } else {
  9244. v1 = libc.UintptrFromInt32(0)
  9245. }
  9246. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend = v1
  9247. }
  9248. func _hashTableIterNext(tls *libc.TLS, iter uintptr) (r uintptr) {
  9249. var tem, v1, v2 uintptr
  9250. _, _, _ = tem, v1, v2
  9251. for (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend {
  9252. v2 = iter
  9253. v1 = *(*uintptr)(unsafe.Pointer(v2))
  9254. *(*uintptr)(unsafe.Pointer(v2)) += 8
  9255. tem = *(*uintptr)(unsafe.Pointer(v1))
  9256. if tem != 0 {
  9257. return tem
  9258. }
  9259. }
  9260. return libc.UintptrFromInt32(0)
  9261. }
  9262. func _poolInit(tls *libc.TLS, pool uintptr, ms uintptr) {
  9263. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  9264. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = libc.UintptrFromInt32(0)
  9265. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  9266. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  9267. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  9268. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem = ms
  9269. }
  9270. func _poolClear(tls *libc.TLS, pool uintptr) {
  9271. var p, tem uintptr
  9272. _, _ = p, tem
  9273. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0) {
  9274. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9275. } else {
  9276. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9277. for p != 0 {
  9278. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9279. (*TBLOCK)(unsafe.Pointer(p)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9280. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = p
  9281. p = tem
  9282. }
  9283. }
  9284. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  9285. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  9286. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  9287. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  9288. }
  9289. func _poolDestroy(tls *libc.TLS, pool uintptr) {
  9290. var p, tem, tem1 uintptr
  9291. _, _, _ = p, tem, tem1
  9292. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9293. for p != 0 {
  9294. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9295. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  9296. p = tem
  9297. }
  9298. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9299. for p != 0 {
  9300. tem1 = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9301. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  9302. p = tem1
  9303. }
  9304. }
  9305. func _poolAppend(tls *libc.TLS, pool uintptr, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  9306. bp := tls.Alloc(16)
  9307. defer tls.Free(16)
  9308. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  9309. var convert_res _XML_Convert_Result
  9310. _ = convert_res
  9311. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  9312. return libc.UintptrFromInt32(0)
  9313. }
  9314. for {
  9315. convert_res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, pool+24, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)
  9316. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  9317. break
  9318. }
  9319. if !(_poolGrow(tls, pool) != 0) {
  9320. return libc.UintptrFromInt32(0)
  9321. }
  9322. goto _1
  9323. _1:
  9324. }
  9325. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9326. }
  9327. func _poolCopyString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  9328. var v1, v4, v5 uintptr
  9329. var v3 int32
  9330. _, _, _, _ = v1, v3, v4, v5
  9331. for {
  9332. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9333. v3 = 0
  9334. } else {
  9335. v5 = pool + 24
  9336. v4 = *(*uintptr)(unsafe.Pointer(v5))
  9337. *(*uintptr)(unsafe.Pointer(v5))++
  9338. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  9339. v3 = libc.Int32FromInt32(1)
  9340. }
  9341. if !(v3 != 0) {
  9342. return libc.UintptrFromInt32(0)
  9343. }
  9344. goto _2
  9345. _2:
  9346. ;
  9347. v1 = s
  9348. s++
  9349. if !(*(*TXML_Char)(unsafe.Pointer(v1)) != 0) {
  9350. break
  9351. }
  9352. }
  9353. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9354. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  9355. return s
  9356. }
  9357. func _poolCopyStringN(tls *libc.TLS, pool uintptr, s uintptr, n int32) (r uintptr) {
  9358. var v2 int32
  9359. var v3, v4 uintptr
  9360. _, _, _ = v2, v3, v4
  9361. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  9362. /* The following line is unreachable given the current usage of
  9363. * poolCopyStringN(). Currently it is called from exactly one
  9364. * place to copy the text of a simple general entity. By that
  9365. * point, the name of the entity is already stored in the pool, so
  9366. * pool->ptr cannot be NULL.
  9367. *
  9368. * If poolCopyStringN() is used elsewhere as it well might be,
  9369. * this line may well become executable again. Regardless, this
  9370. * sort of check shouldn't be removed lightly, so we just exclude
  9371. * it from the coverage statistics.
  9372. */
  9373. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  9374. }
  9375. for {
  9376. if !(n > 0) {
  9377. break
  9378. }
  9379. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9380. v2 = 0
  9381. } else {
  9382. v4 = pool + 24
  9383. v3 = *(*uintptr)(unsafe.Pointer(v4))
  9384. *(*uintptr)(unsafe.Pointer(v4))++
  9385. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  9386. v2 = libc.Int32FromInt32(1)
  9387. }
  9388. if !(v2 != 0) {
  9389. return libc.UintptrFromInt32(0)
  9390. }
  9391. goto _1
  9392. _1:
  9393. ;
  9394. n--
  9395. s++
  9396. }
  9397. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9398. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  9399. return s
  9400. }
  9401. func _poolAppendString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  9402. var v1 int32
  9403. var v2, v3 uintptr
  9404. _, _, _ = v1, v2, v3
  9405. for *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  9406. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9407. v1 = 0
  9408. } else {
  9409. v3 = pool + 24
  9410. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9411. *(*uintptr)(unsafe.Pointer(v3))++
  9412. *(*TXML_Char)(unsafe.Pointer(v2)) = *(*TXML_Char)(unsafe.Pointer(s))
  9413. v1 = libc.Int32FromInt32(1)
  9414. }
  9415. if !(v1 != 0) {
  9416. return libc.UintptrFromInt32(0)
  9417. }
  9418. s++
  9419. }
  9420. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9421. }
  9422. func _poolStoreString(tls *libc.TLS, pool uintptr, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  9423. var v1, v2 uintptr
  9424. _, _ = v1, v2
  9425. if !(_poolAppend(tls, pool, enc, ptr, end) != 0) {
  9426. return libc.UintptrFromInt32(0)
  9427. }
  9428. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9429. return libc.UintptrFromInt32(0)
  9430. }
  9431. v2 = pool + 24
  9432. v1 = *(*uintptr)(unsafe.Pointer(v2))
  9433. *(*uintptr)(unsafe.Pointer(v2))++
  9434. *(*TXML_Char)(unsafe.Pointer(v1)) = uint8(0)
  9435. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9436. }
  9437. func _poolBytesToAllocateFor(tls *libc.TLS, blockSize int32) (r Tsize_t) {
  9438. var bytesToAllocate, stretchedBlockSize int32
  9439. var stretch Tsize_t
  9440. _, _, _ = bytesToAllocate, stretch, stretchedBlockSize
  9441. /* Unprotected math would be:
  9442. ** return offsetof(BLOCK, s) + blockSize * sizeof(XML_Char);
  9443. **
  9444. ** Detect overflow, avoiding _signed_ overflow undefined behavior
  9445. ** For a + b * c we check b * c in isolation first, so that addition of a
  9446. ** on top has no chance of making us accept a small non-negative number
  9447. */
  9448. stretch = uint64(1) /* can be 4 bytes */
  9449. if blockSize <= 0 {
  9450. return uint64(0)
  9451. }
  9452. if blockSize > libc.Int32FromUint64(libc.Uint64FromInt32(m_INT_MAX)/stretch) {
  9453. return uint64(0)
  9454. }
  9455. stretchedBlockSize = blockSize * libc.Int32FromUint64(stretch)
  9456. bytesToAllocate = libc.Int32FromUint64(uint64(libc.UintptrFromInt32(0)+12) + uint64(libc.Uint32FromInt32(stretchedBlockSize)))
  9457. if bytesToAllocate < 0 {
  9458. return uint64(0)
  9459. }
  9460. return libc.Uint64FromInt32(bytesToAllocate)
  9461. return r
  9462. }
  9463. func _poolGrow(tls *libc.TLS, pool uintptr) (r TXML_Bool) {
  9464. var blockSize, blockSize1 int32
  9465. var bytesToAllocate, bytesToAllocate1 Tsize_t
  9466. var offsetInsideBlock Tptrdiff_t
  9467. var tem, tem1, temp uintptr
  9468. _, _, _, _, _, _, _, _ = blockSize, blockSize1, bytesToAllocate, bytesToAllocate1, offsetInsideBlock, tem, tem1, temp
  9469. if (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0 {
  9470. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == uintptr(0) {
  9471. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9472. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  9473. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fnext = libc.UintptrFromInt32(0)
  9474. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  9475. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  9476. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9477. return libc.Uint8FromInt32(1)
  9478. }
  9479. if int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) < int64((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fsize) {
  9480. tem = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  9481. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9482. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9483. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = tem
  9484. libc.Xmemcpy(tls, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks+12, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart, libc.Uint64FromInt64(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))*uint64(1))
  9485. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12 + uintptr(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  9486. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  9487. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  9488. return libc.Uint8FromInt32(1)
  9489. }
  9490. }
  9491. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0 && (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks+12 {
  9492. blockSize = libc.Int32FromUint32(libc.Uint32FromInt64(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)) * libc.Uint32FromUint32(2))
  9493. /* NOTE: Needs to be calculated prior to calling `realloc`
  9494. to avoid dangling pointers: */
  9495. offsetInsideBlock = int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr) - int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)
  9496. if blockSize < 0 {
  9497. /* This condition traps a situation where either more than
  9498. * INT_MAX/2 bytes have already been allocated. This isn't
  9499. * readily testable, since it is unlikely that an average
  9500. * machine will have that much memory, so we exclude it from the
  9501. * coverage statistics.
  9502. */
  9503. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  9504. }
  9505. bytesToAllocate = _poolBytesToAllocateFor(tls, blockSize)
  9506. if bytesToAllocate == uint64(0) {
  9507. return libc.Uint8FromInt32(0)
  9508. }
  9509. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Frealloc_fcn})))(tls, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks, uint64(uint32(bytesToAllocate)))
  9510. if temp == libc.UintptrFromInt32(0) {
  9511. return libc.Uint8FromInt32(0)
  9512. }
  9513. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = temp
  9514. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize = blockSize
  9515. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12 + uintptr(offsetInsideBlock)
  9516. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  9517. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr(blockSize)
  9518. } else {
  9519. blockSize1 = int32(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend) - int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  9520. if blockSize1 < 0 {
  9521. /* This condition traps a situation where either more than
  9522. * INT_MAX bytes have already been allocated (which is prevented
  9523. * by various pieces of program logic, not least this one, never
  9524. * mind the unlikelihood of actually having that much memory) or
  9525. * the pool control fields have been corrupted (which could
  9526. * conceivably happen in an extremely buggy user handler
  9527. * function). Either way it isn't readily testable, so we
  9528. * exclude it from the coverage statistics.
  9529. */
  9530. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  9531. }
  9532. if blockSize1 < int32(m_INIT_BLOCK_SIZE) {
  9533. blockSize1 = int32(m_INIT_BLOCK_SIZE)
  9534. } else {
  9535. /* Detect overflow, avoiding _signed_ overflow undefined behavior */
  9536. if libc.Int32FromUint32(libc.Uint32FromInt32(blockSize1)*libc.Uint32FromUint32(2)) < 0 {
  9537. return libc.Uint8FromInt32(0)
  9538. }
  9539. blockSize1 *= int32(2)
  9540. }
  9541. bytesToAllocate1 = _poolBytesToAllocateFor(tls, blockSize1)
  9542. if bytesToAllocate1 == uint64(0) {
  9543. return libc.Uint8FromInt32(0)
  9544. }
  9545. tem1 = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Fmalloc_fcn})))(tls, bytesToAllocate1)
  9546. if !(tem1 != 0) {
  9547. return libc.Uint8FromInt32(0)
  9548. }
  9549. (*TBLOCK)(unsafe.Pointer(tem1)).Fsize = blockSize1
  9550. (*TBLOCK)(unsafe.Pointer(tem1)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9551. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = tem1
  9552. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart {
  9553. libc.Xmemcpy(tls, tem1+12, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart, libc.Uint64FromInt64(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))*uint64(1))
  9554. }
  9555. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = tem1 + 12 + uintptr(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  9556. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = tem1 + 12
  9557. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = tem1 + 12 + uintptr(blockSize1)
  9558. }
  9559. return libc.Uint8FromInt32(1)
  9560. }
  9561. func _nextScaffoldPart(tls *libc.TLS, parser TXML_Parser) (r int32) {
  9562. var dtd, me, parent, temp, v2 uintptr
  9563. var next, v3, v4, v5 int32
  9564. var v1 uint32
  9565. _, _, _, _, _, _, _, _, _, _ = dtd, me, next, parent, temp, v1, v2, v3, v4, v5
  9566. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  9567. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  9568. (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize)*libc.Uint64FromInt64(4))
  9569. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  9570. return -int32(1)
  9571. }
  9572. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex)) = 0
  9573. }
  9574. if (*TDTD)(unsafe.Pointer(dtd)).FscaffCount >= (*TDTD)(unsafe.Pointer(dtd)).FscaffSize {
  9575. if (*TDTD)(unsafe.Pointer(dtd)).Fscaffold != 0 {
  9576. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TDTD)(unsafe.Pointer(dtd)).Fscaffold, uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffSize*libc.Uint32FromInt32(2))*libc.Uint64FromInt64(32))
  9577. if temp == libc.UintptrFromInt32(0) {
  9578. return -int32(1)
  9579. }
  9580. *(*uint32)(unsafe.Pointer(dtd + 340)) *= uint32(2)
  9581. } else {
  9582. temp = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(m_INIT_SCAFFOLD_ELEMENTS)*libc.Uint64FromInt64(32))
  9583. if temp == libc.UintptrFromInt32(0) {
  9584. return -int32(1)
  9585. }
  9586. (*TDTD)(unsafe.Pointer(dtd)).FscaffSize = uint32(m_INIT_SCAFFOLD_ELEMENTS)
  9587. }
  9588. (*TDTD)(unsafe.Pointer(dtd)).Fscaffold = temp
  9589. }
  9590. v2 = dtd + 344
  9591. v1 = *(*uint32)(unsafe.Pointer(v2))
  9592. *(*uint32)(unsafe.Pointer(v2))++
  9593. next = libc.Int32FromUint32(v1)
  9594. me = (*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(next)*32
  9595. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel != 0 {
  9596. parent = (*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*32
  9597. if (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild != 0 {
  9598. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild)*32))).Fnextsib = next
  9599. }
  9600. if !((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt != 0) {
  9601. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Ffirstchild = next
  9602. }
  9603. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild = next
  9604. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt++
  9605. }
  9606. v5 = libc.Int32FromInt32(0)
  9607. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fnextsib = v5
  9608. v4 = v5
  9609. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fchildcnt = v4
  9610. v3 = v4
  9611. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Flastchild = v3
  9612. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Ffirstchild = v3
  9613. return next
  9614. }
  9615. func _build_node(tls *libc.TLS, parser TXML_Parser, src_node int32, dest uintptr, contpos uintptr, strpos uintptr) {
  9616. var cn int32
  9617. var dtd, src, v2, v3 uintptr
  9618. var i uint32
  9619. _, _, _, _, _, _ = cn, dtd, i, src, v2, v3
  9620. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  9621. (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Ftype1
  9622. (*TXML_Content)(unsafe.Pointer(dest)).Fquant = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fquant
  9623. if (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 == int32(_XML_CTYPE_NAME) {
  9624. (*TXML_Content)(unsafe.Pointer(dest)).Fname = *(*uintptr)(unsafe.Pointer(strpos))
  9625. src = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fname
  9626. for {
  9627. v3 = strpos
  9628. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9629. *(*uintptr)(unsafe.Pointer(v3))++
  9630. *(*TXML_Char)(unsafe.Pointer(v2)) = *(*TXML_Char)(unsafe.Pointer(src))
  9631. if !(*(*TXML_Char)(unsafe.Pointer(src)) != 0) {
  9632. break
  9633. }
  9634. src++
  9635. goto _1
  9636. _1:
  9637. }
  9638. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = uint32(0)
  9639. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = libc.UintptrFromInt32(0)
  9640. } else {
  9641. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = libc.Uint32FromInt32((*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fchildcnt)
  9642. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = *(*uintptr)(unsafe.Pointer(contpos))
  9643. *(*uintptr)(unsafe.Pointer(contpos)) += uintptr((*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren) * 32
  9644. i = uint32(0)
  9645. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Ffirstchild
  9646. for {
  9647. if !(i < (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren) {
  9648. break
  9649. }
  9650. _build_node(tls, parser, cn, (*TXML_Content)(unsafe.Pointer(dest)).Fchildren+uintptr(i)*32, contpos, strpos)
  9651. goto _4
  9652. _4:
  9653. ;
  9654. i++
  9655. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(cn)*32))).Fnextsib
  9656. }
  9657. (*TXML_Content)(unsafe.Pointer(dest)).Fname = libc.UintptrFromInt32(0)
  9658. }
  9659. }
  9660. func _build_model(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  9661. bp := tls.Alloc(16)
  9662. defer tls.Free(16)
  9663. var allocsize int32
  9664. var dtd, ret uintptr
  9665. var _ /* cpos at bp+0 */ uintptr
  9666. var _ /* str at bp+8 */ uintptr
  9667. _, _, _ = allocsize, dtd, ret
  9668. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  9669. allocsize = libc.Int32FromUint64(uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*libc.Uint64FromInt64(32) + uint64((*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen)*libc.Uint64FromInt64(1))
  9670. ret = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(allocsize))
  9671. if !(ret != 0) {
  9672. return libc.UintptrFromInt32(0)
  9673. }
  9674. *(*uintptr)(unsafe.Pointer(bp + 8)) = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*32
  9675. *(*uintptr)(unsafe.Pointer(bp)) = ret + 1*32
  9676. _build_node(tls, parser, 0, ret, bp, bp+8)
  9677. return ret
  9678. }
  9679. func _getElementType(tls *libc.TLS, parser TXML_Parser, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  9680. var dtd, name, ret uintptr
  9681. _, _, _ = dtd, name, ret
  9682. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  9683. name = _poolStoreString(tls, dtd+160, enc, ptr, end)
  9684. if !(name != 0) {
  9685. return libc.UintptrFromInt32(0)
  9686. }
  9687. ret = _lookup(tls, parser, dtd+40, name, uint64(40))
  9688. if !(ret != 0) {
  9689. return libc.UintptrFromInt32(0)
  9690. }
  9691. if (*TELEMENT_TYPE)(unsafe.Pointer(ret)).Fname != name {
  9692. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  9693. } else {
  9694. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  9695. if !(_setElementTypePrefix(tls, parser, ret) != 0) {
  9696. return libc.UintptrFromInt32(0)
  9697. }
  9698. }
  9699. return ret
  9700. }
  9701. func _copyString(tls *libc.TLS, s uintptr, memsuite uintptr) (r uintptr) {
  9702. var charsRequired int32
  9703. var result uintptr
  9704. _, _ = charsRequired, result
  9705. charsRequired = 0
  9706. /* First determine how long the string is */
  9707. for libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s + uintptr(charsRequired)))) != 0 {
  9708. charsRequired++
  9709. }
  9710. /* Include the terminator */
  9711. charsRequired++
  9712. /* Now allocate space for the copy */
  9713. result = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, libc.Uint64FromInt32(charsRequired)*uint64(1))
  9714. if result == libc.UintptrFromInt32(0) {
  9715. return libc.UintptrFromInt32(0)
  9716. }
  9717. /* Copy the original into place */
  9718. libc.Xmemcpy(tls, result, s, libc.Uint64FromInt32(charsRequired)*uint64(1))
  9719. return result
  9720. }
  9721. const m_ASCII_41 = 52
  9722. const m_ASCII_51 = 53
  9723. const m_ASCII_61 = 54
  9724. const m_ASCII_71 = 55
  9725. const m_ASCII_AMP1 = 38
  9726. const m_ASCII_APOS1 = 39
  9727. const m_ASCII_B1 = 66
  9728. const m_ASCII_COMMA1 = 0x2C
  9729. const m_ASCII_FF1 = 0x0C
  9730. const m_ASCII_GT1 = 62
  9731. const m_ASCII_HASH1 = 0x23
  9732. const m_ASCII_K1 = 0x4B
  9733. const m_ASCII_LPAREN1 = 0x28
  9734. const m_ASCII_LSQB1 = 91
  9735. const m_ASCII_LT1 = 60
  9736. const m_ASCII_MINUS1 = 45
  9737. const m_ASCII_N1 = 0x4E
  9738. const m_ASCII_PIPE1 = 0x7C
  9739. const m_ASCII_QUOT1 = 34
  9740. const m_ASCII_R1 = 0x52
  9741. const m_ASCII_RPAREN1 = 0x29
  9742. const m_ASCII_RSQB1 = 93
  9743. const m_ASCII_SEMI1 = 59
  9744. const m_ASCII_SLASH1 = 0x2F
  9745. const m_ASCII_SPACE1 = 32
  9746. const m_ASCII_TAB1 = 9
  9747. const m_ASCII_U1 = 85
  9748. const m_ASCII_UNDERSCORE1 = 95
  9749. const m_ASCII_Y1 = 0x59
  9750. const m_ASCII_Z1 = 90
  9751. const m_ASCII_b1 = 98
  9752. const m_ASCII_d1 = 100
  9753. const m_ASCII_f1 = 102
  9754. const m_ASCII_h1 = 0x68
  9755. const m_ASCII_i1 = 105
  9756. const m_ASCII_q1 = 113
  9757. const m_ASCII_u1 = 117
  9758. const m_ASCII_v1 = 118
  9759. const m_ASCII_w1 = 0x77
  9760. const m_ASCII_y1 = 121
  9761. const m_ASCII_z1 = 122
  9762. const m_ENCODING_MAX = 128
  9763. const m___bool_true_false_are_defined = 1
  9764. const m_bool = "_Bool"
  9765. const m_false = 0
  9766. const m_true = 1
  9767. const m_utf8_isName4 = "isNever"
  9768. const m_utf8_isNmstrt4 = "isNever"
  9769. var _namingBitmap = [320]uint32{
  9770. 8: uint32(0xFFFFFFFF),
  9771. 9: uint32(0xFFFFFFFF),
  9772. 10: uint32(0xFFFFFFFF),
  9773. 11: uint32(0xFFFFFFFF),
  9774. 12: uint32(0xFFFFFFFF),
  9775. 13: uint32(0xFFFFFFFF),
  9776. 14: uint32(0xFFFFFFFF),
  9777. 15: uint32(0xFFFFFFFF),
  9778. 17: uint32(0x04000000),
  9779. 18: uint32(0x87FFFFFE),
  9780. 19: uint32(0x07FFFFFE),
  9781. 22: uint32(0xFF7FFFFF),
  9782. 23: uint32(0xFF7FFFFF),
  9783. 24: uint32(0xFFFFFFFF),
  9784. 25: uint32(0x7FF3FFFF),
  9785. 26: uint32(0xFFFFFDFE),
  9786. 27: uint32(0x7FFFFFFF),
  9787. 28: uint32(0xFFFFFFFF),
  9788. 29: uint32(0xFFFFFFFF),
  9789. 30: uint32(0xFFFFE00F),
  9790. 31: uint32(0xFC31FFFF),
  9791. 32: uint32(0x00FFFFFF),
  9792. 34: uint32(0xFFFF0000),
  9793. 35: uint32(0xFFFFFFFF),
  9794. 36: uint32(0xFFFFFFFF),
  9795. 37: uint32(0xF80001FF),
  9796. 38: uint32(0x00000003),
  9797. 44: uint32(0xFFFFD740),
  9798. 45: uint32(0xFFFFFFFB),
  9799. 46: uint32(0x547F7FFF),
  9800. 47: uint32(0x000FFFFD),
  9801. 48: uint32(0xFFFFDFFE),
  9802. 49: uint32(0xFFFFFFFF),
  9803. 50: uint32(0xDFFEFFFF),
  9804. 51: uint32(0xFFFFFFFF),
  9805. 52: uint32(0xFFFF0003),
  9806. 53: uint32(0xFFFFFFFF),
  9807. 54: uint32(0xFFFF199F),
  9808. 55: uint32(0x033FCFFF),
  9809. 57: uint32(0xFFFE0000),
  9810. 58: uint32(0x027FFFFF),
  9811. 59: uint32(0xFFFFFFFE),
  9812. 60: uint32(0x0000007F),
  9813. 62: uint32(0xFFFF0000),
  9814. 63: uint32(0x000707FF),
  9815. 65: uint32(0x07FFFFFE),
  9816. 66: uint32(0x000007FE),
  9817. 67: uint32(0xFFFE0000),
  9818. 68: uint32(0xFFFFFFFF),
  9819. 69: uint32(0x7CFFFFFF),
  9820. 70: uint32(0x002F7FFF),
  9821. 71: uint32(0x00000060),
  9822. 72: uint32(0xFFFFFFE0),
  9823. 73: uint32(0x23FFFFFF),
  9824. 74: uint32(0xFF000000),
  9825. 75: uint32(0x00000003),
  9826. 76: uint32(0xFFF99FE0),
  9827. 77: uint32(0x03C5FDFF),
  9828. 78: uint32(0xB0000000),
  9829. 79: uint32(0x00030003),
  9830. 80: uint32(0xFFF987E0),
  9831. 81: uint32(0x036DFDFF),
  9832. 82: uint32(0x5E000000),
  9833. 83: uint32(0x001C0000),
  9834. 84: uint32(0xFFFBAFE0),
  9835. 85: uint32(0x23EDFDFF),
  9836. 87: uint32(0x00000001),
  9837. 88: uint32(0xFFF99FE0),
  9838. 89: uint32(0x23CDFDFF),
  9839. 90: uint32(0xB0000000),
  9840. 91: uint32(0x00000003),
  9841. 92: uint32(0xD63DC7E0),
  9842. 93: uint32(0x03BFC718),
  9843. 96: uint32(0xFFFDDFE0),
  9844. 97: uint32(0x03EFFDFF),
  9845. 99: uint32(0x00000003),
  9846. 100: uint32(0xFFFDDFE0),
  9847. 101: uint32(0x03EFFDFF),
  9848. 102: uint32(0x40000000),
  9849. 103: uint32(0x00000003),
  9850. 104: uint32(0xFFFDDFE0),
  9851. 105: uint32(0x03FFFDFF),
  9852. 107: uint32(0x00000003),
  9853. 112: uint32(0xFFFFFFFE),
  9854. 113: uint32(0x000D7FFF),
  9855. 114: uint32(0x0000003F),
  9856. 116: uint32(0xFEF02596),
  9857. 117: uint32(0x200D6CAE),
  9858. 118: uint32(0x0000001F),
  9859. 122: uint32(0xFFFFFEFF),
  9860. 123: uint32(0x000003FF),
  9861. 133: uint32(0xFFFFFFFF),
  9862. 134: uint32(0xFFFF003F),
  9863. 135: uint32(0x007FFFFF),
  9864. 136: uint32(0x0007DAED),
  9865. 137: uint32(0x50000000),
  9866. 138: uint32(0x82315001),
  9867. 139: uint32(0x002C62AB),
  9868. 140: uint32(0x40000000),
  9869. 141: uint32(0xF580C900),
  9870. 142: uint32(0x00000007),
  9871. 143: uint32(0x02010800),
  9872. 144: uint32(0xFFFFFFFF),
  9873. 145: uint32(0xFFFFFFFF),
  9874. 146: uint32(0xFFFFFFFF),
  9875. 147: uint32(0xFFFFFFFF),
  9876. 148: uint32(0x0FFFFFFF),
  9877. 149: uint32(0xFFFFFFFF),
  9878. 150: uint32(0xFFFFFFFF),
  9879. 151: uint32(0x03FFFFFF),
  9880. 152: uint32(0x3F3FFFFF),
  9881. 153: uint32(0xFFFFFFFF),
  9882. 154: uint32(0xAAFF3F3F),
  9883. 155: uint32(0x3FFFFFFF),
  9884. 156: uint32(0xFFFFFFFF),
  9885. 157: uint32(0x5FDFFFFF),
  9886. 158: uint32(0x0FCF1FDC),
  9887. 159: uint32(0x1FDC1FFF),
  9888. 161: uint32(0x00004C40),
  9889. 164: uint32(0x00000007),
  9890. 168: uint32(0x00000080),
  9891. 169: uint32(0x000003FE),
  9892. 170: uint32(0xFFFFFFFE),
  9893. 171: uint32(0xFFFFFFFF),
  9894. 172: uint32(0x001FFFFF),
  9895. 173: uint32(0xFFFFFFFE),
  9896. 174: uint32(0xFFFFFFFF),
  9897. 175: uint32(0x07FFFFFF),
  9898. 176: uint32(0xFFFFFFE0),
  9899. 177: uint32(0x00001FFF),
  9900. 184: uint32(0xFFFFFFFF),
  9901. 185: uint32(0xFFFFFFFF),
  9902. 186: uint32(0xFFFFFFFF),
  9903. 187: uint32(0xFFFFFFFF),
  9904. 188: uint32(0xFFFFFFFF),
  9905. 189: uint32(0x0000003F),
  9906. 192: uint32(0xFFFFFFFF),
  9907. 193: uint32(0xFFFFFFFF),
  9908. 194: uint32(0xFFFFFFFF),
  9909. 195: uint32(0xFFFFFFFF),
  9910. 196: uint32(0xFFFFFFFF),
  9911. 197: uint32(0x0000000F),
  9912. 201: uint32(0x07FF6000),
  9913. 202: uint32(0x87FFFFFE),
  9914. 203: uint32(0x07FFFFFE),
  9915. 205: uint32(0x00800000),
  9916. 206: uint32(0xFF7FFFFF),
  9917. 207: uint32(0xFF7FFFFF),
  9918. 208: uint32(0x00FFFFFF),
  9919. 210: uint32(0xFFFF0000),
  9920. 211: uint32(0xFFFFFFFF),
  9921. 212: uint32(0xFFFFFFFF),
  9922. 213: uint32(0xF80001FF),
  9923. 214: uint32(0x00030003),
  9924. 216: uint32(0xFFFFFFFF),
  9925. 217: uint32(0xFFFFFFFF),
  9926. 218: uint32(0x0000003F),
  9927. 219: uint32(0x00000003),
  9928. 220: uint32(0xFFFFD7C0),
  9929. 221: uint32(0xFFFFFFFB),
  9930. 222: uint32(0x547F7FFF),
  9931. 223: uint32(0x000FFFFD),
  9932. 224: uint32(0xFFFFDFFE),
  9933. 225: uint32(0xFFFFFFFF),
  9934. 226: uint32(0xDFFEFFFF),
  9935. 227: uint32(0xFFFFFFFF),
  9936. 228: uint32(0xFFFF007B),
  9937. 229: uint32(0xFFFFFFFF),
  9938. 230: uint32(0xFFFF199F),
  9939. 231: uint32(0x033FCFFF),
  9940. 233: uint32(0xFFFE0000),
  9941. 234: uint32(0x027FFFFF),
  9942. 235: uint32(0xFFFFFFFE),
  9943. 236: uint32(0xFFFE007F),
  9944. 237: uint32(0xBBFFFFFB),
  9945. 238: uint32(0xFFFF0016),
  9946. 239: uint32(0x000707FF),
  9947. 241: uint32(0x07FFFFFE),
  9948. 242: uint32(0x0007FFFF),
  9949. 243: uint32(0xFFFF03FF),
  9950. 244: uint32(0xFFFFFFFF),
  9951. 245: uint32(0x7CFFFFFF),
  9952. 246: uint32(0xFFEF7FFF),
  9953. 247: uint32(0x03FF3DFF),
  9954. 248: uint32(0xFFFFFFEE),
  9955. 249: uint32(0xF3FFFFFF),
  9956. 250: uint32(0xFF1E3FFF),
  9957. 251: uint32(0x0000FFCF),
  9958. 252: uint32(0xFFF99FEE),
  9959. 253: uint32(0xD3C5FDFF),
  9960. 254: uint32(0xB080399F),
  9961. 255: uint32(0x0003FFCF),
  9962. 256: uint32(0xFFF987E4),
  9963. 257: uint32(0xD36DFDFF),
  9964. 258: uint32(0x5E003987),
  9965. 259: uint32(0x001FFFC0),
  9966. 260: uint32(0xFFFBAFEE),
  9967. 261: uint32(0xF3EDFDFF),
  9968. 262: uint32(0x00003BBF),
  9969. 263: uint32(0x0000FFC1),
  9970. 264: uint32(0xFFF99FEE),
  9971. 265: uint32(0xF3CDFDFF),
  9972. 266: uint32(0xB0C0398F),
  9973. 267: uint32(0x0000FFC3),
  9974. 268: uint32(0xD63DC7EC),
  9975. 269: uint32(0xC3BFC718),
  9976. 270: uint32(0x00803DC7),
  9977. 271: uint32(0x0000FF80),
  9978. 272: uint32(0xFFFDDFEE),
  9979. 273: uint32(0xC3EFFDFF),
  9980. 274: uint32(0x00603DDF),
  9981. 275: uint32(0x0000FFC3),
  9982. 276: uint32(0xFFFDDFEC),
  9983. 277: uint32(0xC3EFFDFF),
  9984. 278: uint32(0x40603DDF),
  9985. 279: uint32(0x0000FFC3),
  9986. 280: uint32(0xFFFDDFEC),
  9987. 281: uint32(0xC3FFFDFF),
  9988. 282: uint32(0x00803DCF),
  9989. 283: uint32(0x0000FFC3),
  9990. 288: uint32(0xFFFFFFFE),
  9991. 289: uint32(0x07FF7FFF),
  9992. 290: uint32(0x03FF7FFF),
  9993. 292: uint32(0xFEF02596),
  9994. 293: uint32(0x3BFF6CAE),
  9995. 294: uint32(0x03FF3F5F),
  9996. 296: uint32(0x03000000),
  9997. 297: uint32(0xC2A003FF),
  9998. 298: uint32(0xFFFFFEFF),
  9999. 299: uint32(0xFFFE03FF),
  10000. 300: uint32(0xFEBF0FDF),
  10001. 301: uint32(0x02FE3FFF),
  10002. 310: uint32(0x1FFF0000),
  10003. 311: uint32(0x00000002),
  10004. 312: uint32(0x000000A0),
  10005. 313: uint32(0x003EFFFE),
  10006. 314: uint32(0xFFFFFFFE),
  10007. 315: uint32(0xFFFFFFFF),
  10008. 316: uint32(0x661FFFFF),
  10009. 317: uint32(0xFFFFFFFE),
  10010. 318: uint32(0xFFFFFFFF),
  10011. 319: uint32(0x77FFFFFF),
  10012. }
  10013. var _nmstrtPages = [256]uint8{
  10014. 0: uint8(0x02),
  10015. 1: uint8(0x03),
  10016. 2: uint8(0x04),
  10017. 3: uint8(0x05),
  10018. 4: uint8(0x06),
  10019. 5: uint8(0x07),
  10020. 6: uint8(0x08),
  10021. 9: uint8(0x09),
  10022. 10: uint8(0x0A),
  10023. 11: uint8(0x0B),
  10024. 12: uint8(0x0C),
  10025. 13: uint8(0x0D),
  10026. 14: uint8(0x0E),
  10027. 15: uint8(0x0F),
  10028. 16: uint8(0x10),
  10029. 17: uint8(0x11),
  10030. 30: uint8(0x12),
  10031. 31: uint8(0x13),
  10032. 33: uint8(0x14),
  10033. 48: uint8(0x15),
  10034. 49: uint8(0x16),
  10035. 78: uint8(0x01),
  10036. 79: uint8(0x01),
  10037. 80: uint8(0x01),
  10038. 81: uint8(0x01),
  10039. 82: uint8(0x01),
  10040. 83: uint8(0x01),
  10041. 84: uint8(0x01),
  10042. 85: uint8(0x01),
  10043. 86: uint8(0x01),
  10044. 87: uint8(0x01),
  10045. 88: uint8(0x01),
  10046. 89: uint8(0x01),
  10047. 90: uint8(0x01),
  10048. 91: uint8(0x01),
  10049. 92: uint8(0x01),
  10050. 93: uint8(0x01),
  10051. 94: uint8(0x01),
  10052. 95: uint8(0x01),
  10053. 96: uint8(0x01),
  10054. 97: uint8(0x01),
  10055. 98: uint8(0x01),
  10056. 99: uint8(0x01),
  10057. 100: uint8(0x01),
  10058. 101: uint8(0x01),
  10059. 102: uint8(0x01),
  10060. 103: uint8(0x01),
  10061. 104: uint8(0x01),
  10062. 105: uint8(0x01),
  10063. 106: uint8(0x01),
  10064. 107: uint8(0x01),
  10065. 108: uint8(0x01),
  10066. 109: uint8(0x01),
  10067. 110: uint8(0x01),
  10068. 111: uint8(0x01),
  10069. 112: uint8(0x01),
  10070. 113: uint8(0x01),
  10071. 114: uint8(0x01),
  10072. 115: uint8(0x01),
  10073. 116: uint8(0x01),
  10074. 117: uint8(0x01),
  10075. 118: uint8(0x01),
  10076. 119: uint8(0x01),
  10077. 120: uint8(0x01),
  10078. 121: uint8(0x01),
  10079. 122: uint8(0x01),
  10080. 123: uint8(0x01),
  10081. 124: uint8(0x01),
  10082. 125: uint8(0x01),
  10083. 126: uint8(0x01),
  10084. 127: uint8(0x01),
  10085. 128: uint8(0x01),
  10086. 129: uint8(0x01),
  10087. 130: uint8(0x01),
  10088. 131: uint8(0x01),
  10089. 132: uint8(0x01),
  10090. 133: uint8(0x01),
  10091. 134: uint8(0x01),
  10092. 135: uint8(0x01),
  10093. 136: uint8(0x01),
  10094. 137: uint8(0x01),
  10095. 138: uint8(0x01),
  10096. 139: uint8(0x01),
  10097. 140: uint8(0x01),
  10098. 141: uint8(0x01),
  10099. 142: uint8(0x01),
  10100. 143: uint8(0x01),
  10101. 144: uint8(0x01),
  10102. 145: uint8(0x01),
  10103. 146: uint8(0x01),
  10104. 147: uint8(0x01),
  10105. 148: uint8(0x01),
  10106. 149: uint8(0x01),
  10107. 150: uint8(0x01),
  10108. 151: uint8(0x01),
  10109. 152: uint8(0x01),
  10110. 153: uint8(0x01),
  10111. 154: uint8(0x01),
  10112. 155: uint8(0x01),
  10113. 156: uint8(0x01),
  10114. 157: uint8(0x01),
  10115. 158: uint8(0x01),
  10116. 159: uint8(0x17),
  10117. 172: uint8(0x01),
  10118. 173: uint8(0x01),
  10119. 174: uint8(0x01),
  10120. 175: uint8(0x01),
  10121. 176: uint8(0x01),
  10122. 177: uint8(0x01),
  10123. 178: uint8(0x01),
  10124. 179: uint8(0x01),
  10125. 180: uint8(0x01),
  10126. 181: uint8(0x01),
  10127. 182: uint8(0x01),
  10128. 183: uint8(0x01),
  10129. 184: uint8(0x01),
  10130. 185: uint8(0x01),
  10131. 186: uint8(0x01),
  10132. 187: uint8(0x01),
  10133. 188: uint8(0x01),
  10134. 189: uint8(0x01),
  10135. 190: uint8(0x01),
  10136. 191: uint8(0x01),
  10137. 192: uint8(0x01),
  10138. 193: uint8(0x01),
  10139. 194: uint8(0x01),
  10140. 195: uint8(0x01),
  10141. 196: uint8(0x01),
  10142. 197: uint8(0x01),
  10143. 198: uint8(0x01),
  10144. 199: uint8(0x01),
  10145. 200: uint8(0x01),
  10146. 201: uint8(0x01),
  10147. 202: uint8(0x01),
  10148. 203: uint8(0x01),
  10149. 204: uint8(0x01),
  10150. 205: uint8(0x01),
  10151. 206: uint8(0x01),
  10152. 207: uint8(0x01),
  10153. 208: uint8(0x01),
  10154. 209: uint8(0x01),
  10155. 210: uint8(0x01),
  10156. 211: uint8(0x01),
  10157. 212: uint8(0x01),
  10158. 213: uint8(0x01),
  10159. 214: uint8(0x01),
  10160. 215: uint8(0x18),
  10161. }
  10162. var _namePages = [256]uint8{
  10163. 0: uint8(0x19),
  10164. 1: uint8(0x03),
  10165. 2: uint8(0x1A),
  10166. 3: uint8(0x1B),
  10167. 4: uint8(0x1C),
  10168. 5: uint8(0x1D),
  10169. 6: uint8(0x1E),
  10170. 9: uint8(0x1F),
  10171. 10: uint8(0x20),
  10172. 11: uint8(0x21),
  10173. 12: uint8(0x22),
  10174. 13: uint8(0x23),
  10175. 14: uint8(0x24),
  10176. 15: uint8(0x25),
  10177. 16: uint8(0x10),
  10178. 17: uint8(0x11),
  10179. 30: uint8(0x12),
  10180. 31: uint8(0x13),
  10181. 32: uint8(0x26),
  10182. 33: uint8(0x14),
  10183. 48: uint8(0x27),
  10184. 49: uint8(0x16),
  10185. 78: uint8(0x01),
  10186. 79: uint8(0x01),
  10187. 80: uint8(0x01),
  10188. 81: uint8(0x01),
  10189. 82: uint8(0x01),
  10190. 83: uint8(0x01),
  10191. 84: uint8(0x01),
  10192. 85: uint8(0x01),
  10193. 86: uint8(0x01),
  10194. 87: uint8(0x01),
  10195. 88: uint8(0x01),
  10196. 89: uint8(0x01),
  10197. 90: uint8(0x01),
  10198. 91: uint8(0x01),
  10199. 92: uint8(0x01),
  10200. 93: uint8(0x01),
  10201. 94: uint8(0x01),
  10202. 95: uint8(0x01),
  10203. 96: uint8(0x01),
  10204. 97: uint8(0x01),
  10205. 98: uint8(0x01),
  10206. 99: uint8(0x01),
  10207. 100: uint8(0x01),
  10208. 101: uint8(0x01),
  10209. 102: uint8(0x01),
  10210. 103: uint8(0x01),
  10211. 104: uint8(0x01),
  10212. 105: uint8(0x01),
  10213. 106: uint8(0x01),
  10214. 107: uint8(0x01),
  10215. 108: uint8(0x01),
  10216. 109: uint8(0x01),
  10217. 110: uint8(0x01),
  10218. 111: uint8(0x01),
  10219. 112: uint8(0x01),
  10220. 113: uint8(0x01),
  10221. 114: uint8(0x01),
  10222. 115: uint8(0x01),
  10223. 116: uint8(0x01),
  10224. 117: uint8(0x01),
  10225. 118: uint8(0x01),
  10226. 119: uint8(0x01),
  10227. 120: uint8(0x01),
  10228. 121: uint8(0x01),
  10229. 122: uint8(0x01),
  10230. 123: uint8(0x01),
  10231. 124: uint8(0x01),
  10232. 125: uint8(0x01),
  10233. 126: uint8(0x01),
  10234. 127: uint8(0x01),
  10235. 128: uint8(0x01),
  10236. 129: uint8(0x01),
  10237. 130: uint8(0x01),
  10238. 131: uint8(0x01),
  10239. 132: uint8(0x01),
  10240. 133: uint8(0x01),
  10241. 134: uint8(0x01),
  10242. 135: uint8(0x01),
  10243. 136: uint8(0x01),
  10244. 137: uint8(0x01),
  10245. 138: uint8(0x01),
  10246. 139: uint8(0x01),
  10247. 140: uint8(0x01),
  10248. 141: uint8(0x01),
  10249. 142: uint8(0x01),
  10250. 143: uint8(0x01),
  10251. 144: uint8(0x01),
  10252. 145: uint8(0x01),
  10253. 146: uint8(0x01),
  10254. 147: uint8(0x01),
  10255. 148: uint8(0x01),
  10256. 149: uint8(0x01),
  10257. 150: uint8(0x01),
  10258. 151: uint8(0x01),
  10259. 152: uint8(0x01),
  10260. 153: uint8(0x01),
  10261. 154: uint8(0x01),
  10262. 155: uint8(0x01),
  10263. 156: uint8(0x01),
  10264. 157: uint8(0x01),
  10265. 158: uint8(0x01),
  10266. 159: uint8(0x17),
  10267. 172: uint8(0x01),
  10268. 173: uint8(0x01),
  10269. 174: uint8(0x01),
  10270. 175: uint8(0x01),
  10271. 176: uint8(0x01),
  10272. 177: uint8(0x01),
  10273. 178: uint8(0x01),
  10274. 179: uint8(0x01),
  10275. 180: uint8(0x01),
  10276. 181: uint8(0x01),
  10277. 182: uint8(0x01),
  10278. 183: uint8(0x01),
  10279. 184: uint8(0x01),
  10280. 185: uint8(0x01),
  10281. 186: uint8(0x01),
  10282. 187: uint8(0x01),
  10283. 188: uint8(0x01),
  10284. 189: uint8(0x01),
  10285. 190: uint8(0x01),
  10286. 191: uint8(0x01),
  10287. 192: uint8(0x01),
  10288. 193: uint8(0x01),
  10289. 194: uint8(0x01),
  10290. 195: uint8(0x01),
  10291. 196: uint8(0x01),
  10292. 197: uint8(0x01),
  10293. 198: uint8(0x01),
  10294. 199: uint8(0x01),
  10295. 200: uint8(0x01),
  10296. 201: uint8(0x01),
  10297. 202: uint8(0x01),
  10298. 203: uint8(0x01),
  10299. 204: uint8(0x01),
  10300. 205: uint8(0x01),
  10301. 206: uint8(0x01),
  10302. 207: uint8(0x01),
  10303. 208: uint8(0x01),
  10304. 209: uint8(0x01),
  10305. 210: uint8(0x01),
  10306. 211: uint8(0x01),
  10307. 212: uint8(0x01),
  10308. 213: uint8(0x01),
  10309. 214: uint8(0x01),
  10310. 215: uint8(0x18),
  10311. }
  10312. /* A 2 byte UTF-8 representation splits the characters 11 bits between
  10313. the bottom 5 and 6 bits of the bytes. We need 8 bits to index into
  10314. pages, 3 bits to add to that index and 5 bits to generate the mask.
  10315. */
  10316. /* A 3 byte UTF-8 representation splits the characters 16 bits between
  10317. the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index
  10318. into pages, 3 bits to add to that index and 5 bits to generate the
  10319. mask.
  10320. */
  10321. /* Detection of invalid UTF-8 sequences is based on Table 3.1B
  10322. of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/
  10323. with the additional restriction of not allowing the Unicode
  10324. code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE).
  10325. Implementation details:
  10326. (A & 0x80) == 0 means A < 0x80
  10327. and
  10328. (A & 0xC0) == 0xC0 means A > 0xBF
  10329. */
  10330. func _isNever(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  10331. _ = enc
  10332. _ = p
  10333. return 0
  10334. }
  10335. func _utf8_isName2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  10336. _ = enc
  10337. return libc.Int32FromUint32(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p)))>>int32(2)&int32(7)])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p)))&int32(3)<<int32(1)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))>>int32(5)&int32(1)] & (libc.Uint32FromUint32(1) << (libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) & libc.Int32FromInt32(0x1F))))
  10338. }
  10339. func _utf8_isName3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  10340. _ = enc
  10341. return libc.Int32FromUint32(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p)))&int32(0xF)<<int32(4)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))>>int32(2)&int32(0xF)])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(3)<<int32(1)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))>>int32(5)&int32(1)] & (libc.Uint32FromUint32(1) << (libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) & libc.Int32FromInt32(0x1F))))
  10342. }
  10343. func _utf8_isNmstrt2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  10344. _ = enc
  10345. return libc.Int32FromUint32(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p)))>>int32(2)&int32(7)])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p)))&int32(3)<<int32(1)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))>>int32(5)&int32(1)] & (libc.Uint32FromUint32(1) << (libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) & libc.Int32FromInt32(0x1F))))
  10346. }
  10347. func _utf8_isNmstrt3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  10348. _ = enc
  10349. return libc.Int32FromUint32(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p)))&int32(0xF)<<int32(4)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))>>int32(2)&int32(0xF)])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(3)<<int32(1)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))>>int32(5)&int32(1)] & (libc.Uint32FromUint32(1) << (libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) & libc.Int32FromInt32(0x1F))))
  10350. }
  10351. func _utf8_isInvalid2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  10352. _ = enc
  10353. return libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) < int32(0xC2) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0 || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  10354. }
  10355. func _utf8_isInvalid3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  10356. var v1, v3, v4 int32
  10357. var v2, v5, v6 bool
  10358. _, _, _, _, _, _ = v1, v2, v3, v4, v5, v6
  10359. _ = enc
  10360. if v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0x80) == 0; !v2 {
  10361. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xEF) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) == int32(0xBF) {
  10362. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) > int32(0xBD))
  10363. } else {
  10364. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0xC0) == int32(0xC0))
  10365. }
  10366. }
  10367. if v6 = v2 || v1 != 0; !v6 {
  10368. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xE0) {
  10369. v3 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0xA0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  10370. } else {
  10371. if v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v5 {
  10372. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xED) {
  10373. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x9F))
  10374. } else {
  10375. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  10376. }
  10377. }
  10378. v3 = libc.BoolInt32(v5 || v4 != 0)
  10379. }
  10380. }
  10381. return libc.BoolInt32(v6 || v3 != 0)
  10382. }
  10383. func _utf8_isInvalid4(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  10384. var v1, v2 int32
  10385. var v3, v4 bool
  10386. _, _, _, _ = v1, v2, v3, v4
  10387. _ = enc
  10388. if v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 3)))&int32(0x80) == 0 || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 3)))&int32(0xC0) == int32(0xC0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0x80) == 0 || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0xC0) == int32(0xC0); !v4 {
  10389. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF0) {
  10390. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0x90) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  10391. } else {
  10392. if v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v3 {
  10393. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF4) {
  10394. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x8F))
  10395. } else {
  10396. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  10397. }
  10398. }
  10399. v1 = libc.BoolInt32(v3 || v2 != 0)
  10400. }
  10401. }
  10402. return libc.BoolInt32(v4 || v1 != 0)
  10403. }
  10404. type Tnormal_encoding = struct {
  10405. Fenc TENCODING
  10406. Ftype1 [256]uint8
  10407. FisName2 uintptr
  10408. FisName3 uintptr
  10409. FisName4 uintptr
  10410. FisNmstrt2 uintptr
  10411. FisNmstrt3 uintptr
  10412. FisNmstrt4 uintptr
  10413. FisInvalid2 uintptr
  10414. FisInvalid3 uintptr
  10415. FisInvalid4 uintptr
  10416. }
  10417. const _BT_NONXML = 0
  10418. const _BT_MALFORM = 1
  10419. const _BT_LT = 2
  10420. const _BT_AMP = 3
  10421. const _BT_RSQB = 4
  10422. const _BT_LEAD2 = 5
  10423. const _BT_LEAD3 = 6
  10424. const _BT_LEAD4 = 7
  10425. const _BT_TRAIL = 8
  10426. const _BT_CR = 9
  10427. const _BT_LF = 10
  10428. const _BT_GT = 11
  10429. const _BT_QUOT = 12
  10430. const _BT_APOS = 13
  10431. const _BT_EQUALS = 14
  10432. const _BT_QUEST = 15
  10433. const _BT_EXCL = 16
  10434. const _BT_SOL = 17
  10435. const _BT_SEMI = 18
  10436. const _BT_NUM = 19
  10437. const _BT_LSQB = 20
  10438. const _BT_S = 21
  10439. const _BT_NMSTRT = 22
  10440. const _BT_COLON = 23
  10441. const _BT_HEX = 24
  10442. const _BT_DIGIT = 25
  10443. const _BT_NAME = 26
  10444. const _BT_MINUS = 27
  10445. const _BT_OTHER = 28
  10446. const _BT_NONASCII = 29
  10447. const _BT_PERCNT = 30
  10448. const _BT_LPAR = 31
  10449. const _BT_RPAR = 32
  10450. const _BT_AST = 33
  10451. const _BT_PLUS = 34
  10452. const _BT_COMMA = 35
  10453. const _BT_VERBAR = 36
  10454. /*
  10455. __ __ _
  10456. ___\ \/ /_ __ __ _| |_
  10457. / _ \\ /| '_ \ / _` | __|
  10458. | __// \| |_) | (_| | |_
  10459. \___/_/\_\ .__/ \__,_|\__|
  10460. |_| XML parser
  10461. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  10462. Copyright (c) 2000-2017 Expat development team
  10463. Licensed under the MIT license:
  10464. Permission is hereby granted, free of charge, to any person obtaining
  10465. a copy of this software and associated documentation files (the
  10466. "Software"), to deal in the Software without restriction, including
  10467. without limitation the rights to use, copy, modify, merge, publish,
  10468. distribute, sublicense, and/or sell copies of the Software, and to permit
  10469. persons to whom the Software is furnished to do so, subject to the
  10470. following conditions:
  10471. The above copyright notice and this permission notice shall be included
  10472. in all copies or substantial portions of the Software.
  10473. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  10474. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  10475. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  10476. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  10477. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  10478. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  10479. USE OR OTHER DEALINGS IN THE SOFTWARE.
  10480. */
  10481. /* minimum bytes per character */
  10482. /* c is an ASCII character */
  10483. /* This file is included!
  10484. __ __ _
  10485. ___\ \/ /_ __ __ _| |_
  10486. / _ \\ /| '_ \ / _` | __|
  10487. | __// \| |_) | (_| | |_
  10488. \___/_/\_\ .__/ \__,_|\__|
  10489. |_| XML parser
  10490. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  10491. Copyright (c) 2000-2017 Expat development team
  10492. Licensed under the MIT license:
  10493. Permission is hereby granted, free of charge, to any person obtaining
  10494. a copy of this software and associated documentation files (the
  10495. "Software"), to deal in the Software without restriction, including
  10496. without limitation the rights to use, copy, modify, merge, publish,
  10497. distribute, sublicense, and/or sell copies of the Software, and to permit
  10498. persons to whom the Software is furnished to do so, subject to the
  10499. following conditions:
  10500. The above copyright notice and this permission notice shall be included
  10501. in all copies or substantial portions of the Software.
  10502. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  10503. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  10504. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  10505. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  10506. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  10507. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  10508. USE OR OTHER DEALINGS IN THE SOFTWARE.
  10509. */
  10510. /* ptr points to character following "<!-" */
  10511. func _normal_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  10512. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  10513. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_MINUS1)) {
  10514. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10515. return m_XML_TOK_INVALID
  10516. }
  10517. ptr += uintptr(1)
  10518. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  10519. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  10520. case int32(_BT_LEAD2):
  10521. if int64(end)-int64(ptr) < int64(2) {
  10522. return -int32(2)
  10523. }
  10524. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  10525. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10526. return m_XML_TOK_INVALID
  10527. }
  10528. ptr += uintptr(2)
  10529. case int32(_BT_LEAD3):
  10530. if int64(end)-int64(ptr) < int64(3) {
  10531. return -int32(2)
  10532. }
  10533. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  10534. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10535. return m_XML_TOK_INVALID
  10536. }
  10537. ptr += uintptr(3)
  10538. case int32(_BT_LEAD4):
  10539. if int64(end)-int64(ptr) < int64(4) {
  10540. return -int32(2)
  10541. }
  10542. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  10543. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10544. return m_XML_TOK_INVALID
  10545. }
  10546. ptr += uintptr(4)
  10547. case int32(_BT_NONXML):
  10548. fallthrough
  10549. case int32(_BT_MALFORM):
  10550. fallthrough
  10551. case int32(_BT_TRAIL):
  10552. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10553. return m_XML_TOK_INVALID
  10554. case int32(_BT_MINUS):
  10555. ptr += uintptr(1)
  10556. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  10557. return -int32(1)
  10558. }
  10559. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  10560. ptr += uintptr(1)
  10561. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  10562. return -int32(1)
  10563. }
  10564. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  10565. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10566. return m_XML_TOK_INVALID
  10567. }
  10568. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  10569. return int32(m_XML_TOK_COMMENT)
  10570. }
  10571. default:
  10572. ptr += uintptr(1)
  10573. break
  10574. }
  10575. }
  10576. }
  10577. return -int32(1)
  10578. }
  10579. /* ptr points to character following "<!" */
  10580. func _normal_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  10581. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  10582. return -int32(1)
  10583. }
  10584. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  10585. case int32(_BT_MINUS):
  10586. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  10587. case int32(_BT_LSQB):
  10588. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  10589. return int32(m_XML_TOK_COND_SECT_OPEN)
  10590. case int32(_BT_NMSTRT):
  10591. fallthrough
  10592. case int32(_BT_HEX):
  10593. ptr += uintptr(1)
  10594. default:
  10595. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10596. return m_XML_TOK_INVALID
  10597. }
  10598. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  10599. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  10600. case int32(_BT_PERCNT):
  10601. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))) {
  10602. return -int32(1)
  10603. }
  10604. /* don't allow <!ENTITY% foo "whatever"> */
  10605. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1))))))) {
  10606. case int32(_BT_S):
  10607. fallthrough
  10608. case int32(_BT_CR):
  10609. fallthrough
  10610. case int32(_BT_LF):
  10611. fallthrough
  10612. case int32(_BT_PERCNT):
  10613. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10614. return m_XML_TOK_INVALID
  10615. }
  10616. /* fall through */
  10617. fallthrough
  10618. case int32(_BT_S):
  10619. fallthrough
  10620. case int32(_BT_CR):
  10621. fallthrough
  10622. case int32(_BT_LF):
  10623. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10624. return int32(m_XML_TOK_DECL_OPEN)
  10625. case int32(_BT_NMSTRT):
  10626. fallthrough
  10627. case int32(_BT_HEX):
  10628. ptr += uintptr(1)
  10629. default:
  10630. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10631. return m_XML_TOK_INVALID
  10632. }
  10633. }
  10634. return -int32(1)
  10635. }
  10636. func _normal_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  10637. var upper int32
  10638. _ = upper
  10639. upper = 0
  10640. _ = enc
  10641. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  10642. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(3)) {
  10643. return int32(1)
  10644. }
  10645. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  10646. case int32(m_ASCII_x):
  10647. case int32(m_ASCII_X):
  10648. upper = int32(1)
  10649. default:
  10650. return int32(1)
  10651. }
  10652. ptr += uintptr(1)
  10653. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  10654. case int32(m_ASCII_m):
  10655. case int32(m_ASCII_M):
  10656. upper = int32(1)
  10657. default:
  10658. return int32(1)
  10659. }
  10660. ptr += uintptr(1)
  10661. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  10662. case int32(m_ASCII_l):
  10663. case int32(m_ASCII_L):
  10664. upper = int32(1)
  10665. default:
  10666. return int32(1)
  10667. }
  10668. if upper != 0 {
  10669. return 0
  10670. }
  10671. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  10672. return int32(1)
  10673. }
  10674. /* ptr points to character following "<?" */
  10675. func _normal_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  10676. bp := tls.Alloc(16)
  10677. defer tls.Free(16)
  10678. var target uintptr
  10679. var _ /* tok at bp+0 */ int32
  10680. _ = target
  10681. target = ptr
  10682. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  10683. return -int32(1)
  10684. }
  10685. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  10686. case int32(_BT_NONASCII):
  10687. if !(libc.Int32FromInt32(0) != 0) {
  10688. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10689. return m_XML_TOK_INVALID
  10690. } /* fall through */
  10691. fallthrough
  10692. case int32(_BT_NMSTRT):
  10693. fallthrough
  10694. case int32(_BT_HEX):
  10695. ptr += uintptr(1)
  10696. case int32(_BT_LEAD2):
  10697. if int64(end)-int64(ptr) < int64(2) {
  10698. return -int32(2)
  10699. }
  10700. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  10701. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10702. return m_XML_TOK_INVALID
  10703. }
  10704. ptr += uintptr(2)
  10705. case int32(_BT_LEAD3):
  10706. if int64(end)-int64(ptr) < int64(3) {
  10707. return -int32(2)
  10708. }
  10709. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  10710. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10711. return m_XML_TOK_INVALID
  10712. }
  10713. ptr += uintptr(3)
  10714. case int32(_BT_LEAD4):
  10715. if int64(end)-int64(ptr) < int64(4) {
  10716. return -int32(2)
  10717. }
  10718. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  10719. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10720. return m_XML_TOK_INVALID
  10721. }
  10722. ptr += uintptr(4)
  10723. default:
  10724. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10725. return m_XML_TOK_INVALID
  10726. }
  10727. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  10728. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  10729. case int32(_BT_NONASCII):
  10730. if !(libc.Int32FromInt32(0) != 0) {
  10731. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10732. return m_XML_TOK_INVALID
  10733. } /* fall through */
  10734. fallthrough
  10735. case int32(_BT_NMSTRT):
  10736. fallthrough
  10737. case int32(_BT_HEX):
  10738. fallthrough
  10739. case int32(_BT_DIGIT):
  10740. fallthrough
  10741. case int32(_BT_NAME):
  10742. fallthrough
  10743. case int32(_BT_MINUS):
  10744. ptr += uintptr(1)
  10745. case int32(_BT_LEAD2):
  10746. if int64(end)-int64(ptr) < int64(2) {
  10747. return -int32(2)
  10748. }
  10749. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  10750. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10751. return m_XML_TOK_INVALID
  10752. }
  10753. ptr += uintptr(2)
  10754. case int32(_BT_LEAD3):
  10755. if int64(end)-int64(ptr) < int64(3) {
  10756. return -int32(2)
  10757. }
  10758. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  10759. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10760. return m_XML_TOK_INVALID
  10761. }
  10762. ptr += uintptr(3)
  10763. case int32(_BT_LEAD4):
  10764. if int64(end)-int64(ptr) < int64(4) {
  10765. return -int32(2)
  10766. }
  10767. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  10768. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10769. return m_XML_TOK_INVALID
  10770. }
  10771. ptr += uintptr(4)
  10772. case int32(_BT_S):
  10773. fallthrough
  10774. case int32(_BT_CR):
  10775. fallthrough
  10776. case int32(_BT_LF):
  10777. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  10778. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10779. return m_XML_TOK_INVALID
  10780. }
  10781. ptr += uintptr(1)
  10782. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  10783. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  10784. case int32(_BT_LEAD2):
  10785. if int64(end)-int64(ptr) < int64(2) {
  10786. return -int32(2)
  10787. }
  10788. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  10789. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10790. return m_XML_TOK_INVALID
  10791. }
  10792. ptr += uintptr(2)
  10793. case int32(_BT_LEAD3):
  10794. if int64(end)-int64(ptr) < int64(3) {
  10795. return -int32(2)
  10796. }
  10797. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  10798. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10799. return m_XML_TOK_INVALID
  10800. }
  10801. ptr += uintptr(3)
  10802. case int32(_BT_LEAD4):
  10803. if int64(end)-int64(ptr) < int64(4) {
  10804. return -int32(2)
  10805. }
  10806. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  10807. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10808. return m_XML_TOK_INVALID
  10809. }
  10810. ptr += uintptr(4)
  10811. case int32(_BT_NONXML):
  10812. fallthrough
  10813. case int32(_BT_MALFORM):
  10814. fallthrough
  10815. case int32(_BT_TRAIL):
  10816. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10817. return m_XML_TOK_INVALID
  10818. case int32(_BT_QUEST):
  10819. ptr += uintptr(1)
  10820. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  10821. return -int32(1)
  10822. }
  10823. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  10824. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  10825. return *(*int32)(unsafe.Pointer(bp))
  10826. }
  10827. default:
  10828. ptr += uintptr(1)
  10829. break
  10830. }
  10831. }
  10832. return -int32(1)
  10833. case int32(_BT_QUEST):
  10834. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  10835. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10836. return m_XML_TOK_INVALID
  10837. }
  10838. ptr += uintptr(1)
  10839. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  10840. return -int32(1)
  10841. }
  10842. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  10843. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  10844. return *(*int32)(unsafe.Pointer(bp))
  10845. }
  10846. /* fall through */
  10847. fallthrough
  10848. default:
  10849. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10850. return m_XML_TOK_INVALID
  10851. }
  10852. }
  10853. return -int32(1)
  10854. }
  10855. func _normal_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  10856. var i int32
  10857. _ = i
  10858. _ = enc
  10859. /* CDATA[ */
  10860. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(1))) {
  10861. return -int32(1)
  10862. }
  10863. i = 0
  10864. for {
  10865. if !(i < int32(6)) {
  10866. break
  10867. }
  10868. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromUint8(_CDATA_LSQB[i])) {
  10869. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10870. return m_XML_TOK_INVALID
  10871. }
  10872. goto _1
  10873. _1:
  10874. ;
  10875. i++
  10876. ptr += uintptr(1)
  10877. }
  10878. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10879. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  10880. }
  10881. var _CDATA_LSQB = [6]uint8{
  10882. 0: uint8(m_ASCII_C),
  10883. 1: uint8(m_ASCII_D),
  10884. 2: uint8(m_ASCII_A),
  10885. 3: uint8(m_ASCII_T),
  10886. 4: uint8(m_ASCII_A),
  10887. 5: uint8(m_ASCII_LSQB1),
  10888. }
  10889. func _normal_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  10890. var n Tsize_t
  10891. _ = n
  10892. if ptr >= end {
  10893. return -int32(4)
  10894. }
  10895. if int32(1) > int32(1) {
  10896. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  10897. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  10898. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  10899. if n == uint64(0) {
  10900. return -int32(1)
  10901. }
  10902. end = ptr + uintptr(n)
  10903. }
  10904. }
  10905. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  10906. case int32(_BT_RSQB):
  10907. ptr += uintptr(1)
  10908. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  10909. return -int32(1)
  10910. }
  10911. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  10912. break
  10913. }
  10914. ptr += uintptr(1)
  10915. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  10916. return -int32(1)
  10917. }
  10918. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  10919. ptr -= uintptr(1)
  10920. break
  10921. }
  10922. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  10923. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  10924. case int32(_BT_CR):
  10925. ptr += uintptr(1)
  10926. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  10927. return -int32(1)
  10928. }
  10929. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  10930. ptr += uintptr(1)
  10931. }
  10932. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10933. return int32(m_XML_TOK_DATA_NEWLINE)
  10934. case int32(_BT_LF):
  10935. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  10936. return int32(m_XML_TOK_DATA_NEWLINE)
  10937. case int32(_BT_LEAD2):
  10938. if int64(end)-int64(ptr) < int64(2) {
  10939. return -int32(2)
  10940. }
  10941. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  10942. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10943. return m_XML_TOK_INVALID
  10944. }
  10945. ptr += uintptr(2)
  10946. case int32(_BT_LEAD3):
  10947. if int64(end)-int64(ptr) < int64(3) {
  10948. return -int32(2)
  10949. }
  10950. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  10951. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10952. return m_XML_TOK_INVALID
  10953. }
  10954. ptr += uintptr(3)
  10955. case int32(_BT_LEAD4):
  10956. if int64(end)-int64(ptr) < int64(4) {
  10957. return -int32(2)
  10958. }
  10959. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  10960. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10961. return m_XML_TOK_INVALID
  10962. }
  10963. ptr += uintptr(4)
  10964. case int32(_BT_NONXML):
  10965. fallthrough
  10966. case int32(_BT_MALFORM):
  10967. fallthrough
  10968. case int32(_BT_TRAIL):
  10969. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10970. return m_XML_TOK_INVALID
  10971. default:
  10972. ptr += uintptr(1)
  10973. break
  10974. }
  10975. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  10976. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  10977. case int32(_BT_LEAD2):
  10978. if int64(end)-int64(ptr) < int64(2) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  10979. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10980. return int32(m_XML_TOK_DATA_CHARS)
  10981. }
  10982. ptr += uintptr(2)
  10983. case int32(_BT_LEAD3):
  10984. if int64(end)-int64(ptr) < int64(3) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  10985. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10986. return int32(m_XML_TOK_DATA_CHARS)
  10987. }
  10988. ptr += uintptr(3)
  10989. case int32(_BT_LEAD4):
  10990. if int64(end)-int64(ptr) < int64(4) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  10991. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10992. return int32(m_XML_TOK_DATA_CHARS)
  10993. }
  10994. ptr += uintptr(4)
  10995. case int32(_BT_NONXML):
  10996. fallthrough
  10997. case int32(_BT_MALFORM):
  10998. fallthrough
  10999. case int32(_BT_TRAIL):
  11000. fallthrough
  11001. case int32(_BT_CR):
  11002. fallthrough
  11003. case int32(_BT_LF):
  11004. fallthrough
  11005. case int32(_BT_RSQB):
  11006. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11007. return int32(m_XML_TOK_DATA_CHARS)
  11008. default:
  11009. ptr += uintptr(1)
  11010. break
  11011. }
  11012. }
  11013. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11014. return int32(m_XML_TOK_DATA_CHARS)
  11015. }
  11016. /* ptr points to character following "</" */
  11017. func _normal_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  11018. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11019. return -int32(1)
  11020. }
  11021. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11022. case int32(_BT_NONASCII):
  11023. if !(libc.Int32FromInt32(0) != 0) {
  11024. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11025. return m_XML_TOK_INVALID
  11026. } /* fall through */
  11027. fallthrough
  11028. case int32(_BT_NMSTRT):
  11029. fallthrough
  11030. case int32(_BT_HEX):
  11031. ptr += uintptr(1)
  11032. case int32(_BT_LEAD2):
  11033. if int64(end)-int64(ptr) < int64(2) {
  11034. return -int32(2)
  11035. }
  11036. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  11037. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11038. return m_XML_TOK_INVALID
  11039. }
  11040. ptr += uintptr(2)
  11041. case int32(_BT_LEAD3):
  11042. if int64(end)-int64(ptr) < int64(3) {
  11043. return -int32(2)
  11044. }
  11045. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  11046. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11047. return m_XML_TOK_INVALID
  11048. }
  11049. ptr += uintptr(3)
  11050. case int32(_BT_LEAD4):
  11051. if int64(end)-int64(ptr) < int64(4) {
  11052. return -int32(2)
  11053. }
  11054. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  11055. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11056. return m_XML_TOK_INVALID
  11057. }
  11058. ptr += uintptr(4)
  11059. default:
  11060. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11061. return m_XML_TOK_INVALID
  11062. }
  11063. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  11064. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11065. case int32(_BT_NONASCII):
  11066. goto _1
  11067. case int32(_BT_MINUS):
  11068. goto _2
  11069. case int32(_BT_NAME):
  11070. goto _3
  11071. case int32(_BT_DIGIT):
  11072. goto _4
  11073. case int32(_BT_HEX):
  11074. goto _5
  11075. case int32(_BT_NMSTRT):
  11076. goto _6
  11077. case int32(_BT_LEAD2):
  11078. goto _7
  11079. case int32(_BT_LEAD3):
  11080. goto _8
  11081. case int32(_BT_LEAD4):
  11082. goto _9
  11083. case int32(_BT_LF):
  11084. goto _10
  11085. case int32(_BT_CR):
  11086. goto _11
  11087. case int32(_BT_S):
  11088. goto _12
  11089. case int32(_BT_COLON):
  11090. goto _13
  11091. case int32(_BT_GT):
  11092. goto _14
  11093. default:
  11094. goto _15
  11095. }
  11096. goto _16
  11097. _1:
  11098. ;
  11099. if !(libc.Int32FromInt32(0) != 0) {
  11100. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11101. return m_XML_TOK_INVALID
  11102. } /* fall through */
  11103. _6:
  11104. ;
  11105. _5:
  11106. ;
  11107. _4:
  11108. ;
  11109. _3:
  11110. ;
  11111. _2:
  11112. ;
  11113. ptr += uintptr(1)
  11114. goto _16
  11115. _7:
  11116. ;
  11117. if int64(end)-int64(ptr) < int64(2) {
  11118. return -int32(2)
  11119. }
  11120. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  11121. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11122. return m_XML_TOK_INVALID
  11123. }
  11124. ptr += uintptr(2)
  11125. goto _16
  11126. _8:
  11127. ;
  11128. if int64(end)-int64(ptr) < int64(3) {
  11129. return -int32(2)
  11130. }
  11131. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  11132. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11133. return m_XML_TOK_INVALID
  11134. }
  11135. ptr += uintptr(3)
  11136. goto _16
  11137. _9:
  11138. ;
  11139. if int64(end)-int64(ptr) < int64(4) {
  11140. return -int32(2)
  11141. }
  11142. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  11143. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11144. return m_XML_TOK_INVALID
  11145. }
  11146. ptr += uintptr(4)
  11147. goto _16
  11148. _12:
  11149. ;
  11150. _11:
  11151. ;
  11152. _10:
  11153. ;
  11154. ptr += uintptr(1)
  11155. _19:
  11156. ;
  11157. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11158. goto _17
  11159. }
  11160. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11161. case int32(_BT_S):
  11162. fallthrough
  11163. case int32(_BT_CR):
  11164. fallthrough
  11165. case int32(_BT_LF):
  11166. case int32(_BT_GT):
  11167. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  11168. return int32(m_XML_TOK_END_TAG)
  11169. default:
  11170. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11171. return m_XML_TOK_INVALID
  11172. }
  11173. goto _18
  11174. _18:
  11175. ;
  11176. ptr += uintptr(1)
  11177. goto _19
  11178. goto _17
  11179. _17:
  11180. ;
  11181. return -int32(1)
  11182. _13:
  11183. ;
  11184. /* no need to check qname syntax here,
  11185. since end-tag must match exactly */
  11186. ptr += uintptr(1)
  11187. goto _16
  11188. _14:
  11189. ;
  11190. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  11191. return int32(m_XML_TOK_END_TAG)
  11192. _15:
  11193. ;
  11194. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11195. return m_XML_TOK_INVALID
  11196. _16:
  11197. }
  11198. return -int32(1)
  11199. }
  11200. /* ptr points to character following "&#X" */
  11201. func _normal_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  11202. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  11203. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11204. case int32(_BT_DIGIT):
  11205. fallthrough
  11206. case int32(_BT_HEX):
  11207. default:
  11208. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11209. return m_XML_TOK_INVALID
  11210. }
  11211. ptr += uintptr(1)
  11212. for {
  11213. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11214. break
  11215. }
  11216. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11217. case int32(_BT_DIGIT):
  11218. fallthrough
  11219. case int32(_BT_HEX):
  11220. case int32(_BT_SEMI):
  11221. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  11222. return int32(m_XML_TOK_CHAR_REF)
  11223. default:
  11224. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11225. return m_XML_TOK_INVALID
  11226. }
  11227. goto _1
  11228. _1:
  11229. ;
  11230. ptr += uintptr(1)
  11231. }
  11232. }
  11233. return -int32(1)
  11234. }
  11235. /* ptr points to character following "&#" */
  11236. func _normal_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  11237. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  11238. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x) {
  11239. return _normal_scanHexCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  11240. }
  11241. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11242. case int32(_BT_DIGIT):
  11243. default:
  11244. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11245. return m_XML_TOK_INVALID
  11246. }
  11247. ptr += uintptr(1)
  11248. for {
  11249. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11250. break
  11251. }
  11252. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11253. case int32(_BT_DIGIT):
  11254. case int32(_BT_SEMI):
  11255. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  11256. return int32(m_XML_TOK_CHAR_REF)
  11257. default:
  11258. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11259. return m_XML_TOK_INVALID
  11260. }
  11261. goto _1
  11262. _1:
  11263. ;
  11264. ptr += uintptr(1)
  11265. }
  11266. }
  11267. return -int32(1)
  11268. }
  11269. /* ptr points to character following "&" */
  11270. func _normal_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  11271. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11272. return -int32(1)
  11273. }
  11274. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11275. case int32(_BT_NONASCII):
  11276. if !(libc.Int32FromInt32(0) != 0) {
  11277. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11278. return m_XML_TOK_INVALID
  11279. } /* fall through */
  11280. fallthrough
  11281. case int32(_BT_NMSTRT):
  11282. fallthrough
  11283. case int32(_BT_HEX):
  11284. ptr += uintptr(1)
  11285. case int32(_BT_LEAD2):
  11286. if int64(end)-int64(ptr) < int64(2) {
  11287. return -int32(2)
  11288. }
  11289. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  11290. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11291. return m_XML_TOK_INVALID
  11292. }
  11293. ptr += uintptr(2)
  11294. case int32(_BT_LEAD3):
  11295. if int64(end)-int64(ptr) < int64(3) {
  11296. return -int32(2)
  11297. }
  11298. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  11299. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11300. return m_XML_TOK_INVALID
  11301. }
  11302. ptr += uintptr(3)
  11303. case int32(_BT_LEAD4):
  11304. if int64(end)-int64(ptr) < int64(4) {
  11305. return -int32(2)
  11306. }
  11307. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  11308. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11309. return m_XML_TOK_INVALID
  11310. }
  11311. ptr += uintptr(4)
  11312. case int32(_BT_NUM):
  11313. return _normal_scanCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  11314. default:
  11315. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11316. return m_XML_TOK_INVALID
  11317. }
  11318. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  11319. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11320. case int32(_BT_NONASCII):
  11321. if !(libc.Int32FromInt32(0) != 0) {
  11322. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11323. return m_XML_TOK_INVALID
  11324. } /* fall through */
  11325. fallthrough
  11326. case int32(_BT_NMSTRT):
  11327. fallthrough
  11328. case int32(_BT_HEX):
  11329. fallthrough
  11330. case int32(_BT_DIGIT):
  11331. fallthrough
  11332. case int32(_BT_NAME):
  11333. fallthrough
  11334. case int32(_BT_MINUS):
  11335. ptr += uintptr(1)
  11336. case int32(_BT_LEAD2):
  11337. if int64(end)-int64(ptr) < int64(2) {
  11338. return -int32(2)
  11339. }
  11340. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  11341. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11342. return m_XML_TOK_INVALID
  11343. }
  11344. ptr += uintptr(2)
  11345. case int32(_BT_LEAD3):
  11346. if int64(end)-int64(ptr) < int64(3) {
  11347. return -int32(2)
  11348. }
  11349. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  11350. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11351. return m_XML_TOK_INVALID
  11352. }
  11353. ptr += uintptr(3)
  11354. case int32(_BT_LEAD4):
  11355. if int64(end)-int64(ptr) < int64(4) {
  11356. return -int32(2)
  11357. }
  11358. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  11359. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11360. return m_XML_TOK_INVALID
  11361. }
  11362. ptr += uintptr(4)
  11363. case int32(_BT_SEMI):
  11364. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  11365. return int32(m_XML_TOK_ENTITY_REF)
  11366. default:
  11367. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11368. return m_XML_TOK_INVALID
  11369. }
  11370. }
  11371. return -int32(1)
  11372. }
  11373. /* ptr points to character following first character of attribute name */
  11374. func _normal_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  11375. bp := tls.Alloc(16)
  11376. defer tls.Free(16)
  11377. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  11378. var hadColon, open, t, t1, tok int32
  11379. _, _, _, _, _ = hadColon, open, t, t1, tok
  11380. hadColon = 0
  11381. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  11382. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  11383. case int32(_BT_NONASCII):
  11384. goto _1
  11385. case int32(_BT_MINUS):
  11386. goto _2
  11387. case int32(_BT_NAME):
  11388. goto _3
  11389. case int32(_BT_DIGIT):
  11390. goto _4
  11391. case int32(_BT_HEX):
  11392. goto _5
  11393. case int32(_BT_NMSTRT):
  11394. goto _6
  11395. case int32(_BT_LEAD2):
  11396. goto _7
  11397. case int32(_BT_LEAD3):
  11398. goto _8
  11399. case int32(_BT_LEAD4):
  11400. goto _9
  11401. case int32(_BT_COLON):
  11402. goto _10
  11403. case int32(_BT_LF):
  11404. goto _11
  11405. case int32(_BT_CR):
  11406. goto _12
  11407. case int32(_BT_S):
  11408. goto _13
  11409. case int32(_BT_EQUALS):
  11410. goto _14
  11411. default:
  11412. goto _15
  11413. }
  11414. goto _16
  11415. _1:
  11416. ;
  11417. if !(libc.Int32FromInt32(0) != 0) {
  11418. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11419. return m_XML_TOK_INVALID
  11420. } /* fall through */
  11421. _6:
  11422. ;
  11423. _5:
  11424. ;
  11425. _4:
  11426. ;
  11427. _3:
  11428. ;
  11429. _2:
  11430. ;
  11431. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11432. goto _16
  11433. _7:
  11434. ;
  11435. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  11436. return -int32(2)
  11437. }
  11438. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11439. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11440. return m_XML_TOK_INVALID
  11441. }
  11442. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  11443. goto _16
  11444. _8:
  11445. ;
  11446. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  11447. return -int32(2)
  11448. }
  11449. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11450. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11451. return m_XML_TOK_INVALID
  11452. }
  11453. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  11454. goto _16
  11455. _9:
  11456. ;
  11457. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  11458. return -int32(2)
  11459. }
  11460. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11461. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11462. return m_XML_TOK_INVALID
  11463. }
  11464. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  11465. goto _16
  11466. _10:
  11467. ;
  11468. if hadColon != 0 {
  11469. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11470. return m_XML_TOK_INVALID
  11471. }
  11472. hadColon = int32(1)
  11473. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11474. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11475. return -int32(1)
  11476. }
  11477. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  11478. case int32(_BT_NONASCII):
  11479. if !(libc.Int32FromInt32(0) != 0) {
  11480. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11481. return m_XML_TOK_INVALID
  11482. } /* fall through */
  11483. fallthrough
  11484. case int32(_BT_NMSTRT):
  11485. fallthrough
  11486. case int32(_BT_HEX):
  11487. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11488. case int32(_BT_LEAD2):
  11489. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  11490. return -int32(2)
  11491. }
  11492. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11493. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11494. return m_XML_TOK_INVALID
  11495. }
  11496. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  11497. case int32(_BT_LEAD3):
  11498. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  11499. return -int32(2)
  11500. }
  11501. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11502. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11503. return m_XML_TOK_INVALID
  11504. }
  11505. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  11506. case int32(_BT_LEAD4):
  11507. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  11508. return -int32(2)
  11509. }
  11510. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11511. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11512. return m_XML_TOK_INVALID
  11513. }
  11514. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  11515. default:
  11516. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11517. return m_XML_TOK_INVALID
  11518. }
  11519. goto _16
  11520. _13:
  11521. ;
  11522. _12:
  11523. ;
  11524. _11:
  11525. ;
  11526. _19:
  11527. ;
  11528. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11529. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11530. return -int32(1)
  11531. }
  11532. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  11533. if t == int32(_BT_EQUALS) {
  11534. goto _17
  11535. }
  11536. switch t {
  11537. case int32(_BT_S):
  11538. fallthrough
  11539. case int32(_BT_LF):
  11540. fallthrough
  11541. case int32(_BT_CR):
  11542. default:
  11543. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11544. return m_XML_TOK_INVALID
  11545. }
  11546. goto _18
  11547. _18:
  11548. ;
  11549. goto _19
  11550. goto _17
  11551. _17:
  11552. ;
  11553. /* fall through */
  11554. _14:
  11555. ;
  11556. hadColon = 0
  11557. for {
  11558. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11559. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11560. return -int32(1)
  11561. }
  11562. open = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  11563. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  11564. break
  11565. }
  11566. switch open {
  11567. case int32(_BT_S):
  11568. fallthrough
  11569. case int32(_BT_LF):
  11570. fallthrough
  11571. case int32(_BT_CR):
  11572. default:
  11573. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11574. return m_XML_TOK_INVALID
  11575. }
  11576. goto _20
  11577. _20:
  11578. }
  11579. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11580. /* in attribute value */
  11581. for {
  11582. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11583. return -int32(1)
  11584. }
  11585. t1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  11586. if t1 == open {
  11587. break
  11588. }
  11589. switch t1 {
  11590. case int32(_BT_LEAD2):
  11591. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  11592. return -int32(2)
  11593. }
  11594. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  11595. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11596. return m_XML_TOK_INVALID
  11597. }
  11598. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  11599. case int32(_BT_LEAD3):
  11600. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  11601. return -int32(2)
  11602. }
  11603. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  11604. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11605. return m_XML_TOK_INVALID
  11606. }
  11607. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  11608. case int32(_BT_LEAD4):
  11609. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  11610. return -int32(2)
  11611. }
  11612. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  11613. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11614. return m_XML_TOK_INVALID
  11615. }
  11616. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  11617. case int32(_BT_NONXML):
  11618. fallthrough
  11619. case int32(_BT_MALFORM):
  11620. fallthrough
  11621. case int32(_BT_TRAIL):
  11622. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11623. return m_XML_TOK_INVALID
  11624. case int32(_BT_AMP):
  11625. tok = _normal_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(1), end, bp)
  11626. if tok <= 0 {
  11627. if tok == m_XML_TOK_INVALID {
  11628. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11629. }
  11630. return tok
  11631. }
  11632. case int32(_BT_LT):
  11633. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11634. return m_XML_TOK_INVALID
  11635. default:
  11636. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11637. break
  11638. }
  11639. goto _21
  11640. _21:
  11641. }
  11642. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11643. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11644. return -int32(1)
  11645. }
  11646. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  11647. case int32(_BT_S):
  11648. fallthrough
  11649. case int32(_BT_CR):
  11650. fallthrough
  11651. case int32(_BT_LF):
  11652. case int32(_BT_SOL):
  11653. goto sol
  11654. case int32(_BT_GT):
  11655. goto gt
  11656. default:
  11657. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11658. return m_XML_TOK_INVALID
  11659. }
  11660. /* ptr points to closing quote */
  11661. _24:
  11662. ;
  11663. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11664. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11665. return -int32(1)
  11666. }
  11667. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  11668. case int32(_BT_NONASCII):
  11669. goto _25
  11670. case int32(_BT_HEX):
  11671. goto _26
  11672. case int32(_BT_NMSTRT):
  11673. goto _27
  11674. case int32(_BT_LEAD2):
  11675. goto _28
  11676. case int32(_BT_LEAD3):
  11677. goto _29
  11678. case int32(_BT_LEAD4):
  11679. goto _30
  11680. case int32(_BT_LF):
  11681. goto _31
  11682. case int32(_BT_CR):
  11683. goto _32
  11684. case int32(_BT_S):
  11685. goto _33
  11686. case int32(_BT_GT):
  11687. goto _34
  11688. case int32(_BT_SOL):
  11689. goto _35
  11690. default:
  11691. goto _36
  11692. }
  11693. goto _37
  11694. _25:
  11695. ;
  11696. if !(libc.Int32FromInt32(0) != 0) {
  11697. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11698. return m_XML_TOK_INVALID
  11699. } /* fall through */
  11700. _27:
  11701. ;
  11702. _26:
  11703. ;
  11704. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11705. goto _37
  11706. _28:
  11707. ;
  11708. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  11709. return -int32(2)
  11710. }
  11711. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11712. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11713. return m_XML_TOK_INVALID
  11714. }
  11715. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  11716. goto _37
  11717. _29:
  11718. ;
  11719. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  11720. return -int32(2)
  11721. }
  11722. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11723. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11724. return m_XML_TOK_INVALID
  11725. }
  11726. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  11727. goto _37
  11728. _30:
  11729. ;
  11730. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  11731. return -int32(2)
  11732. }
  11733. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11734. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11735. return m_XML_TOK_INVALID
  11736. }
  11737. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  11738. goto _37
  11739. _33:
  11740. ;
  11741. _32:
  11742. ;
  11743. _31:
  11744. ;
  11745. goto _23
  11746. _34:
  11747. ;
  11748. goto gt
  11749. gt:
  11750. ;
  11751. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  11752. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  11753. _35:
  11754. ;
  11755. goto sol
  11756. sol:
  11757. ;
  11758. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11759. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11760. return -int32(1)
  11761. }
  11762. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  11763. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11764. return m_XML_TOK_INVALID
  11765. }
  11766. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  11767. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  11768. _36:
  11769. ;
  11770. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11771. return m_XML_TOK_INVALID
  11772. _37:
  11773. ;
  11774. goto _22
  11775. goto _23
  11776. _23:
  11777. ;
  11778. goto _24
  11779. goto _22
  11780. _22:
  11781. ;
  11782. goto _16
  11783. _15:
  11784. ;
  11785. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11786. return m_XML_TOK_INVALID
  11787. _16:
  11788. }
  11789. return -int32(1)
  11790. }
  11791. /* ptr points to character following "<" */
  11792. func _normal_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  11793. var hadColon int32
  11794. _ = hadColon
  11795. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11796. return -int32(1)
  11797. }
  11798. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11799. case int32(_BT_NONASCII):
  11800. if !(libc.Int32FromInt32(0) != 0) {
  11801. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11802. return m_XML_TOK_INVALID
  11803. } /* fall through */
  11804. fallthrough
  11805. case int32(_BT_NMSTRT):
  11806. fallthrough
  11807. case int32(_BT_HEX):
  11808. ptr += uintptr(1)
  11809. case int32(_BT_LEAD2):
  11810. if int64(end)-int64(ptr) < int64(2) {
  11811. return -int32(2)
  11812. }
  11813. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  11814. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11815. return m_XML_TOK_INVALID
  11816. }
  11817. ptr += uintptr(2)
  11818. case int32(_BT_LEAD3):
  11819. if int64(end)-int64(ptr) < int64(3) {
  11820. return -int32(2)
  11821. }
  11822. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  11823. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11824. return m_XML_TOK_INVALID
  11825. }
  11826. ptr += uintptr(3)
  11827. case int32(_BT_LEAD4):
  11828. if int64(end)-int64(ptr) < int64(4) {
  11829. return -int32(2)
  11830. }
  11831. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  11832. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11833. return m_XML_TOK_INVALID
  11834. }
  11835. ptr += uintptr(4)
  11836. case int32(_BT_EXCL):
  11837. ptr += uintptr(1)
  11838. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11839. return -int32(1)
  11840. }
  11841. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11842. case int32(_BT_MINUS):
  11843. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  11844. case int32(_BT_LSQB):
  11845. return _normal_scanCdataSection(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  11846. }
  11847. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11848. return m_XML_TOK_INVALID
  11849. case int32(_BT_QUEST):
  11850. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  11851. case int32(_BT_SOL):
  11852. return _normal_scanEndTag(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  11853. default:
  11854. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11855. return m_XML_TOK_INVALID
  11856. }
  11857. hadColon = 0
  11858. /* we have a start-tag */
  11859. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  11860. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11861. case int32(_BT_NONASCII):
  11862. goto _1
  11863. case int32(_BT_MINUS):
  11864. goto _2
  11865. case int32(_BT_NAME):
  11866. goto _3
  11867. case int32(_BT_DIGIT):
  11868. goto _4
  11869. case int32(_BT_HEX):
  11870. goto _5
  11871. case int32(_BT_NMSTRT):
  11872. goto _6
  11873. case int32(_BT_LEAD2):
  11874. goto _7
  11875. case int32(_BT_LEAD3):
  11876. goto _8
  11877. case int32(_BT_LEAD4):
  11878. goto _9
  11879. case int32(_BT_COLON):
  11880. goto _10
  11881. case int32(_BT_LF):
  11882. goto _11
  11883. case int32(_BT_CR):
  11884. goto _12
  11885. case int32(_BT_S):
  11886. goto _13
  11887. case int32(_BT_GT):
  11888. goto _14
  11889. case int32(_BT_SOL):
  11890. goto _15
  11891. default:
  11892. goto _16
  11893. }
  11894. goto _17
  11895. _1:
  11896. ;
  11897. if !(libc.Int32FromInt32(0) != 0) {
  11898. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11899. return m_XML_TOK_INVALID
  11900. } /* fall through */
  11901. _6:
  11902. ;
  11903. _5:
  11904. ;
  11905. _4:
  11906. ;
  11907. _3:
  11908. ;
  11909. _2:
  11910. ;
  11911. ptr += uintptr(1)
  11912. goto _17
  11913. _7:
  11914. ;
  11915. if int64(end)-int64(ptr) < int64(2) {
  11916. return -int32(2)
  11917. }
  11918. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  11919. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11920. return m_XML_TOK_INVALID
  11921. }
  11922. ptr += uintptr(2)
  11923. goto _17
  11924. _8:
  11925. ;
  11926. if int64(end)-int64(ptr) < int64(3) {
  11927. return -int32(2)
  11928. }
  11929. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  11930. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11931. return m_XML_TOK_INVALID
  11932. }
  11933. ptr += uintptr(3)
  11934. goto _17
  11935. _9:
  11936. ;
  11937. if int64(end)-int64(ptr) < int64(4) {
  11938. return -int32(2)
  11939. }
  11940. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  11941. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11942. return m_XML_TOK_INVALID
  11943. }
  11944. ptr += uintptr(4)
  11945. goto _17
  11946. _10:
  11947. ;
  11948. if hadColon != 0 {
  11949. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11950. return m_XML_TOK_INVALID
  11951. }
  11952. hadColon = int32(1)
  11953. ptr += uintptr(1)
  11954. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11955. return -int32(1)
  11956. }
  11957. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11958. case int32(_BT_NONASCII):
  11959. if !(libc.Int32FromInt32(0) != 0) {
  11960. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11961. return m_XML_TOK_INVALID
  11962. } /* fall through */
  11963. fallthrough
  11964. case int32(_BT_NMSTRT):
  11965. fallthrough
  11966. case int32(_BT_HEX):
  11967. ptr += uintptr(1)
  11968. case int32(_BT_LEAD2):
  11969. if int64(end)-int64(ptr) < int64(2) {
  11970. return -int32(2)
  11971. }
  11972. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  11973. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11974. return m_XML_TOK_INVALID
  11975. }
  11976. ptr += uintptr(2)
  11977. case int32(_BT_LEAD3):
  11978. if int64(end)-int64(ptr) < int64(3) {
  11979. return -int32(2)
  11980. }
  11981. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  11982. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11983. return m_XML_TOK_INVALID
  11984. }
  11985. ptr += uintptr(3)
  11986. case int32(_BT_LEAD4):
  11987. if int64(end)-int64(ptr) < int64(4) {
  11988. return -int32(2)
  11989. }
  11990. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  11991. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11992. return m_XML_TOK_INVALID
  11993. }
  11994. ptr += uintptr(4)
  11995. default:
  11996. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11997. return m_XML_TOK_INVALID
  11998. }
  11999. goto _17
  12000. _13:
  12001. ;
  12002. _12:
  12003. ;
  12004. _11:
  12005. ;
  12006. ptr += uintptr(1)
  12007. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  12008. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12009. case int32(_BT_NONASCII):
  12010. if !(libc.Int32FromInt32(0) != 0) {
  12011. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12012. return m_XML_TOK_INVALID
  12013. } /* fall through */
  12014. fallthrough
  12015. case int32(_BT_NMSTRT):
  12016. fallthrough
  12017. case int32(_BT_HEX):
  12018. ptr += uintptr(1)
  12019. case int32(_BT_LEAD2):
  12020. if int64(end)-int64(ptr) < int64(2) {
  12021. return -int32(2)
  12022. }
  12023. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  12024. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12025. return m_XML_TOK_INVALID
  12026. }
  12027. ptr += uintptr(2)
  12028. case int32(_BT_LEAD3):
  12029. if int64(end)-int64(ptr) < int64(3) {
  12030. return -int32(2)
  12031. }
  12032. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  12033. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12034. return m_XML_TOK_INVALID
  12035. }
  12036. ptr += uintptr(3)
  12037. case int32(_BT_LEAD4):
  12038. if int64(end)-int64(ptr) < int64(4) {
  12039. return -int32(2)
  12040. }
  12041. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  12042. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12043. return m_XML_TOK_INVALID
  12044. }
  12045. ptr += uintptr(4)
  12046. case int32(_BT_GT):
  12047. goto gt
  12048. case int32(_BT_SOL):
  12049. goto sol
  12050. case int32(_BT_S):
  12051. fallthrough
  12052. case int32(_BT_CR):
  12053. fallthrough
  12054. case int32(_BT_LF):
  12055. ptr += uintptr(1)
  12056. continue
  12057. default:
  12058. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12059. return m_XML_TOK_INVALID
  12060. }
  12061. return _normal_scanAtts(tls, enc, ptr, end, nextTokPtr)
  12062. }
  12063. return -int32(1)
  12064. _14:
  12065. ;
  12066. goto gt
  12067. gt:
  12068. ;
  12069. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12070. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  12071. _15:
  12072. ;
  12073. goto sol
  12074. sol:
  12075. ;
  12076. ptr += uintptr(1)
  12077. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12078. return -int32(1)
  12079. }
  12080. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  12081. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12082. return m_XML_TOK_INVALID
  12083. }
  12084. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12085. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  12086. _16:
  12087. ;
  12088. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12089. return m_XML_TOK_INVALID
  12090. _17:
  12091. }
  12092. return -int32(1)
  12093. }
  12094. func _normal_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  12095. var n Tsize_t
  12096. _ = n
  12097. if ptr >= end {
  12098. return -int32(4)
  12099. }
  12100. if int32(1) > int32(1) {
  12101. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  12102. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  12103. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  12104. if n == uint64(0) {
  12105. return -int32(1)
  12106. }
  12107. end = ptr + uintptr(n)
  12108. }
  12109. }
  12110. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12111. case int32(_BT_LT):
  12112. return _normal_scanLt(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  12113. case int32(_BT_AMP):
  12114. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  12115. case int32(_BT_CR):
  12116. ptr += uintptr(1)
  12117. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12118. return -int32(3)
  12119. }
  12120. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  12121. ptr += uintptr(1)
  12122. }
  12123. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12124. return int32(m_XML_TOK_DATA_NEWLINE)
  12125. case int32(_BT_LF):
  12126. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12127. return int32(m_XML_TOK_DATA_NEWLINE)
  12128. case int32(_BT_RSQB):
  12129. ptr += uintptr(1)
  12130. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12131. return -int32(5)
  12132. }
  12133. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  12134. break
  12135. }
  12136. ptr += uintptr(1)
  12137. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12138. return -int32(5)
  12139. }
  12140. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  12141. ptr -= uintptr(1)
  12142. break
  12143. }
  12144. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12145. return m_XML_TOK_INVALID
  12146. case int32(_BT_LEAD2):
  12147. if int64(end)-int64(ptr) < int64(2) {
  12148. return -int32(2)
  12149. }
  12150. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  12151. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12152. return m_XML_TOK_INVALID
  12153. }
  12154. ptr += uintptr(2)
  12155. case int32(_BT_LEAD3):
  12156. if int64(end)-int64(ptr) < int64(3) {
  12157. return -int32(2)
  12158. }
  12159. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  12160. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12161. return m_XML_TOK_INVALID
  12162. }
  12163. ptr += uintptr(3)
  12164. case int32(_BT_LEAD4):
  12165. if int64(end)-int64(ptr) < int64(4) {
  12166. return -int32(2)
  12167. }
  12168. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  12169. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12170. return m_XML_TOK_INVALID
  12171. }
  12172. ptr += uintptr(4)
  12173. case int32(_BT_NONXML):
  12174. fallthrough
  12175. case int32(_BT_MALFORM):
  12176. fallthrough
  12177. case int32(_BT_TRAIL):
  12178. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12179. return m_XML_TOK_INVALID
  12180. default:
  12181. ptr += uintptr(1)
  12182. break
  12183. }
  12184. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  12185. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12186. case int32(_BT_LEAD2):
  12187. if int64(end)-int64(ptr) < int64(2) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  12188. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12189. return int32(m_XML_TOK_DATA_CHARS)
  12190. }
  12191. ptr += uintptr(2)
  12192. case int32(_BT_LEAD3):
  12193. if int64(end)-int64(ptr) < int64(3) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  12194. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12195. return int32(m_XML_TOK_DATA_CHARS)
  12196. }
  12197. ptr += uintptr(3)
  12198. case int32(_BT_LEAD4):
  12199. if int64(end)-int64(ptr) < int64(4) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  12200. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12201. return int32(m_XML_TOK_DATA_CHARS)
  12202. }
  12203. ptr += uintptr(4)
  12204. case int32(_BT_RSQB):
  12205. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1)) {
  12206. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  12207. ptr += uintptr(1)
  12208. break
  12209. }
  12210. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(1)) {
  12211. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  12212. ptr += uintptr(1)
  12213. break
  12214. }
  12215. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  12216. return m_XML_TOK_INVALID
  12217. }
  12218. }
  12219. /* fall through */
  12220. fallthrough
  12221. case int32(_BT_AMP):
  12222. fallthrough
  12223. case int32(_BT_LT):
  12224. fallthrough
  12225. case int32(_BT_NONXML):
  12226. fallthrough
  12227. case int32(_BT_MALFORM):
  12228. fallthrough
  12229. case int32(_BT_TRAIL):
  12230. fallthrough
  12231. case int32(_BT_CR):
  12232. fallthrough
  12233. case int32(_BT_LF):
  12234. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12235. return int32(m_XML_TOK_DATA_CHARS)
  12236. default:
  12237. ptr += uintptr(1)
  12238. break
  12239. }
  12240. }
  12241. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12242. return int32(m_XML_TOK_DATA_CHARS)
  12243. }
  12244. /* ptr points to character following "%" */
  12245. func _normal_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  12246. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12247. return -int32(1)
  12248. }
  12249. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12250. case int32(_BT_NONASCII):
  12251. if !(libc.Int32FromInt32(0) != 0) {
  12252. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12253. return m_XML_TOK_INVALID
  12254. } /* fall through */
  12255. fallthrough
  12256. case int32(_BT_NMSTRT):
  12257. fallthrough
  12258. case int32(_BT_HEX):
  12259. ptr += uintptr(1)
  12260. case int32(_BT_LEAD2):
  12261. if int64(end)-int64(ptr) < int64(2) {
  12262. return -int32(2)
  12263. }
  12264. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  12265. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12266. return m_XML_TOK_INVALID
  12267. }
  12268. ptr += uintptr(2)
  12269. case int32(_BT_LEAD3):
  12270. if int64(end)-int64(ptr) < int64(3) {
  12271. return -int32(2)
  12272. }
  12273. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  12274. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12275. return m_XML_TOK_INVALID
  12276. }
  12277. ptr += uintptr(3)
  12278. case int32(_BT_LEAD4):
  12279. if int64(end)-int64(ptr) < int64(4) {
  12280. return -int32(2)
  12281. }
  12282. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  12283. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12284. return m_XML_TOK_INVALID
  12285. }
  12286. ptr += uintptr(4)
  12287. case int32(_BT_S):
  12288. fallthrough
  12289. case int32(_BT_LF):
  12290. fallthrough
  12291. case int32(_BT_CR):
  12292. fallthrough
  12293. case int32(_BT_PERCNT):
  12294. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12295. return int32(m_XML_TOK_PERCENT)
  12296. default:
  12297. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12298. return m_XML_TOK_INVALID
  12299. }
  12300. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  12301. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12302. case int32(_BT_NONASCII):
  12303. if !(libc.Int32FromInt32(0) != 0) {
  12304. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12305. return m_XML_TOK_INVALID
  12306. } /* fall through */
  12307. fallthrough
  12308. case int32(_BT_NMSTRT):
  12309. fallthrough
  12310. case int32(_BT_HEX):
  12311. fallthrough
  12312. case int32(_BT_DIGIT):
  12313. fallthrough
  12314. case int32(_BT_NAME):
  12315. fallthrough
  12316. case int32(_BT_MINUS):
  12317. ptr += uintptr(1)
  12318. case int32(_BT_LEAD2):
  12319. if int64(end)-int64(ptr) < int64(2) {
  12320. return -int32(2)
  12321. }
  12322. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  12323. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12324. return m_XML_TOK_INVALID
  12325. }
  12326. ptr += uintptr(2)
  12327. case int32(_BT_LEAD3):
  12328. if int64(end)-int64(ptr) < int64(3) {
  12329. return -int32(2)
  12330. }
  12331. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  12332. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12333. return m_XML_TOK_INVALID
  12334. }
  12335. ptr += uintptr(3)
  12336. case int32(_BT_LEAD4):
  12337. if int64(end)-int64(ptr) < int64(4) {
  12338. return -int32(2)
  12339. }
  12340. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  12341. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12342. return m_XML_TOK_INVALID
  12343. }
  12344. ptr += uintptr(4)
  12345. case int32(_BT_SEMI):
  12346. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12347. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  12348. default:
  12349. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12350. return m_XML_TOK_INVALID
  12351. }
  12352. }
  12353. return -int32(1)
  12354. }
  12355. func _normal_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  12356. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12357. return -int32(1)
  12358. }
  12359. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12360. case int32(_BT_NONASCII):
  12361. if !(libc.Int32FromInt32(0) != 0) {
  12362. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12363. return m_XML_TOK_INVALID
  12364. } /* fall through */
  12365. fallthrough
  12366. case int32(_BT_NMSTRT):
  12367. fallthrough
  12368. case int32(_BT_HEX):
  12369. ptr += uintptr(1)
  12370. case int32(_BT_LEAD2):
  12371. if int64(end)-int64(ptr) < int64(2) {
  12372. return -int32(2)
  12373. }
  12374. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  12375. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12376. return m_XML_TOK_INVALID
  12377. }
  12378. ptr += uintptr(2)
  12379. case int32(_BT_LEAD3):
  12380. if int64(end)-int64(ptr) < int64(3) {
  12381. return -int32(2)
  12382. }
  12383. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  12384. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12385. return m_XML_TOK_INVALID
  12386. }
  12387. ptr += uintptr(3)
  12388. case int32(_BT_LEAD4):
  12389. if int64(end)-int64(ptr) < int64(4) {
  12390. return -int32(2)
  12391. }
  12392. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  12393. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12394. return m_XML_TOK_INVALID
  12395. }
  12396. ptr += uintptr(4)
  12397. default:
  12398. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12399. return m_XML_TOK_INVALID
  12400. }
  12401. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  12402. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12403. case int32(_BT_NONASCII):
  12404. if !(libc.Int32FromInt32(0) != 0) {
  12405. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12406. return m_XML_TOK_INVALID
  12407. } /* fall through */
  12408. fallthrough
  12409. case int32(_BT_NMSTRT):
  12410. fallthrough
  12411. case int32(_BT_HEX):
  12412. fallthrough
  12413. case int32(_BT_DIGIT):
  12414. fallthrough
  12415. case int32(_BT_NAME):
  12416. fallthrough
  12417. case int32(_BT_MINUS):
  12418. ptr += uintptr(1)
  12419. case int32(_BT_LEAD2):
  12420. if int64(end)-int64(ptr) < int64(2) {
  12421. return -int32(2)
  12422. }
  12423. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  12424. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12425. return m_XML_TOK_INVALID
  12426. }
  12427. ptr += uintptr(2)
  12428. case int32(_BT_LEAD3):
  12429. if int64(end)-int64(ptr) < int64(3) {
  12430. return -int32(2)
  12431. }
  12432. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  12433. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12434. return m_XML_TOK_INVALID
  12435. }
  12436. ptr += uintptr(3)
  12437. case int32(_BT_LEAD4):
  12438. if int64(end)-int64(ptr) < int64(4) {
  12439. return -int32(2)
  12440. }
  12441. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  12442. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12443. return m_XML_TOK_INVALID
  12444. }
  12445. ptr += uintptr(4)
  12446. case int32(_BT_CR):
  12447. fallthrough
  12448. case int32(_BT_LF):
  12449. fallthrough
  12450. case int32(_BT_S):
  12451. fallthrough
  12452. case int32(_BT_RPAR):
  12453. fallthrough
  12454. case int32(_BT_GT):
  12455. fallthrough
  12456. case int32(_BT_PERCNT):
  12457. fallthrough
  12458. case int32(_BT_VERBAR):
  12459. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12460. return int32(m_XML_TOK_POUND_NAME)
  12461. default:
  12462. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12463. return m_XML_TOK_INVALID
  12464. }
  12465. }
  12466. return -int32(m_XML_TOK_POUND_NAME)
  12467. }
  12468. func _normal_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  12469. var t int32
  12470. _ = t
  12471. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  12472. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  12473. switch t {
  12474. case int32(_BT_LEAD2):
  12475. if int64(end)-int64(ptr) < int64(2) {
  12476. return -int32(2)
  12477. }
  12478. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  12479. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12480. return m_XML_TOK_INVALID
  12481. }
  12482. ptr += uintptr(2)
  12483. case int32(_BT_LEAD3):
  12484. if int64(end)-int64(ptr) < int64(3) {
  12485. return -int32(2)
  12486. }
  12487. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  12488. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12489. return m_XML_TOK_INVALID
  12490. }
  12491. ptr += uintptr(3)
  12492. case int32(_BT_LEAD4):
  12493. if int64(end)-int64(ptr) < int64(4) {
  12494. return -int32(2)
  12495. }
  12496. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  12497. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12498. return m_XML_TOK_INVALID
  12499. }
  12500. ptr += uintptr(4)
  12501. case int32(_BT_NONXML):
  12502. fallthrough
  12503. case int32(_BT_MALFORM):
  12504. fallthrough
  12505. case int32(_BT_TRAIL):
  12506. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12507. return m_XML_TOK_INVALID
  12508. case int32(_BT_QUOT):
  12509. fallthrough
  12510. case int32(_BT_APOS):
  12511. ptr += uintptr(1)
  12512. if t != open {
  12513. break
  12514. }
  12515. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12516. return -int32(m_XML_TOK_LITERAL)
  12517. }
  12518. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12519. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12520. case int32(_BT_S):
  12521. fallthrough
  12522. case int32(_BT_CR):
  12523. fallthrough
  12524. case int32(_BT_LF):
  12525. fallthrough
  12526. case int32(_BT_GT):
  12527. fallthrough
  12528. case int32(_BT_PERCNT):
  12529. fallthrough
  12530. case int32(_BT_LSQB):
  12531. return int32(m_XML_TOK_LITERAL)
  12532. default:
  12533. return m_XML_TOK_INVALID
  12534. }
  12535. fallthrough
  12536. default:
  12537. ptr += uintptr(1)
  12538. break
  12539. }
  12540. }
  12541. return -int32(1)
  12542. }
  12543. func _normal_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  12544. var n Tsize_t
  12545. var tok int32
  12546. _, _ = n, tok
  12547. if ptr >= end {
  12548. return -int32(4)
  12549. }
  12550. if int32(1) > int32(1) {
  12551. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  12552. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  12553. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  12554. if n == uint64(0) {
  12555. return -int32(1)
  12556. }
  12557. end = ptr + uintptr(n)
  12558. }
  12559. }
  12560. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12561. case int32(_BT_QUOT):
  12562. goto _1
  12563. case int32(_BT_APOS):
  12564. goto _2
  12565. case int32(_BT_LT):
  12566. goto _3
  12567. case int32(_BT_CR):
  12568. goto _4
  12569. case int32(_BT_LF):
  12570. goto _5
  12571. case int32(_BT_S):
  12572. goto _6
  12573. case int32(_BT_PERCNT):
  12574. goto _7
  12575. case int32(_BT_COMMA):
  12576. goto _8
  12577. case int32(_BT_LSQB):
  12578. goto _9
  12579. case int32(_BT_RSQB):
  12580. goto _10
  12581. case int32(_BT_LPAR):
  12582. goto _11
  12583. case int32(_BT_RPAR):
  12584. goto _12
  12585. case int32(_BT_VERBAR):
  12586. goto _13
  12587. case int32(_BT_GT):
  12588. goto _14
  12589. case int32(_BT_NUM):
  12590. goto _15
  12591. case int32(_BT_LEAD2):
  12592. goto _16
  12593. case int32(_BT_LEAD3):
  12594. goto _17
  12595. case int32(_BT_LEAD4):
  12596. goto _18
  12597. case int32(_BT_HEX):
  12598. goto _19
  12599. case int32(_BT_NMSTRT):
  12600. goto _20
  12601. case int32(_BT_COLON):
  12602. goto _21
  12603. case int32(_BT_MINUS):
  12604. goto _22
  12605. case int32(_BT_NAME):
  12606. goto _23
  12607. case int32(_BT_DIGIT):
  12608. goto _24
  12609. case int32(_BT_NONASCII):
  12610. goto _25
  12611. default:
  12612. goto _26
  12613. }
  12614. goto _27
  12615. _1:
  12616. ;
  12617. return _normal_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(1), end, nextTokPtr)
  12618. _2:
  12619. ;
  12620. return _normal_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(1), end, nextTokPtr)
  12621. _3:
  12622. ;
  12623. ptr += uintptr(1)
  12624. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12625. return -int32(1)
  12626. }
  12627. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12628. case int32(_BT_EXCL):
  12629. return _normal_scanDecl(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  12630. case int32(_BT_QUEST):
  12631. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  12632. case int32(_BT_NMSTRT):
  12633. fallthrough
  12634. case int32(_BT_HEX):
  12635. fallthrough
  12636. case int32(_BT_NONASCII):
  12637. fallthrough
  12638. case int32(_BT_LEAD2):
  12639. fallthrough
  12640. case int32(_BT_LEAD3):
  12641. fallthrough
  12642. case int32(_BT_LEAD4):
  12643. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(1)
  12644. return int32(m_XML_TOK_INSTANCE_START)
  12645. }
  12646. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12647. return m_XML_TOK_INVALID
  12648. _4:
  12649. ;
  12650. if ptr+uintptr(1) == end {
  12651. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  12652. /* indicate that this might be part of a CR/LF pair */
  12653. return -int32(m_XML_TOK_PROLOG_S)
  12654. }
  12655. /* fall through */
  12656. _6:
  12657. ;
  12658. _5:
  12659. ;
  12660. _30:
  12661. ;
  12662. ptr += uintptr(1)
  12663. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12664. goto _28
  12665. }
  12666. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12667. case int32(_BT_S):
  12668. fallthrough
  12669. case int32(_BT_LF):
  12670. case int32(_BT_CR):
  12671. /* don't split CR/LF pair */
  12672. if ptr+uintptr(1) != end {
  12673. break
  12674. }
  12675. /* fall through */
  12676. fallthrough
  12677. default:
  12678. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12679. return int32(m_XML_TOK_PROLOG_S)
  12680. }
  12681. goto _29
  12682. _29:
  12683. ;
  12684. goto _30
  12685. goto _28
  12686. _28:
  12687. ;
  12688. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12689. return int32(m_XML_TOK_PROLOG_S)
  12690. _7:
  12691. ;
  12692. return _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  12693. _8:
  12694. ;
  12695. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12696. return int32(m_XML_TOK_COMMA)
  12697. _9:
  12698. ;
  12699. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12700. return int32(m_XML_TOK_OPEN_BRACKET)
  12701. _10:
  12702. ;
  12703. ptr += uintptr(1)
  12704. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12705. return -int32(m_XML_TOK_CLOSE_BRACKET)
  12706. }
  12707. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  12708. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))) {
  12709. return -int32(1)
  12710. }
  12711. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_GT1) {
  12712. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  12713. return int32(m_XML_TOK_COND_SECT_CLOSE)
  12714. }
  12715. }
  12716. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12717. return int32(m_XML_TOK_CLOSE_BRACKET)
  12718. _11:
  12719. ;
  12720. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12721. return int32(m_XML_TOK_OPEN_PAREN)
  12722. _12:
  12723. ;
  12724. ptr += uintptr(1)
  12725. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12726. return -int32(m_XML_TOK_CLOSE_PAREN)
  12727. }
  12728. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12729. case int32(_BT_AST):
  12730. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12731. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  12732. case int32(_BT_QUEST):
  12733. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12734. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  12735. case int32(_BT_PLUS):
  12736. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12737. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  12738. case int32(_BT_CR):
  12739. fallthrough
  12740. case int32(_BT_LF):
  12741. fallthrough
  12742. case int32(_BT_S):
  12743. fallthrough
  12744. case int32(_BT_GT):
  12745. fallthrough
  12746. case int32(_BT_COMMA):
  12747. fallthrough
  12748. case int32(_BT_VERBAR):
  12749. fallthrough
  12750. case int32(_BT_RPAR):
  12751. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12752. return int32(m_XML_TOK_CLOSE_PAREN)
  12753. }
  12754. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12755. return m_XML_TOK_INVALID
  12756. _13:
  12757. ;
  12758. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12759. return int32(m_XML_TOK_OR)
  12760. _14:
  12761. ;
  12762. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12763. return int32(m_XML_TOK_DECL_CLOSE)
  12764. _15:
  12765. ;
  12766. return _normal_scanPoundName(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  12767. _16:
  12768. ;
  12769. if int64(end)-int64(ptr) < int64(2) {
  12770. return -int32(2)
  12771. }
  12772. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0 {
  12773. ptr += uintptr(2)
  12774. tok = int32(m_XML_TOK_NAME)
  12775. goto _27
  12776. }
  12777. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0 {
  12778. ptr += uintptr(2)
  12779. tok = int32(m_XML_TOK_NMTOKEN)
  12780. goto _27
  12781. }
  12782. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12783. return m_XML_TOK_INVALID
  12784. _17:
  12785. ;
  12786. if int64(end)-int64(ptr) < int64(3) {
  12787. return -int32(2)
  12788. }
  12789. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0 {
  12790. ptr += uintptr(3)
  12791. tok = int32(m_XML_TOK_NAME)
  12792. goto _27
  12793. }
  12794. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0 {
  12795. ptr += uintptr(3)
  12796. tok = int32(m_XML_TOK_NMTOKEN)
  12797. goto _27
  12798. }
  12799. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12800. return m_XML_TOK_INVALID
  12801. _18:
  12802. ;
  12803. if int64(end)-int64(ptr) < int64(4) {
  12804. return -int32(2)
  12805. }
  12806. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0 {
  12807. ptr += uintptr(4)
  12808. tok = int32(m_XML_TOK_NAME)
  12809. goto _27
  12810. }
  12811. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0 {
  12812. ptr += uintptr(4)
  12813. tok = int32(m_XML_TOK_NMTOKEN)
  12814. goto _27
  12815. }
  12816. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12817. return m_XML_TOK_INVALID
  12818. _20:
  12819. ;
  12820. _19:
  12821. ;
  12822. tok = int32(m_XML_TOK_NAME)
  12823. ptr += uintptr(1)
  12824. goto _27
  12825. _24:
  12826. ;
  12827. _23:
  12828. ;
  12829. _22:
  12830. ;
  12831. _21:
  12832. ;
  12833. tok = int32(m_XML_TOK_NMTOKEN)
  12834. ptr += uintptr(1)
  12835. goto _27
  12836. _25:
  12837. ;
  12838. if 0 != 0 {
  12839. ptr += uintptr(1)
  12840. tok = int32(m_XML_TOK_NAME)
  12841. goto _27
  12842. }
  12843. if 0 != 0 {
  12844. ptr += uintptr(1)
  12845. tok = int32(m_XML_TOK_NMTOKEN)
  12846. goto _27
  12847. }
  12848. /* fall through */
  12849. _26:
  12850. ;
  12851. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12852. return m_XML_TOK_INVALID
  12853. _27:
  12854. ;
  12855. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  12856. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12857. case int32(_BT_NONASCII):
  12858. if !(libc.Int32FromInt32(0) != 0) {
  12859. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12860. return m_XML_TOK_INVALID
  12861. } /* fall through */
  12862. fallthrough
  12863. case int32(_BT_NMSTRT):
  12864. fallthrough
  12865. case int32(_BT_HEX):
  12866. fallthrough
  12867. case int32(_BT_DIGIT):
  12868. fallthrough
  12869. case int32(_BT_NAME):
  12870. fallthrough
  12871. case int32(_BT_MINUS):
  12872. ptr += uintptr(1)
  12873. case int32(_BT_LEAD2):
  12874. if int64(end)-int64(ptr) < int64(2) {
  12875. return -int32(2)
  12876. }
  12877. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  12878. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12879. return m_XML_TOK_INVALID
  12880. }
  12881. ptr += uintptr(2)
  12882. case int32(_BT_LEAD3):
  12883. if int64(end)-int64(ptr) < int64(3) {
  12884. return -int32(2)
  12885. }
  12886. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  12887. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12888. return m_XML_TOK_INVALID
  12889. }
  12890. ptr += uintptr(3)
  12891. case int32(_BT_LEAD4):
  12892. if int64(end)-int64(ptr) < int64(4) {
  12893. return -int32(2)
  12894. }
  12895. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  12896. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12897. return m_XML_TOK_INVALID
  12898. }
  12899. ptr += uintptr(4)
  12900. case int32(_BT_GT):
  12901. fallthrough
  12902. case int32(_BT_RPAR):
  12903. fallthrough
  12904. case int32(_BT_COMMA):
  12905. fallthrough
  12906. case int32(_BT_VERBAR):
  12907. fallthrough
  12908. case int32(_BT_LSQB):
  12909. fallthrough
  12910. case int32(_BT_PERCNT):
  12911. fallthrough
  12912. case int32(_BT_S):
  12913. fallthrough
  12914. case int32(_BT_CR):
  12915. fallthrough
  12916. case int32(_BT_LF):
  12917. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12918. return tok
  12919. case int32(_BT_COLON):
  12920. ptr += uintptr(1)
  12921. switch tok {
  12922. case int32(m_XML_TOK_NAME):
  12923. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12924. return -int32(1)
  12925. }
  12926. tok = int32(m_XML_TOK_PREFIXED_NAME)
  12927. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12928. case int32(_BT_NONASCII):
  12929. if !(libc.Int32FromInt32(0) != 0) {
  12930. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12931. return m_XML_TOK_INVALID
  12932. } /* fall through */
  12933. fallthrough
  12934. case int32(_BT_NMSTRT):
  12935. fallthrough
  12936. case int32(_BT_HEX):
  12937. fallthrough
  12938. case int32(_BT_DIGIT):
  12939. fallthrough
  12940. case int32(_BT_NAME):
  12941. fallthrough
  12942. case int32(_BT_MINUS):
  12943. ptr += uintptr(1)
  12944. case int32(_BT_LEAD2):
  12945. if int64(end)-int64(ptr) < int64(2) {
  12946. return -int32(2)
  12947. }
  12948. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  12949. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12950. return m_XML_TOK_INVALID
  12951. }
  12952. ptr += uintptr(2)
  12953. case int32(_BT_LEAD3):
  12954. if int64(end)-int64(ptr) < int64(3) {
  12955. return -int32(2)
  12956. }
  12957. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  12958. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12959. return m_XML_TOK_INVALID
  12960. }
  12961. ptr += uintptr(3)
  12962. case int32(_BT_LEAD4):
  12963. if int64(end)-int64(ptr) < int64(4) {
  12964. return -int32(2)
  12965. }
  12966. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  12967. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12968. return m_XML_TOK_INVALID
  12969. }
  12970. ptr += uintptr(4)
  12971. default:
  12972. tok = int32(m_XML_TOK_NMTOKEN)
  12973. break
  12974. }
  12975. case int32(m_XML_TOK_PREFIXED_NAME):
  12976. tok = int32(m_XML_TOK_NMTOKEN)
  12977. break
  12978. }
  12979. case int32(_BT_PLUS):
  12980. if tok == int32(m_XML_TOK_NMTOKEN) {
  12981. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12982. return m_XML_TOK_INVALID
  12983. }
  12984. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12985. return int32(m_XML_TOK_NAME_PLUS)
  12986. case int32(_BT_AST):
  12987. if tok == int32(m_XML_TOK_NMTOKEN) {
  12988. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12989. return m_XML_TOK_INVALID
  12990. }
  12991. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12992. return int32(m_XML_TOK_NAME_ASTERISK)
  12993. case int32(_BT_QUEST):
  12994. if tok == int32(m_XML_TOK_NMTOKEN) {
  12995. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12996. return m_XML_TOK_INVALID
  12997. }
  12998. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12999. return int32(m_XML_TOK_NAME_QUESTION)
  13000. default:
  13001. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13002. return m_XML_TOK_INVALID
  13003. }
  13004. }
  13005. return -tok
  13006. }
  13007. func _normal_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13008. var start uintptr
  13009. _ = start
  13010. if ptr >= end {
  13011. return -int32(4)
  13012. } else {
  13013. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13014. /* This line cannot be executed. The incoming data has already
  13015. * been tokenized once, so incomplete characters like this have
  13016. * already been eliminated from the input. Retaining the paranoia
  13017. * check is still valuable, however.
  13018. */
  13019. return -int32(1) /* LCOV_EXCL_LINE */
  13020. }
  13021. }
  13022. start = ptr
  13023. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13024. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13025. case int32(_BT_LEAD2):
  13026. ptr += uintptr(2)
  13027. case int32(_BT_LEAD3):
  13028. ptr += uintptr(3)
  13029. case int32(_BT_LEAD4):
  13030. ptr += uintptr(4)
  13031. case int32(_BT_AMP):
  13032. if ptr == start {
  13033. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13034. }
  13035. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13036. return int32(m_XML_TOK_DATA_CHARS)
  13037. case int32(_BT_LT):
  13038. /* this is for inside entity references */
  13039. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13040. return m_XML_TOK_INVALID
  13041. case int32(_BT_LF):
  13042. if ptr == start {
  13043. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13044. return int32(m_XML_TOK_DATA_NEWLINE)
  13045. }
  13046. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13047. return int32(m_XML_TOK_DATA_CHARS)
  13048. case int32(_BT_CR):
  13049. if ptr == start {
  13050. ptr += uintptr(1)
  13051. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13052. return -int32(3)
  13053. }
  13054. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  13055. ptr += uintptr(1)
  13056. }
  13057. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13058. return int32(m_XML_TOK_DATA_NEWLINE)
  13059. }
  13060. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13061. return int32(m_XML_TOK_DATA_CHARS)
  13062. case int32(_BT_S):
  13063. if ptr == start {
  13064. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13065. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  13066. }
  13067. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13068. return int32(m_XML_TOK_DATA_CHARS)
  13069. default:
  13070. ptr += uintptr(1)
  13071. break
  13072. }
  13073. }
  13074. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13075. return int32(m_XML_TOK_DATA_CHARS)
  13076. }
  13077. func _normal_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13078. var start uintptr
  13079. var tok, v1 int32
  13080. _, _, _ = start, tok, v1
  13081. if ptr >= end {
  13082. return -int32(4)
  13083. } else {
  13084. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13085. /* This line cannot be executed. The incoming data has already
  13086. * been tokenized once, so incomplete characters like this have
  13087. * already been eliminated from the input. Retaining the paranoia
  13088. * check is still valuable, however.
  13089. */
  13090. return -int32(1) /* LCOV_EXCL_LINE */
  13091. }
  13092. }
  13093. start = ptr
  13094. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13095. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13096. case int32(_BT_LEAD2):
  13097. ptr += uintptr(2)
  13098. case int32(_BT_LEAD3):
  13099. ptr += uintptr(3)
  13100. case int32(_BT_LEAD4):
  13101. ptr += uintptr(4)
  13102. case int32(_BT_AMP):
  13103. if ptr == start {
  13104. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13105. }
  13106. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13107. return int32(m_XML_TOK_DATA_CHARS)
  13108. case int32(_BT_PERCNT):
  13109. if ptr == start {
  13110. tok = _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13111. if tok == int32(m_XML_TOK_PERCENT) {
  13112. v1 = m_XML_TOK_INVALID
  13113. } else {
  13114. v1 = tok
  13115. }
  13116. return v1
  13117. }
  13118. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13119. return int32(m_XML_TOK_DATA_CHARS)
  13120. case int32(_BT_LF):
  13121. if ptr == start {
  13122. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13123. return int32(m_XML_TOK_DATA_NEWLINE)
  13124. }
  13125. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13126. return int32(m_XML_TOK_DATA_CHARS)
  13127. case int32(_BT_CR):
  13128. if ptr == start {
  13129. ptr += uintptr(1)
  13130. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13131. return -int32(3)
  13132. }
  13133. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  13134. ptr += uintptr(1)
  13135. }
  13136. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13137. return int32(m_XML_TOK_DATA_NEWLINE)
  13138. }
  13139. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13140. return int32(m_XML_TOK_DATA_CHARS)
  13141. default:
  13142. ptr += uintptr(1)
  13143. break
  13144. }
  13145. }
  13146. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13147. return int32(m_XML_TOK_DATA_CHARS)
  13148. }
  13149. func _normal_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13150. var level int32
  13151. var n Tsize_t
  13152. _, _ = level, n
  13153. level = 0
  13154. if int32(1) > int32(1) {
  13155. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  13156. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  13157. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  13158. end = ptr + uintptr(n)
  13159. }
  13160. }
  13161. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13162. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13163. case int32(_BT_LEAD2):
  13164. if int64(end)-int64(ptr) < int64(2) {
  13165. return -int32(2)
  13166. }
  13167. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13168. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13169. return m_XML_TOK_INVALID
  13170. }
  13171. ptr += uintptr(2)
  13172. case int32(_BT_LEAD3):
  13173. if int64(end)-int64(ptr) < int64(3) {
  13174. return -int32(2)
  13175. }
  13176. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13177. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13178. return m_XML_TOK_INVALID
  13179. }
  13180. ptr += uintptr(3)
  13181. case int32(_BT_LEAD4):
  13182. if int64(end)-int64(ptr) < int64(4) {
  13183. return -int32(2)
  13184. }
  13185. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13186. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13187. return m_XML_TOK_INVALID
  13188. }
  13189. ptr += uintptr(4)
  13190. case int32(_BT_NONXML):
  13191. fallthrough
  13192. case int32(_BT_MALFORM):
  13193. fallthrough
  13194. case int32(_BT_TRAIL):
  13195. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13196. return m_XML_TOK_INVALID
  13197. case int32(_BT_LT):
  13198. ptr += uintptr(1)
  13199. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13200. return -int32(1)
  13201. }
  13202. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL) {
  13203. ptr += uintptr(1)
  13204. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13205. return -int32(1)
  13206. }
  13207. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  13208. level++
  13209. ptr += uintptr(1)
  13210. }
  13211. }
  13212. case int32(_BT_RSQB):
  13213. ptr += uintptr(1)
  13214. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13215. return -int32(1)
  13216. }
  13217. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  13218. ptr += uintptr(1)
  13219. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13220. return -int32(1)
  13221. }
  13222. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  13223. ptr += uintptr(1)
  13224. if level == 0 {
  13225. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13226. return int32(m_XML_TOK_IGNORE_SECT)
  13227. }
  13228. level--
  13229. }
  13230. }
  13231. default:
  13232. ptr += uintptr(1)
  13233. break
  13234. }
  13235. }
  13236. return -int32(1)
  13237. }
  13238. func _normal_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  13239. ptr += uintptr(1)
  13240. end -= uintptr(1)
  13241. for {
  13242. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13243. break
  13244. }
  13245. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13246. case int32(_BT_DIGIT):
  13247. fallthrough
  13248. case int32(_BT_HEX):
  13249. fallthrough
  13250. case int32(_BT_MINUS):
  13251. fallthrough
  13252. case int32(_BT_APOS):
  13253. fallthrough
  13254. case int32(_BT_LPAR):
  13255. fallthrough
  13256. case int32(_BT_RPAR):
  13257. fallthrough
  13258. case int32(_BT_PLUS):
  13259. fallthrough
  13260. case int32(_BT_COMMA):
  13261. fallthrough
  13262. case int32(_BT_SOL):
  13263. fallthrough
  13264. case int32(_BT_EQUALS):
  13265. fallthrough
  13266. case int32(_BT_QUEST):
  13267. fallthrough
  13268. case int32(_BT_CR):
  13269. fallthrough
  13270. case int32(_BT_LF):
  13271. fallthrough
  13272. case int32(_BT_SEMI):
  13273. fallthrough
  13274. case int32(_BT_EXCL):
  13275. fallthrough
  13276. case int32(_BT_AST):
  13277. fallthrough
  13278. case int32(_BT_PERCNT):
  13279. fallthrough
  13280. case int32(_BT_NUM):
  13281. fallthrough
  13282. case int32(_BT_COLON):
  13283. case int32(_BT_S):
  13284. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  13285. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  13286. return 0
  13287. }
  13288. case int32(_BT_NAME):
  13289. fallthrough
  13290. case int32(_BT_NMSTRT):
  13291. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) & ^libc.Int32FromInt32(0x7f) != 0) {
  13292. break
  13293. }
  13294. /* fall through */
  13295. fallthrough
  13296. default:
  13297. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  13298. case int32(0x24): /* $ */
  13299. fallthrough
  13300. case int32(0x40): /* @ */
  13301. default:
  13302. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  13303. return 0
  13304. }
  13305. break
  13306. }
  13307. goto _1
  13308. _1:
  13309. ;
  13310. ptr += uintptr(1)
  13311. }
  13312. return int32(1)
  13313. }
  13314. /* This must only be called for a well-formed start-tag or empty
  13315. element tag. Returns the number of attributes. Pointers to the
  13316. first attsMax attributes are stored in atts.
  13317. */
  13318. func _normal_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  13319. var nAtts, open, state int32
  13320. _, _, _ = nAtts, open, state
  13321. state = 1
  13322. nAtts = 0
  13323. open = 0 /* defined when state == inValue;
  13324. initialization just to shut up compilers */
  13325. ptr += uintptr(1)
  13326. for {
  13327. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13328. case int32(_BT_LEAD2):
  13329. if state == 0 {
  13330. if nAtts < attsMax {
  13331. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  13332. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  13333. }
  13334. state = 1
  13335. }
  13336. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  13337. case int32(_BT_LEAD3):
  13338. if state == 0 {
  13339. if nAtts < attsMax {
  13340. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  13341. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  13342. }
  13343. state = 1
  13344. }
  13345. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  13346. case int32(_BT_LEAD4):
  13347. if state == 0 {
  13348. if nAtts < attsMax {
  13349. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  13350. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  13351. }
  13352. state = 1
  13353. }
  13354. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  13355. case int32(_BT_NONASCII):
  13356. fallthrough
  13357. case int32(_BT_NMSTRT):
  13358. fallthrough
  13359. case int32(_BT_HEX):
  13360. if state == 0 {
  13361. if nAtts < attsMax {
  13362. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  13363. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  13364. }
  13365. state = 1
  13366. }
  13367. case int32(_BT_QUOT):
  13368. if state != 2 {
  13369. if nAtts < attsMax {
  13370. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(1)
  13371. }
  13372. state = 2
  13373. open = int32(_BT_QUOT)
  13374. } else {
  13375. if open == int32(_BT_QUOT) {
  13376. state = 0
  13377. if nAtts < attsMax {
  13378. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  13379. }
  13380. nAtts++
  13381. }
  13382. }
  13383. case int32(_BT_APOS):
  13384. if state != 2 {
  13385. if nAtts < attsMax {
  13386. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(1)
  13387. }
  13388. state = 2
  13389. open = int32(_BT_APOS)
  13390. } else {
  13391. if open == int32(_BT_APOS) {
  13392. state = 0
  13393. if nAtts < attsMax {
  13394. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  13395. }
  13396. nAtts++
  13397. }
  13398. }
  13399. case int32(_BT_AMP):
  13400. if nAtts < attsMax {
  13401. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  13402. }
  13403. case int32(_BT_S):
  13404. if state == 1 {
  13405. state = 0
  13406. } else {
  13407. if state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0 && (ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) != int32(m_ASCII_SPACE1) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_SPACE1) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1))))))) == open) {
  13408. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  13409. }
  13410. }
  13411. case int32(_BT_CR):
  13412. fallthrough
  13413. case int32(_BT_LF):
  13414. /* This case ensures that the first attribute name is counted
  13415. Apart from that we could just change state on the quote. */
  13416. if state == 1 {
  13417. state = 0
  13418. } else {
  13419. if state == 2 && nAtts < attsMax {
  13420. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  13421. }
  13422. }
  13423. case int32(_BT_GT):
  13424. fallthrough
  13425. case int32(_BT_SOL):
  13426. if state != 2 {
  13427. return nAtts
  13428. }
  13429. default:
  13430. break
  13431. }
  13432. goto _1
  13433. _1:
  13434. ;
  13435. ptr += uintptr(1)
  13436. }
  13437. /* not reached */
  13438. return r
  13439. }
  13440. func _normal_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  13441. var c, c1, result int32
  13442. _, _, _ = c, c1, result
  13443. result = 0
  13444. /* skip &# */
  13445. _ = enc
  13446. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(1))
  13447. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x) {
  13448. ptr += uintptr(1)
  13449. for {
  13450. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  13451. break
  13452. }
  13453. c = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  13454. switch c {
  13455. case int32(m_ASCII_0):
  13456. fallthrough
  13457. case int32(m_ASCII_1):
  13458. fallthrough
  13459. case int32(m_ASCII_2):
  13460. fallthrough
  13461. case int32(m_ASCII_3):
  13462. fallthrough
  13463. case int32(m_ASCII_41):
  13464. fallthrough
  13465. case int32(m_ASCII_51):
  13466. fallthrough
  13467. case int32(m_ASCII_61):
  13468. fallthrough
  13469. case int32(m_ASCII_71):
  13470. fallthrough
  13471. case int32(m_ASCII_8):
  13472. fallthrough
  13473. case int32(m_ASCII_9):
  13474. result <<= int32(4)
  13475. result |= c - int32(m_ASCII_0)
  13476. case int32(m_ASCII_A):
  13477. fallthrough
  13478. case int32(m_ASCII_B1):
  13479. fallthrough
  13480. case int32(m_ASCII_C):
  13481. fallthrough
  13482. case int32(m_ASCII_D):
  13483. fallthrough
  13484. case int32(m_ASCII_E):
  13485. fallthrough
  13486. case int32(m_ASCII_F):
  13487. result <<= int32(4)
  13488. result += int32(10) + (c - int32(m_ASCII_A))
  13489. case int32(m_ASCII_a):
  13490. fallthrough
  13491. case int32(m_ASCII_b1):
  13492. fallthrough
  13493. case int32(m_ASCII_c):
  13494. fallthrough
  13495. case int32(m_ASCII_d1):
  13496. fallthrough
  13497. case int32(m_ASCII_e):
  13498. fallthrough
  13499. case int32(m_ASCII_f1):
  13500. result <<= int32(4)
  13501. result += int32(10) + (c - int32(m_ASCII_a))
  13502. break
  13503. }
  13504. if result >= int32(0x110000) {
  13505. return -int32(1)
  13506. }
  13507. goto _1
  13508. _1:
  13509. ;
  13510. ptr += uintptr(1)
  13511. }
  13512. } else {
  13513. for {
  13514. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  13515. break
  13516. }
  13517. c1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  13518. result *= int32(10)
  13519. result += c1 - int32(m_ASCII_0)
  13520. if result >= int32(0x110000) {
  13521. return -int32(1)
  13522. }
  13523. goto _2
  13524. _2:
  13525. ;
  13526. ptr += uintptr(1)
  13527. }
  13528. }
  13529. return _checkCharRefNumber(tls, result)
  13530. }
  13531. func _normal_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  13532. _ = enc
  13533. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(1) {
  13534. case int64(2):
  13535. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_t) {
  13536. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  13537. case int32(m_ASCII_l):
  13538. return int32(m_ASCII_LT1)
  13539. case int32(m_ASCII_g):
  13540. return int32(m_ASCII_GT1)
  13541. }
  13542. }
  13543. case int64(3):
  13544. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a) {
  13545. ptr += uintptr(1)
  13546. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m) {
  13547. ptr += uintptr(1)
  13548. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p) {
  13549. return int32(m_ASCII_AMP1)
  13550. }
  13551. }
  13552. }
  13553. case int64(4):
  13554. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  13555. case int32(m_ASCII_q1):
  13556. ptr += uintptr(1)
  13557. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  13558. ptr += uintptr(1)
  13559. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o) {
  13560. ptr += uintptr(1)
  13561. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t) {
  13562. return int32(m_ASCII_QUOT1)
  13563. }
  13564. }
  13565. }
  13566. case int32(m_ASCII_a):
  13567. ptr += uintptr(1)
  13568. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p) {
  13569. ptr += uintptr(1)
  13570. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o) {
  13571. ptr += uintptr(1)
  13572. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s) {
  13573. return int32(m_ASCII_APOS1)
  13574. }
  13575. }
  13576. }
  13577. break
  13578. }
  13579. }
  13580. return 0
  13581. }
  13582. func _normal_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  13583. _ = enc
  13584. for {
  13585. if !(*(*uint8)(unsafe.Pointer(ptr2)) != 0) {
  13586. break
  13587. }
  13588. if int64(end1)-int64(ptr1) < int64(1) {
  13589. /* This line cannot be executed. The incoming data has already
  13590. * been tokenized once, so incomplete characters like this have
  13591. * already been eliminated from the input. Retaining the
  13592. * paranoia check is still valuable, however.
  13593. */
  13594. return 0 /* LCOV_EXCL_LINE */
  13595. }
  13596. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr2)))) {
  13597. return 0
  13598. }
  13599. goto _1
  13600. _1:
  13601. ;
  13602. ptr1 += uintptr(1)
  13603. ptr2++
  13604. }
  13605. return libc.BoolInt32(ptr1 == end1)
  13606. }
  13607. func _normal_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  13608. var start uintptr
  13609. _ = start
  13610. start = ptr
  13611. for {
  13612. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13613. case int32(_BT_LEAD2):
  13614. ptr += uintptr(2)
  13615. case int32(_BT_LEAD3):
  13616. ptr += uintptr(3)
  13617. case int32(_BT_LEAD4):
  13618. ptr += uintptr(4)
  13619. case int32(_BT_NONASCII):
  13620. fallthrough
  13621. case int32(_BT_NMSTRT):
  13622. fallthrough
  13623. case int32(_BT_COLON):
  13624. fallthrough
  13625. case int32(_BT_HEX):
  13626. fallthrough
  13627. case int32(_BT_DIGIT):
  13628. fallthrough
  13629. case int32(_BT_NAME):
  13630. fallthrough
  13631. case int32(_BT_MINUS):
  13632. ptr += uintptr(1)
  13633. default:
  13634. return int32(int64(ptr) - int64(start))
  13635. }
  13636. goto _1
  13637. _1:
  13638. }
  13639. return r
  13640. }
  13641. func _normal_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  13642. for {
  13643. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13644. case int32(_BT_LF):
  13645. fallthrough
  13646. case int32(_BT_CR):
  13647. fallthrough
  13648. case int32(_BT_S):
  13649. ptr += uintptr(1)
  13650. default:
  13651. return ptr
  13652. }
  13653. goto _1
  13654. _1:
  13655. }
  13656. return r
  13657. }
  13658. func _normal_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  13659. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13660. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13661. case int32(_BT_LEAD2):
  13662. ptr += uintptr(2)
  13663. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  13664. case int32(_BT_LEAD3):
  13665. ptr += uintptr(3)
  13666. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  13667. case int32(_BT_LEAD4):
  13668. ptr += uintptr(4)
  13669. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  13670. case int32(_BT_LF):
  13671. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  13672. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  13673. ptr += uintptr(1)
  13674. case int32(_BT_CR):
  13675. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  13676. ptr += uintptr(1)
  13677. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  13678. ptr += uintptr(1)
  13679. }
  13680. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  13681. default:
  13682. ptr += uintptr(1)
  13683. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  13684. break
  13685. }
  13686. }
  13687. }
  13688. const /* UTF8_cvalN is value of masked first byte of N byte sequence */
  13689. _UTF8_cval1 = 0
  13690. const _UTF8_cval2 = 192
  13691. const _UTF8_cval3 = 224
  13692. const _UTF8_cval4 = 240
  13693. func X_INTERNAL_trim_to_complete_utf8_characters(tls *libc.TLS, from uintptr, fromLimRef uintptr) {
  13694. var fromLim uintptr
  13695. var prev uint8
  13696. var walked Tsize_t
  13697. _, _, _ = fromLim, prev, walked
  13698. fromLim = *(*uintptr)(unsafe.Pointer(fromLimRef))
  13699. walked = uint64(0)
  13700. for {
  13701. if !(fromLim > from) {
  13702. break
  13703. }
  13704. prev = *(*uint8)(unsafe.Pointer(fromLim + uintptr(-libc.Int32FromInt32(1))))
  13705. if uint32(prev)&uint32(0xf8) == uint32(0xf0) { /* 4-byte character, lead by 0b11110xxx byte */
  13706. if walked+uint64(1) >= uint64(4) {
  13707. fromLim += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  13708. break
  13709. } else {
  13710. walked = uint64(0)
  13711. }
  13712. } else {
  13713. if uint32(prev)&uint32(0xf0) == uint32(0xe0) { /* 3-byte character, lead by 0b1110xxxx byte */
  13714. if walked+uint64(1) >= uint64(3) {
  13715. fromLim += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  13716. break
  13717. } else {
  13718. walked = uint64(0)
  13719. }
  13720. } else {
  13721. if uint32(prev)&uint32(0xe0) == uint32(0xc0) { /* 2-byte character, lead by 0b110xxxxx byte */
  13722. if walked+uint64(1) >= uint64(2) {
  13723. fromLim += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  13724. break
  13725. } else {
  13726. walked = uint64(0)
  13727. }
  13728. } else {
  13729. if uint32(prev)&uint32(0x80) == 0x00 { /* 1-byte character, matching 0b0xxxxxxx */
  13730. break
  13731. }
  13732. }
  13733. }
  13734. }
  13735. goto _1
  13736. _1:
  13737. ;
  13738. fromLim--
  13739. walked++
  13740. }
  13741. *(*uintptr)(unsafe.Pointer(fromLimRef)) = fromLim
  13742. }
  13743. func _utf8_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, _fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  13744. bp := tls.Alloc(16)
  13745. defer tls.Free(16)
  13746. *(*uintptr)(unsafe.Pointer(bp)) = _fromLim
  13747. var bytesAvailable, bytesStorable, bytesToCopy Tptrdiff_t
  13748. var fromLimBefore uintptr
  13749. var input_incomplete, output_exhausted uint8
  13750. _, _, _, _, _, _ = bytesAvailable, bytesStorable, bytesToCopy, fromLimBefore, input_incomplete, output_exhausted
  13751. input_incomplete = uint8(m_false)
  13752. output_exhausted = uint8(m_false)
  13753. /* Avoid copying partial characters (due to limited space). */
  13754. bytesAvailable = int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(*(*uintptr)(unsafe.Pointer(fromP)))
  13755. bytesStorable = int64(toLim) - int64(*(*uintptr)(unsafe.Pointer(toP)))
  13756. _ = enc
  13757. if bytesAvailable > bytesStorable {
  13758. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr(bytesStorable)
  13759. output_exhausted = uint8(m_true)
  13760. }
  13761. /* Avoid copying partial characters (from incomplete input). */
  13762. fromLimBefore = *(*uintptr)(unsafe.Pointer(bp))
  13763. X_INTERNAL_trim_to_complete_utf8_characters(tls, *(*uintptr)(unsafe.Pointer(fromP)), bp)
  13764. if *(*uintptr)(unsafe.Pointer(bp)) < fromLimBefore {
  13765. input_incomplete = uint8(m_true)
  13766. }
  13767. bytesToCopy = int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(*(*uintptr)(unsafe.Pointer(fromP)))
  13768. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), *(*uintptr)(unsafe.Pointer(fromP)), libc.Uint64FromInt64(bytesToCopy))
  13769. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(bytesToCopy)
  13770. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(bytesToCopy)
  13771. if output_exhausted != 0 { /* needs to go first */
  13772. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  13773. } else {
  13774. if input_incomplete != 0 {
  13775. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  13776. } else {
  13777. return int32(_XML_CONVERT_COMPLETED)
  13778. }
  13779. }
  13780. return r
  13781. }
  13782. func _utf8_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  13783. var from, to, v1, v2, v3, v4 uintptr
  13784. var n uint64
  13785. var res _XML_Convert_Result
  13786. _, _, _, _, _, _, _, _ = from, n, res, to, v1, v2, v3, v4
  13787. res = int32(_XML_CONVERT_COMPLETED)
  13788. to = *(*uintptr)(unsafe.Pointer(toP))
  13789. from = *(*uintptr)(unsafe.Pointer(fromP))
  13790. for from < fromLim && to < toLim {
  13791. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(from)))))) {
  13792. case int32(_BT_LEAD2):
  13793. if int64(fromLim)-int64(from) < int64(2) {
  13794. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  13795. goto after
  13796. }
  13797. v1 = to
  13798. to += 2
  13799. *(*uint16)(unsafe.Pointer(v1)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0x1f)<<libc.Int32FromInt32(6) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3f))
  13800. from += uintptr(2)
  13801. case int32(_BT_LEAD3):
  13802. if int64(fromLim)-int64(from) < int64(3) {
  13803. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  13804. goto after
  13805. }
  13806. v2 = to
  13807. to += 2
  13808. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(12) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3f)<<libc.Int32FromInt32(6) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 2)))&libc.Int32FromInt32(0x3f))
  13809. from += uintptr(3)
  13810. case int32(_BT_LEAD4):
  13811. if (int64(toLim)-int64(to))/2 < int64(2) {
  13812. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  13813. goto after
  13814. }
  13815. if int64(fromLim)-int64(from) < int64(4) {
  13816. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  13817. goto after
  13818. }
  13819. n = libc.Uint64FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from)))&int32(0x7)<<int32(18) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 1)))&int32(0x3f)<<int32(12) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 2)))&int32(0x3f)<<int32(6) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 3)))&int32(0x3f))
  13820. n -= uint64(0x10000)
  13821. *(*uint16)(unsafe.Pointer(to)) = uint16(n>>libc.Int32FromInt32(10) | libc.Uint64FromInt32(0xD800))
  13822. *(*uint16)(unsafe.Pointer(to + 1*2)) = uint16(n&libc.Uint64FromInt32(0x3FF) | libc.Uint64FromInt32(0xDC00))
  13823. to += uintptr(2) * 2
  13824. from += uintptr(4)
  13825. default:
  13826. v3 = to
  13827. to += 2
  13828. v4 = from
  13829. from++
  13830. *(*uint16)(unsafe.Pointer(v3)) = uint16(*(*uint8)(unsafe.Pointer(v4)))
  13831. break
  13832. }
  13833. }
  13834. if from < fromLim {
  13835. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  13836. }
  13837. goto after
  13838. after:
  13839. ;
  13840. *(*uintptr)(unsafe.Pointer(fromP)) = from
  13841. *(*uintptr)(unsafe.Pointer(toP)) = to
  13842. return res
  13843. }
  13844. var _utf8_encoding_ns = Tnormal_encoding{
  13845. Fenc: TENCODING{
  13846. Fscanners: [4]TSCANNER{},
  13847. FliteralScanners: [2]TSCANNER{},
  13848. FminBytesPerChar: int32(1),
  13849. FisUtf8: uint8(1),
  13850. },
  13851. Ftype1: [256]uint8{
  13852. 9: uint8(_BT_S),
  13853. 10: uint8(_BT_LF),
  13854. 13: uint8(_BT_CR),
  13855. 32: uint8(_BT_S),
  13856. 33: uint8(_BT_EXCL),
  13857. 34: uint8(_BT_QUOT),
  13858. 35: uint8(_BT_NUM),
  13859. 36: uint8(_BT_OTHER),
  13860. 37: uint8(_BT_PERCNT),
  13861. 38: uint8(_BT_AMP),
  13862. 39: uint8(_BT_APOS),
  13863. 40: uint8(_BT_LPAR),
  13864. 41: uint8(_BT_RPAR),
  13865. 42: uint8(_BT_AST),
  13866. 43: uint8(_BT_PLUS),
  13867. 44: uint8(_BT_COMMA),
  13868. 45: uint8(_BT_MINUS),
  13869. 46: uint8(_BT_NAME),
  13870. 47: uint8(_BT_SOL),
  13871. 48: uint8(_BT_DIGIT),
  13872. 49: uint8(_BT_DIGIT),
  13873. 50: uint8(_BT_DIGIT),
  13874. 51: uint8(_BT_DIGIT),
  13875. 52: uint8(_BT_DIGIT),
  13876. 53: uint8(_BT_DIGIT),
  13877. 54: uint8(_BT_DIGIT),
  13878. 55: uint8(_BT_DIGIT),
  13879. 56: uint8(_BT_DIGIT),
  13880. 57: uint8(_BT_DIGIT),
  13881. 58: uint8(_BT_COLON),
  13882. 59: uint8(_BT_SEMI),
  13883. 60: uint8(_BT_LT),
  13884. 61: uint8(_BT_EQUALS),
  13885. 62: uint8(_BT_GT),
  13886. 63: uint8(_BT_QUEST),
  13887. 64: uint8(_BT_OTHER),
  13888. 65: uint8(_BT_HEX),
  13889. 66: uint8(_BT_HEX),
  13890. 67: uint8(_BT_HEX),
  13891. 68: uint8(_BT_HEX),
  13892. 69: uint8(_BT_HEX),
  13893. 70: uint8(_BT_HEX),
  13894. 71: uint8(_BT_NMSTRT),
  13895. 72: uint8(_BT_NMSTRT),
  13896. 73: uint8(_BT_NMSTRT),
  13897. 74: uint8(_BT_NMSTRT),
  13898. 75: uint8(_BT_NMSTRT),
  13899. 76: uint8(_BT_NMSTRT),
  13900. 77: uint8(_BT_NMSTRT),
  13901. 78: uint8(_BT_NMSTRT),
  13902. 79: uint8(_BT_NMSTRT),
  13903. 80: uint8(_BT_NMSTRT),
  13904. 81: uint8(_BT_NMSTRT),
  13905. 82: uint8(_BT_NMSTRT),
  13906. 83: uint8(_BT_NMSTRT),
  13907. 84: uint8(_BT_NMSTRT),
  13908. 85: uint8(_BT_NMSTRT),
  13909. 86: uint8(_BT_NMSTRT),
  13910. 87: uint8(_BT_NMSTRT),
  13911. 88: uint8(_BT_NMSTRT),
  13912. 89: uint8(_BT_NMSTRT),
  13913. 90: uint8(_BT_NMSTRT),
  13914. 91: uint8(_BT_LSQB),
  13915. 92: uint8(_BT_OTHER),
  13916. 93: uint8(_BT_RSQB),
  13917. 94: uint8(_BT_OTHER),
  13918. 95: uint8(_BT_NMSTRT),
  13919. 96: uint8(_BT_OTHER),
  13920. 97: uint8(_BT_HEX),
  13921. 98: uint8(_BT_HEX),
  13922. 99: uint8(_BT_HEX),
  13923. 100: uint8(_BT_HEX),
  13924. 101: uint8(_BT_HEX),
  13925. 102: uint8(_BT_HEX),
  13926. 103: uint8(_BT_NMSTRT),
  13927. 104: uint8(_BT_NMSTRT),
  13928. 105: uint8(_BT_NMSTRT),
  13929. 106: uint8(_BT_NMSTRT),
  13930. 107: uint8(_BT_NMSTRT),
  13931. 108: uint8(_BT_NMSTRT),
  13932. 109: uint8(_BT_NMSTRT),
  13933. 110: uint8(_BT_NMSTRT),
  13934. 111: uint8(_BT_NMSTRT),
  13935. 112: uint8(_BT_NMSTRT),
  13936. 113: uint8(_BT_NMSTRT),
  13937. 114: uint8(_BT_NMSTRT),
  13938. 115: uint8(_BT_NMSTRT),
  13939. 116: uint8(_BT_NMSTRT),
  13940. 117: uint8(_BT_NMSTRT),
  13941. 118: uint8(_BT_NMSTRT),
  13942. 119: uint8(_BT_NMSTRT),
  13943. 120: uint8(_BT_NMSTRT),
  13944. 121: uint8(_BT_NMSTRT),
  13945. 122: uint8(_BT_NMSTRT),
  13946. 123: uint8(_BT_OTHER),
  13947. 124: uint8(_BT_VERBAR),
  13948. 125: uint8(_BT_OTHER),
  13949. 126: uint8(_BT_OTHER),
  13950. 127: uint8(_BT_OTHER),
  13951. 128: uint8(_BT_TRAIL),
  13952. 129: uint8(_BT_TRAIL),
  13953. 130: uint8(_BT_TRAIL),
  13954. 131: uint8(_BT_TRAIL),
  13955. 132: uint8(_BT_TRAIL),
  13956. 133: uint8(_BT_TRAIL),
  13957. 134: uint8(_BT_TRAIL),
  13958. 135: uint8(_BT_TRAIL),
  13959. 136: uint8(_BT_TRAIL),
  13960. 137: uint8(_BT_TRAIL),
  13961. 138: uint8(_BT_TRAIL),
  13962. 139: uint8(_BT_TRAIL),
  13963. 140: uint8(_BT_TRAIL),
  13964. 141: uint8(_BT_TRAIL),
  13965. 142: uint8(_BT_TRAIL),
  13966. 143: uint8(_BT_TRAIL),
  13967. 144: uint8(_BT_TRAIL),
  13968. 145: uint8(_BT_TRAIL),
  13969. 146: uint8(_BT_TRAIL),
  13970. 147: uint8(_BT_TRAIL),
  13971. 148: uint8(_BT_TRAIL),
  13972. 149: uint8(_BT_TRAIL),
  13973. 150: uint8(_BT_TRAIL),
  13974. 151: uint8(_BT_TRAIL),
  13975. 152: uint8(_BT_TRAIL),
  13976. 153: uint8(_BT_TRAIL),
  13977. 154: uint8(_BT_TRAIL),
  13978. 155: uint8(_BT_TRAIL),
  13979. 156: uint8(_BT_TRAIL),
  13980. 157: uint8(_BT_TRAIL),
  13981. 158: uint8(_BT_TRAIL),
  13982. 159: uint8(_BT_TRAIL),
  13983. 160: uint8(_BT_TRAIL),
  13984. 161: uint8(_BT_TRAIL),
  13985. 162: uint8(_BT_TRAIL),
  13986. 163: uint8(_BT_TRAIL),
  13987. 164: uint8(_BT_TRAIL),
  13988. 165: uint8(_BT_TRAIL),
  13989. 166: uint8(_BT_TRAIL),
  13990. 167: uint8(_BT_TRAIL),
  13991. 168: uint8(_BT_TRAIL),
  13992. 169: uint8(_BT_TRAIL),
  13993. 170: uint8(_BT_TRAIL),
  13994. 171: uint8(_BT_TRAIL),
  13995. 172: uint8(_BT_TRAIL),
  13996. 173: uint8(_BT_TRAIL),
  13997. 174: uint8(_BT_TRAIL),
  13998. 175: uint8(_BT_TRAIL),
  13999. 176: uint8(_BT_TRAIL),
  14000. 177: uint8(_BT_TRAIL),
  14001. 178: uint8(_BT_TRAIL),
  14002. 179: uint8(_BT_TRAIL),
  14003. 180: uint8(_BT_TRAIL),
  14004. 181: uint8(_BT_TRAIL),
  14005. 182: uint8(_BT_TRAIL),
  14006. 183: uint8(_BT_TRAIL),
  14007. 184: uint8(_BT_TRAIL),
  14008. 185: uint8(_BT_TRAIL),
  14009. 186: uint8(_BT_TRAIL),
  14010. 187: uint8(_BT_TRAIL),
  14011. 188: uint8(_BT_TRAIL),
  14012. 189: uint8(_BT_TRAIL),
  14013. 190: uint8(_BT_TRAIL),
  14014. 191: uint8(_BT_TRAIL),
  14015. 192: uint8(_BT_LEAD2),
  14016. 193: uint8(_BT_LEAD2),
  14017. 194: uint8(_BT_LEAD2),
  14018. 195: uint8(_BT_LEAD2),
  14019. 196: uint8(_BT_LEAD2),
  14020. 197: uint8(_BT_LEAD2),
  14021. 198: uint8(_BT_LEAD2),
  14022. 199: uint8(_BT_LEAD2),
  14023. 200: uint8(_BT_LEAD2),
  14024. 201: uint8(_BT_LEAD2),
  14025. 202: uint8(_BT_LEAD2),
  14026. 203: uint8(_BT_LEAD2),
  14027. 204: uint8(_BT_LEAD2),
  14028. 205: uint8(_BT_LEAD2),
  14029. 206: uint8(_BT_LEAD2),
  14030. 207: uint8(_BT_LEAD2),
  14031. 208: uint8(_BT_LEAD2),
  14032. 209: uint8(_BT_LEAD2),
  14033. 210: uint8(_BT_LEAD2),
  14034. 211: uint8(_BT_LEAD2),
  14035. 212: uint8(_BT_LEAD2),
  14036. 213: uint8(_BT_LEAD2),
  14037. 214: uint8(_BT_LEAD2),
  14038. 215: uint8(_BT_LEAD2),
  14039. 216: uint8(_BT_LEAD2),
  14040. 217: uint8(_BT_LEAD2),
  14041. 218: uint8(_BT_LEAD2),
  14042. 219: uint8(_BT_LEAD2),
  14043. 220: uint8(_BT_LEAD2),
  14044. 221: uint8(_BT_LEAD2),
  14045. 222: uint8(_BT_LEAD2),
  14046. 223: uint8(_BT_LEAD2),
  14047. 224: uint8(_BT_LEAD3),
  14048. 225: uint8(_BT_LEAD3),
  14049. 226: uint8(_BT_LEAD3),
  14050. 227: uint8(_BT_LEAD3),
  14051. 228: uint8(_BT_LEAD3),
  14052. 229: uint8(_BT_LEAD3),
  14053. 230: uint8(_BT_LEAD3),
  14054. 231: uint8(_BT_LEAD3),
  14055. 232: uint8(_BT_LEAD3),
  14056. 233: uint8(_BT_LEAD3),
  14057. 234: uint8(_BT_LEAD3),
  14058. 235: uint8(_BT_LEAD3),
  14059. 236: uint8(_BT_LEAD3),
  14060. 237: uint8(_BT_LEAD3),
  14061. 238: uint8(_BT_LEAD3),
  14062. 239: uint8(_BT_LEAD3),
  14063. 240: uint8(_BT_LEAD4),
  14064. 241: uint8(_BT_LEAD4),
  14065. 242: uint8(_BT_LEAD4),
  14066. 243: uint8(_BT_LEAD4),
  14067. 244: uint8(_BT_LEAD4),
  14068. 254: uint8(_BT_MALFORM),
  14069. 255: uint8(_BT_MALFORM),
  14070. },
  14071. }
  14072. func init() {
  14073. p := unsafe.Pointer(&_utf8_encoding_ns)
  14074. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  14075. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  14076. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  14077. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  14078. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  14079. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  14080. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  14081. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  14082. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  14083. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  14084. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  14085. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  14086. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  14087. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  14088. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  14089. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  14090. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  14091. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  14092. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  14093. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  14094. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  14095. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  14096. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  14097. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  14098. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  14099. }
  14100. var _utf8_encoding = Tnormal_encoding{
  14101. Fenc: TENCODING{
  14102. Fscanners: [4]TSCANNER{},
  14103. FliteralScanners: [2]TSCANNER{},
  14104. FminBytesPerChar: int32(1),
  14105. FisUtf8: uint8(1),
  14106. },
  14107. Ftype1: [256]uint8{
  14108. 9: uint8(_BT_S),
  14109. 10: uint8(_BT_LF),
  14110. 13: uint8(_BT_CR),
  14111. 32: uint8(_BT_S),
  14112. 33: uint8(_BT_EXCL),
  14113. 34: uint8(_BT_QUOT),
  14114. 35: uint8(_BT_NUM),
  14115. 36: uint8(_BT_OTHER),
  14116. 37: uint8(_BT_PERCNT),
  14117. 38: uint8(_BT_AMP),
  14118. 39: uint8(_BT_APOS),
  14119. 40: uint8(_BT_LPAR),
  14120. 41: uint8(_BT_RPAR),
  14121. 42: uint8(_BT_AST),
  14122. 43: uint8(_BT_PLUS),
  14123. 44: uint8(_BT_COMMA),
  14124. 45: uint8(_BT_MINUS),
  14125. 46: uint8(_BT_NAME),
  14126. 47: uint8(_BT_SOL),
  14127. 48: uint8(_BT_DIGIT),
  14128. 49: uint8(_BT_DIGIT),
  14129. 50: uint8(_BT_DIGIT),
  14130. 51: uint8(_BT_DIGIT),
  14131. 52: uint8(_BT_DIGIT),
  14132. 53: uint8(_BT_DIGIT),
  14133. 54: uint8(_BT_DIGIT),
  14134. 55: uint8(_BT_DIGIT),
  14135. 56: uint8(_BT_DIGIT),
  14136. 57: uint8(_BT_DIGIT),
  14137. 58: uint8(_BT_NMSTRT),
  14138. 59: uint8(_BT_SEMI),
  14139. 60: uint8(_BT_LT),
  14140. 61: uint8(_BT_EQUALS),
  14141. 62: uint8(_BT_GT),
  14142. 63: uint8(_BT_QUEST),
  14143. 64: uint8(_BT_OTHER),
  14144. 65: uint8(_BT_HEX),
  14145. 66: uint8(_BT_HEX),
  14146. 67: uint8(_BT_HEX),
  14147. 68: uint8(_BT_HEX),
  14148. 69: uint8(_BT_HEX),
  14149. 70: uint8(_BT_HEX),
  14150. 71: uint8(_BT_NMSTRT),
  14151. 72: uint8(_BT_NMSTRT),
  14152. 73: uint8(_BT_NMSTRT),
  14153. 74: uint8(_BT_NMSTRT),
  14154. 75: uint8(_BT_NMSTRT),
  14155. 76: uint8(_BT_NMSTRT),
  14156. 77: uint8(_BT_NMSTRT),
  14157. 78: uint8(_BT_NMSTRT),
  14158. 79: uint8(_BT_NMSTRT),
  14159. 80: uint8(_BT_NMSTRT),
  14160. 81: uint8(_BT_NMSTRT),
  14161. 82: uint8(_BT_NMSTRT),
  14162. 83: uint8(_BT_NMSTRT),
  14163. 84: uint8(_BT_NMSTRT),
  14164. 85: uint8(_BT_NMSTRT),
  14165. 86: uint8(_BT_NMSTRT),
  14166. 87: uint8(_BT_NMSTRT),
  14167. 88: uint8(_BT_NMSTRT),
  14168. 89: uint8(_BT_NMSTRT),
  14169. 90: uint8(_BT_NMSTRT),
  14170. 91: uint8(_BT_LSQB),
  14171. 92: uint8(_BT_OTHER),
  14172. 93: uint8(_BT_RSQB),
  14173. 94: uint8(_BT_OTHER),
  14174. 95: uint8(_BT_NMSTRT),
  14175. 96: uint8(_BT_OTHER),
  14176. 97: uint8(_BT_HEX),
  14177. 98: uint8(_BT_HEX),
  14178. 99: uint8(_BT_HEX),
  14179. 100: uint8(_BT_HEX),
  14180. 101: uint8(_BT_HEX),
  14181. 102: uint8(_BT_HEX),
  14182. 103: uint8(_BT_NMSTRT),
  14183. 104: uint8(_BT_NMSTRT),
  14184. 105: uint8(_BT_NMSTRT),
  14185. 106: uint8(_BT_NMSTRT),
  14186. 107: uint8(_BT_NMSTRT),
  14187. 108: uint8(_BT_NMSTRT),
  14188. 109: uint8(_BT_NMSTRT),
  14189. 110: uint8(_BT_NMSTRT),
  14190. 111: uint8(_BT_NMSTRT),
  14191. 112: uint8(_BT_NMSTRT),
  14192. 113: uint8(_BT_NMSTRT),
  14193. 114: uint8(_BT_NMSTRT),
  14194. 115: uint8(_BT_NMSTRT),
  14195. 116: uint8(_BT_NMSTRT),
  14196. 117: uint8(_BT_NMSTRT),
  14197. 118: uint8(_BT_NMSTRT),
  14198. 119: uint8(_BT_NMSTRT),
  14199. 120: uint8(_BT_NMSTRT),
  14200. 121: uint8(_BT_NMSTRT),
  14201. 122: uint8(_BT_NMSTRT),
  14202. 123: uint8(_BT_OTHER),
  14203. 124: uint8(_BT_VERBAR),
  14204. 125: uint8(_BT_OTHER),
  14205. 126: uint8(_BT_OTHER),
  14206. 127: uint8(_BT_OTHER),
  14207. 128: uint8(_BT_TRAIL),
  14208. 129: uint8(_BT_TRAIL),
  14209. 130: uint8(_BT_TRAIL),
  14210. 131: uint8(_BT_TRAIL),
  14211. 132: uint8(_BT_TRAIL),
  14212. 133: uint8(_BT_TRAIL),
  14213. 134: uint8(_BT_TRAIL),
  14214. 135: uint8(_BT_TRAIL),
  14215. 136: uint8(_BT_TRAIL),
  14216. 137: uint8(_BT_TRAIL),
  14217. 138: uint8(_BT_TRAIL),
  14218. 139: uint8(_BT_TRAIL),
  14219. 140: uint8(_BT_TRAIL),
  14220. 141: uint8(_BT_TRAIL),
  14221. 142: uint8(_BT_TRAIL),
  14222. 143: uint8(_BT_TRAIL),
  14223. 144: uint8(_BT_TRAIL),
  14224. 145: uint8(_BT_TRAIL),
  14225. 146: uint8(_BT_TRAIL),
  14226. 147: uint8(_BT_TRAIL),
  14227. 148: uint8(_BT_TRAIL),
  14228. 149: uint8(_BT_TRAIL),
  14229. 150: uint8(_BT_TRAIL),
  14230. 151: uint8(_BT_TRAIL),
  14231. 152: uint8(_BT_TRAIL),
  14232. 153: uint8(_BT_TRAIL),
  14233. 154: uint8(_BT_TRAIL),
  14234. 155: uint8(_BT_TRAIL),
  14235. 156: uint8(_BT_TRAIL),
  14236. 157: uint8(_BT_TRAIL),
  14237. 158: uint8(_BT_TRAIL),
  14238. 159: uint8(_BT_TRAIL),
  14239. 160: uint8(_BT_TRAIL),
  14240. 161: uint8(_BT_TRAIL),
  14241. 162: uint8(_BT_TRAIL),
  14242. 163: uint8(_BT_TRAIL),
  14243. 164: uint8(_BT_TRAIL),
  14244. 165: uint8(_BT_TRAIL),
  14245. 166: uint8(_BT_TRAIL),
  14246. 167: uint8(_BT_TRAIL),
  14247. 168: uint8(_BT_TRAIL),
  14248. 169: uint8(_BT_TRAIL),
  14249. 170: uint8(_BT_TRAIL),
  14250. 171: uint8(_BT_TRAIL),
  14251. 172: uint8(_BT_TRAIL),
  14252. 173: uint8(_BT_TRAIL),
  14253. 174: uint8(_BT_TRAIL),
  14254. 175: uint8(_BT_TRAIL),
  14255. 176: uint8(_BT_TRAIL),
  14256. 177: uint8(_BT_TRAIL),
  14257. 178: uint8(_BT_TRAIL),
  14258. 179: uint8(_BT_TRAIL),
  14259. 180: uint8(_BT_TRAIL),
  14260. 181: uint8(_BT_TRAIL),
  14261. 182: uint8(_BT_TRAIL),
  14262. 183: uint8(_BT_TRAIL),
  14263. 184: uint8(_BT_TRAIL),
  14264. 185: uint8(_BT_TRAIL),
  14265. 186: uint8(_BT_TRAIL),
  14266. 187: uint8(_BT_TRAIL),
  14267. 188: uint8(_BT_TRAIL),
  14268. 189: uint8(_BT_TRAIL),
  14269. 190: uint8(_BT_TRAIL),
  14270. 191: uint8(_BT_TRAIL),
  14271. 192: uint8(_BT_LEAD2),
  14272. 193: uint8(_BT_LEAD2),
  14273. 194: uint8(_BT_LEAD2),
  14274. 195: uint8(_BT_LEAD2),
  14275. 196: uint8(_BT_LEAD2),
  14276. 197: uint8(_BT_LEAD2),
  14277. 198: uint8(_BT_LEAD2),
  14278. 199: uint8(_BT_LEAD2),
  14279. 200: uint8(_BT_LEAD2),
  14280. 201: uint8(_BT_LEAD2),
  14281. 202: uint8(_BT_LEAD2),
  14282. 203: uint8(_BT_LEAD2),
  14283. 204: uint8(_BT_LEAD2),
  14284. 205: uint8(_BT_LEAD2),
  14285. 206: uint8(_BT_LEAD2),
  14286. 207: uint8(_BT_LEAD2),
  14287. 208: uint8(_BT_LEAD2),
  14288. 209: uint8(_BT_LEAD2),
  14289. 210: uint8(_BT_LEAD2),
  14290. 211: uint8(_BT_LEAD2),
  14291. 212: uint8(_BT_LEAD2),
  14292. 213: uint8(_BT_LEAD2),
  14293. 214: uint8(_BT_LEAD2),
  14294. 215: uint8(_BT_LEAD2),
  14295. 216: uint8(_BT_LEAD2),
  14296. 217: uint8(_BT_LEAD2),
  14297. 218: uint8(_BT_LEAD2),
  14298. 219: uint8(_BT_LEAD2),
  14299. 220: uint8(_BT_LEAD2),
  14300. 221: uint8(_BT_LEAD2),
  14301. 222: uint8(_BT_LEAD2),
  14302. 223: uint8(_BT_LEAD2),
  14303. 224: uint8(_BT_LEAD3),
  14304. 225: uint8(_BT_LEAD3),
  14305. 226: uint8(_BT_LEAD3),
  14306. 227: uint8(_BT_LEAD3),
  14307. 228: uint8(_BT_LEAD3),
  14308. 229: uint8(_BT_LEAD3),
  14309. 230: uint8(_BT_LEAD3),
  14310. 231: uint8(_BT_LEAD3),
  14311. 232: uint8(_BT_LEAD3),
  14312. 233: uint8(_BT_LEAD3),
  14313. 234: uint8(_BT_LEAD3),
  14314. 235: uint8(_BT_LEAD3),
  14315. 236: uint8(_BT_LEAD3),
  14316. 237: uint8(_BT_LEAD3),
  14317. 238: uint8(_BT_LEAD3),
  14318. 239: uint8(_BT_LEAD3),
  14319. 240: uint8(_BT_LEAD4),
  14320. 241: uint8(_BT_LEAD4),
  14321. 242: uint8(_BT_LEAD4),
  14322. 243: uint8(_BT_LEAD4),
  14323. 244: uint8(_BT_LEAD4),
  14324. 254: uint8(_BT_MALFORM),
  14325. 255: uint8(_BT_MALFORM),
  14326. },
  14327. }
  14328. func init() {
  14329. p := unsafe.Pointer(&_utf8_encoding)
  14330. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  14331. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  14332. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  14333. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  14334. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  14335. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  14336. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  14337. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  14338. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  14339. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  14340. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  14341. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  14342. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  14343. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  14344. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  14345. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  14346. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  14347. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  14348. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  14349. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  14350. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  14351. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  14352. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  14353. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  14354. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  14355. }
  14356. var _internal_utf8_encoding_ns = Tnormal_encoding{
  14357. Fenc: TENCODING{
  14358. Fscanners: [4]TSCANNER{},
  14359. FliteralScanners: [2]TSCANNER{},
  14360. FminBytesPerChar: int32(1),
  14361. FisUtf8: uint8(1),
  14362. },
  14363. Ftype1: [256]uint8{
  14364. 9: uint8(_BT_S),
  14365. 10: uint8(_BT_LF),
  14366. 13: uint8(_BT_S),
  14367. 32: uint8(_BT_S),
  14368. 33: uint8(_BT_EXCL),
  14369. 34: uint8(_BT_QUOT),
  14370. 35: uint8(_BT_NUM),
  14371. 36: uint8(_BT_OTHER),
  14372. 37: uint8(_BT_PERCNT),
  14373. 38: uint8(_BT_AMP),
  14374. 39: uint8(_BT_APOS),
  14375. 40: uint8(_BT_LPAR),
  14376. 41: uint8(_BT_RPAR),
  14377. 42: uint8(_BT_AST),
  14378. 43: uint8(_BT_PLUS),
  14379. 44: uint8(_BT_COMMA),
  14380. 45: uint8(_BT_MINUS),
  14381. 46: uint8(_BT_NAME),
  14382. 47: uint8(_BT_SOL),
  14383. 48: uint8(_BT_DIGIT),
  14384. 49: uint8(_BT_DIGIT),
  14385. 50: uint8(_BT_DIGIT),
  14386. 51: uint8(_BT_DIGIT),
  14387. 52: uint8(_BT_DIGIT),
  14388. 53: uint8(_BT_DIGIT),
  14389. 54: uint8(_BT_DIGIT),
  14390. 55: uint8(_BT_DIGIT),
  14391. 56: uint8(_BT_DIGIT),
  14392. 57: uint8(_BT_DIGIT),
  14393. 58: uint8(_BT_COLON),
  14394. 59: uint8(_BT_SEMI),
  14395. 60: uint8(_BT_LT),
  14396. 61: uint8(_BT_EQUALS),
  14397. 62: uint8(_BT_GT),
  14398. 63: uint8(_BT_QUEST),
  14399. 64: uint8(_BT_OTHER),
  14400. 65: uint8(_BT_HEX),
  14401. 66: uint8(_BT_HEX),
  14402. 67: uint8(_BT_HEX),
  14403. 68: uint8(_BT_HEX),
  14404. 69: uint8(_BT_HEX),
  14405. 70: uint8(_BT_HEX),
  14406. 71: uint8(_BT_NMSTRT),
  14407. 72: uint8(_BT_NMSTRT),
  14408. 73: uint8(_BT_NMSTRT),
  14409. 74: uint8(_BT_NMSTRT),
  14410. 75: uint8(_BT_NMSTRT),
  14411. 76: uint8(_BT_NMSTRT),
  14412. 77: uint8(_BT_NMSTRT),
  14413. 78: uint8(_BT_NMSTRT),
  14414. 79: uint8(_BT_NMSTRT),
  14415. 80: uint8(_BT_NMSTRT),
  14416. 81: uint8(_BT_NMSTRT),
  14417. 82: uint8(_BT_NMSTRT),
  14418. 83: uint8(_BT_NMSTRT),
  14419. 84: uint8(_BT_NMSTRT),
  14420. 85: uint8(_BT_NMSTRT),
  14421. 86: uint8(_BT_NMSTRT),
  14422. 87: uint8(_BT_NMSTRT),
  14423. 88: uint8(_BT_NMSTRT),
  14424. 89: uint8(_BT_NMSTRT),
  14425. 90: uint8(_BT_NMSTRT),
  14426. 91: uint8(_BT_LSQB),
  14427. 92: uint8(_BT_OTHER),
  14428. 93: uint8(_BT_RSQB),
  14429. 94: uint8(_BT_OTHER),
  14430. 95: uint8(_BT_NMSTRT),
  14431. 96: uint8(_BT_OTHER),
  14432. 97: uint8(_BT_HEX),
  14433. 98: uint8(_BT_HEX),
  14434. 99: uint8(_BT_HEX),
  14435. 100: uint8(_BT_HEX),
  14436. 101: uint8(_BT_HEX),
  14437. 102: uint8(_BT_HEX),
  14438. 103: uint8(_BT_NMSTRT),
  14439. 104: uint8(_BT_NMSTRT),
  14440. 105: uint8(_BT_NMSTRT),
  14441. 106: uint8(_BT_NMSTRT),
  14442. 107: uint8(_BT_NMSTRT),
  14443. 108: uint8(_BT_NMSTRT),
  14444. 109: uint8(_BT_NMSTRT),
  14445. 110: uint8(_BT_NMSTRT),
  14446. 111: uint8(_BT_NMSTRT),
  14447. 112: uint8(_BT_NMSTRT),
  14448. 113: uint8(_BT_NMSTRT),
  14449. 114: uint8(_BT_NMSTRT),
  14450. 115: uint8(_BT_NMSTRT),
  14451. 116: uint8(_BT_NMSTRT),
  14452. 117: uint8(_BT_NMSTRT),
  14453. 118: uint8(_BT_NMSTRT),
  14454. 119: uint8(_BT_NMSTRT),
  14455. 120: uint8(_BT_NMSTRT),
  14456. 121: uint8(_BT_NMSTRT),
  14457. 122: uint8(_BT_NMSTRT),
  14458. 123: uint8(_BT_OTHER),
  14459. 124: uint8(_BT_VERBAR),
  14460. 125: uint8(_BT_OTHER),
  14461. 126: uint8(_BT_OTHER),
  14462. 127: uint8(_BT_OTHER),
  14463. 128: uint8(_BT_TRAIL),
  14464. 129: uint8(_BT_TRAIL),
  14465. 130: uint8(_BT_TRAIL),
  14466. 131: uint8(_BT_TRAIL),
  14467. 132: uint8(_BT_TRAIL),
  14468. 133: uint8(_BT_TRAIL),
  14469. 134: uint8(_BT_TRAIL),
  14470. 135: uint8(_BT_TRAIL),
  14471. 136: uint8(_BT_TRAIL),
  14472. 137: uint8(_BT_TRAIL),
  14473. 138: uint8(_BT_TRAIL),
  14474. 139: uint8(_BT_TRAIL),
  14475. 140: uint8(_BT_TRAIL),
  14476. 141: uint8(_BT_TRAIL),
  14477. 142: uint8(_BT_TRAIL),
  14478. 143: uint8(_BT_TRAIL),
  14479. 144: uint8(_BT_TRAIL),
  14480. 145: uint8(_BT_TRAIL),
  14481. 146: uint8(_BT_TRAIL),
  14482. 147: uint8(_BT_TRAIL),
  14483. 148: uint8(_BT_TRAIL),
  14484. 149: uint8(_BT_TRAIL),
  14485. 150: uint8(_BT_TRAIL),
  14486. 151: uint8(_BT_TRAIL),
  14487. 152: uint8(_BT_TRAIL),
  14488. 153: uint8(_BT_TRAIL),
  14489. 154: uint8(_BT_TRAIL),
  14490. 155: uint8(_BT_TRAIL),
  14491. 156: uint8(_BT_TRAIL),
  14492. 157: uint8(_BT_TRAIL),
  14493. 158: uint8(_BT_TRAIL),
  14494. 159: uint8(_BT_TRAIL),
  14495. 160: uint8(_BT_TRAIL),
  14496. 161: uint8(_BT_TRAIL),
  14497. 162: uint8(_BT_TRAIL),
  14498. 163: uint8(_BT_TRAIL),
  14499. 164: uint8(_BT_TRAIL),
  14500. 165: uint8(_BT_TRAIL),
  14501. 166: uint8(_BT_TRAIL),
  14502. 167: uint8(_BT_TRAIL),
  14503. 168: uint8(_BT_TRAIL),
  14504. 169: uint8(_BT_TRAIL),
  14505. 170: uint8(_BT_TRAIL),
  14506. 171: uint8(_BT_TRAIL),
  14507. 172: uint8(_BT_TRAIL),
  14508. 173: uint8(_BT_TRAIL),
  14509. 174: uint8(_BT_TRAIL),
  14510. 175: uint8(_BT_TRAIL),
  14511. 176: uint8(_BT_TRAIL),
  14512. 177: uint8(_BT_TRAIL),
  14513. 178: uint8(_BT_TRAIL),
  14514. 179: uint8(_BT_TRAIL),
  14515. 180: uint8(_BT_TRAIL),
  14516. 181: uint8(_BT_TRAIL),
  14517. 182: uint8(_BT_TRAIL),
  14518. 183: uint8(_BT_TRAIL),
  14519. 184: uint8(_BT_TRAIL),
  14520. 185: uint8(_BT_TRAIL),
  14521. 186: uint8(_BT_TRAIL),
  14522. 187: uint8(_BT_TRAIL),
  14523. 188: uint8(_BT_TRAIL),
  14524. 189: uint8(_BT_TRAIL),
  14525. 190: uint8(_BT_TRAIL),
  14526. 191: uint8(_BT_TRAIL),
  14527. 192: uint8(_BT_LEAD2),
  14528. 193: uint8(_BT_LEAD2),
  14529. 194: uint8(_BT_LEAD2),
  14530. 195: uint8(_BT_LEAD2),
  14531. 196: uint8(_BT_LEAD2),
  14532. 197: uint8(_BT_LEAD2),
  14533. 198: uint8(_BT_LEAD2),
  14534. 199: uint8(_BT_LEAD2),
  14535. 200: uint8(_BT_LEAD2),
  14536. 201: uint8(_BT_LEAD2),
  14537. 202: uint8(_BT_LEAD2),
  14538. 203: uint8(_BT_LEAD2),
  14539. 204: uint8(_BT_LEAD2),
  14540. 205: uint8(_BT_LEAD2),
  14541. 206: uint8(_BT_LEAD2),
  14542. 207: uint8(_BT_LEAD2),
  14543. 208: uint8(_BT_LEAD2),
  14544. 209: uint8(_BT_LEAD2),
  14545. 210: uint8(_BT_LEAD2),
  14546. 211: uint8(_BT_LEAD2),
  14547. 212: uint8(_BT_LEAD2),
  14548. 213: uint8(_BT_LEAD2),
  14549. 214: uint8(_BT_LEAD2),
  14550. 215: uint8(_BT_LEAD2),
  14551. 216: uint8(_BT_LEAD2),
  14552. 217: uint8(_BT_LEAD2),
  14553. 218: uint8(_BT_LEAD2),
  14554. 219: uint8(_BT_LEAD2),
  14555. 220: uint8(_BT_LEAD2),
  14556. 221: uint8(_BT_LEAD2),
  14557. 222: uint8(_BT_LEAD2),
  14558. 223: uint8(_BT_LEAD2),
  14559. 224: uint8(_BT_LEAD3),
  14560. 225: uint8(_BT_LEAD3),
  14561. 226: uint8(_BT_LEAD3),
  14562. 227: uint8(_BT_LEAD3),
  14563. 228: uint8(_BT_LEAD3),
  14564. 229: uint8(_BT_LEAD3),
  14565. 230: uint8(_BT_LEAD3),
  14566. 231: uint8(_BT_LEAD3),
  14567. 232: uint8(_BT_LEAD3),
  14568. 233: uint8(_BT_LEAD3),
  14569. 234: uint8(_BT_LEAD3),
  14570. 235: uint8(_BT_LEAD3),
  14571. 236: uint8(_BT_LEAD3),
  14572. 237: uint8(_BT_LEAD3),
  14573. 238: uint8(_BT_LEAD3),
  14574. 239: uint8(_BT_LEAD3),
  14575. 240: uint8(_BT_LEAD4),
  14576. 241: uint8(_BT_LEAD4),
  14577. 242: uint8(_BT_LEAD4),
  14578. 243: uint8(_BT_LEAD4),
  14579. 244: uint8(_BT_LEAD4),
  14580. 254: uint8(_BT_MALFORM),
  14581. 255: uint8(_BT_MALFORM),
  14582. },
  14583. }
  14584. func init() {
  14585. p := unsafe.Pointer(&_internal_utf8_encoding_ns)
  14586. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  14587. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  14588. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  14589. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  14590. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  14591. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  14592. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  14593. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  14594. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  14595. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  14596. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  14597. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  14598. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  14599. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  14600. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  14601. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  14602. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  14603. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  14604. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  14605. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  14606. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  14607. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  14608. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  14609. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  14610. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  14611. }
  14612. var _internal_utf8_encoding = Tnormal_encoding{
  14613. Fenc: TENCODING{
  14614. Fscanners: [4]TSCANNER{},
  14615. FliteralScanners: [2]TSCANNER{},
  14616. FminBytesPerChar: int32(1),
  14617. FisUtf8: uint8(1),
  14618. },
  14619. Ftype1: [256]uint8{
  14620. 9: uint8(_BT_S),
  14621. 10: uint8(_BT_LF),
  14622. 13: uint8(_BT_S),
  14623. 32: uint8(_BT_S),
  14624. 33: uint8(_BT_EXCL),
  14625. 34: uint8(_BT_QUOT),
  14626. 35: uint8(_BT_NUM),
  14627. 36: uint8(_BT_OTHER),
  14628. 37: uint8(_BT_PERCNT),
  14629. 38: uint8(_BT_AMP),
  14630. 39: uint8(_BT_APOS),
  14631. 40: uint8(_BT_LPAR),
  14632. 41: uint8(_BT_RPAR),
  14633. 42: uint8(_BT_AST),
  14634. 43: uint8(_BT_PLUS),
  14635. 44: uint8(_BT_COMMA),
  14636. 45: uint8(_BT_MINUS),
  14637. 46: uint8(_BT_NAME),
  14638. 47: uint8(_BT_SOL),
  14639. 48: uint8(_BT_DIGIT),
  14640. 49: uint8(_BT_DIGIT),
  14641. 50: uint8(_BT_DIGIT),
  14642. 51: uint8(_BT_DIGIT),
  14643. 52: uint8(_BT_DIGIT),
  14644. 53: uint8(_BT_DIGIT),
  14645. 54: uint8(_BT_DIGIT),
  14646. 55: uint8(_BT_DIGIT),
  14647. 56: uint8(_BT_DIGIT),
  14648. 57: uint8(_BT_DIGIT),
  14649. 58: uint8(_BT_NMSTRT),
  14650. 59: uint8(_BT_SEMI),
  14651. 60: uint8(_BT_LT),
  14652. 61: uint8(_BT_EQUALS),
  14653. 62: uint8(_BT_GT),
  14654. 63: uint8(_BT_QUEST),
  14655. 64: uint8(_BT_OTHER),
  14656. 65: uint8(_BT_HEX),
  14657. 66: uint8(_BT_HEX),
  14658. 67: uint8(_BT_HEX),
  14659. 68: uint8(_BT_HEX),
  14660. 69: uint8(_BT_HEX),
  14661. 70: uint8(_BT_HEX),
  14662. 71: uint8(_BT_NMSTRT),
  14663. 72: uint8(_BT_NMSTRT),
  14664. 73: uint8(_BT_NMSTRT),
  14665. 74: uint8(_BT_NMSTRT),
  14666. 75: uint8(_BT_NMSTRT),
  14667. 76: uint8(_BT_NMSTRT),
  14668. 77: uint8(_BT_NMSTRT),
  14669. 78: uint8(_BT_NMSTRT),
  14670. 79: uint8(_BT_NMSTRT),
  14671. 80: uint8(_BT_NMSTRT),
  14672. 81: uint8(_BT_NMSTRT),
  14673. 82: uint8(_BT_NMSTRT),
  14674. 83: uint8(_BT_NMSTRT),
  14675. 84: uint8(_BT_NMSTRT),
  14676. 85: uint8(_BT_NMSTRT),
  14677. 86: uint8(_BT_NMSTRT),
  14678. 87: uint8(_BT_NMSTRT),
  14679. 88: uint8(_BT_NMSTRT),
  14680. 89: uint8(_BT_NMSTRT),
  14681. 90: uint8(_BT_NMSTRT),
  14682. 91: uint8(_BT_LSQB),
  14683. 92: uint8(_BT_OTHER),
  14684. 93: uint8(_BT_RSQB),
  14685. 94: uint8(_BT_OTHER),
  14686. 95: uint8(_BT_NMSTRT),
  14687. 96: uint8(_BT_OTHER),
  14688. 97: uint8(_BT_HEX),
  14689. 98: uint8(_BT_HEX),
  14690. 99: uint8(_BT_HEX),
  14691. 100: uint8(_BT_HEX),
  14692. 101: uint8(_BT_HEX),
  14693. 102: uint8(_BT_HEX),
  14694. 103: uint8(_BT_NMSTRT),
  14695. 104: uint8(_BT_NMSTRT),
  14696. 105: uint8(_BT_NMSTRT),
  14697. 106: uint8(_BT_NMSTRT),
  14698. 107: uint8(_BT_NMSTRT),
  14699. 108: uint8(_BT_NMSTRT),
  14700. 109: uint8(_BT_NMSTRT),
  14701. 110: uint8(_BT_NMSTRT),
  14702. 111: uint8(_BT_NMSTRT),
  14703. 112: uint8(_BT_NMSTRT),
  14704. 113: uint8(_BT_NMSTRT),
  14705. 114: uint8(_BT_NMSTRT),
  14706. 115: uint8(_BT_NMSTRT),
  14707. 116: uint8(_BT_NMSTRT),
  14708. 117: uint8(_BT_NMSTRT),
  14709. 118: uint8(_BT_NMSTRT),
  14710. 119: uint8(_BT_NMSTRT),
  14711. 120: uint8(_BT_NMSTRT),
  14712. 121: uint8(_BT_NMSTRT),
  14713. 122: uint8(_BT_NMSTRT),
  14714. 123: uint8(_BT_OTHER),
  14715. 124: uint8(_BT_VERBAR),
  14716. 125: uint8(_BT_OTHER),
  14717. 126: uint8(_BT_OTHER),
  14718. 127: uint8(_BT_OTHER),
  14719. 128: uint8(_BT_TRAIL),
  14720. 129: uint8(_BT_TRAIL),
  14721. 130: uint8(_BT_TRAIL),
  14722. 131: uint8(_BT_TRAIL),
  14723. 132: uint8(_BT_TRAIL),
  14724. 133: uint8(_BT_TRAIL),
  14725. 134: uint8(_BT_TRAIL),
  14726. 135: uint8(_BT_TRAIL),
  14727. 136: uint8(_BT_TRAIL),
  14728. 137: uint8(_BT_TRAIL),
  14729. 138: uint8(_BT_TRAIL),
  14730. 139: uint8(_BT_TRAIL),
  14731. 140: uint8(_BT_TRAIL),
  14732. 141: uint8(_BT_TRAIL),
  14733. 142: uint8(_BT_TRAIL),
  14734. 143: uint8(_BT_TRAIL),
  14735. 144: uint8(_BT_TRAIL),
  14736. 145: uint8(_BT_TRAIL),
  14737. 146: uint8(_BT_TRAIL),
  14738. 147: uint8(_BT_TRAIL),
  14739. 148: uint8(_BT_TRAIL),
  14740. 149: uint8(_BT_TRAIL),
  14741. 150: uint8(_BT_TRAIL),
  14742. 151: uint8(_BT_TRAIL),
  14743. 152: uint8(_BT_TRAIL),
  14744. 153: uint8(_BT_TRAIL),
  14745. 154: uint8(_BT_TRAIL),
  14746. 155: uint8(_BT_TRAIL),
  14747. 156: uint8(_BT_TRAIL),
  14748. 157: uint8(_BT_TRAIL),
  14749. 158: uint8(_BT_TRAIL),
  14750. 159: uint8(_BT_TRAIL),
  14751. 160: uint8(_BT_TRAIL),
  14752. 161: uint8(_BT_TRAIL),
  14753. 162: uint8(_BT_TRAIL),
  14754. 163: uint8(_BT_TRAIL),
  14755. 164: uint8(_BT_TRAIL),
  14756. 165: uint8(_BT_TRAIL),
  14757. 166: uint8(_BT_TRAIL),
  14758. 167: uint8(_BT_TRAIL),
  14759. 168: uint8(_BT_TRAIL),
  14760. 169: uint8(_BT_TRAIL),
  14761. 170: uint8(_BT_TRAIL),
  14762. 171: uint8(_BT_TRAIL),
  14763. 172: uint8(_BT_TRAIL),
  14764. 173: uint8(_BT_TRAIL),
  14765. 174: uint8(_BT_TRAIL),
  14766. 175: uint8(_BT_TRAIL),
  14767. 176: uint8(_BT_TRAIL),
  14768. 177: uint8(_BT_TRAIL),
  14769. 178: uint8(_BT_TRAIL),
  14770. 179: uint8(_BT_TRAIL),
  14771. 180: uint8(_BT_TRAIL),
  14772. 181: uint8(_BT_TRAIL),
  14773. 182: uint8(_BT_TRAIL),
  14774. 183: uint8(_BT_TRAIL),
  14775. 184: uint8(_BT_TRAIL),
  14776. 185: uint8(_BT_TRAIL),
  14777. 186: uint8(_BT_TRAIL),
  14778. 187: uint8(_BT_TRAIL),
  14779. 188: uint8(_BT_TRAIL),
  14780. 189: uint8(_BT_TRAIL),
  14781. 190: uint8(_BT_TRAIL),
  14782. 191: uint8(_BT_TRAIL),
  14783. 192: uint8(_BT_LEAD2),
  14784. 193: uint8(_BT_LEAD2),
  14785. 194: uint8(_BT_LEAD2),
  14786. 195: uint8(_BT_LEAD2),
  14787. 196: uint8(_BT_LEAD2),
  14788. 197: uint8(_BT_LEAD2),
  14789. 198: uint8(_BT_LEAD2),
  14790. 199: uint8(_BT_LEAD2),
  14791. 200: uint8(_BT_LEAD2),
  14792. 201: uint8(_BT_LEAD2),
  14793. 202: uint8(_BT_LEAD2),
  14794. 203: uint8(_BT_LEAD2),
  14795. 204: uint8(_BT_LEAD2),
  14796. 205: uint8(_BT_LEAD2),
  14797. 206: uint8(_BT_LEAD2),
  14798. 207: uint8(_BT_LEAD2),
  14799. 208: uint8(_BT_LEAD2),
  14800. 209: uint8(_BT_LEAD2),
  14801. 210: uint8(_BT_LEAD2),
  14802. 211: uint8(_BT_LEAD2),
  14803. 212: uint8(_BT_LEAD2),
  14804. 213: uint8(_BT_LEAD2),
  14805. 214: uint8(_BT_LEAD2),
  14806. 215: uint8(_BT_LEAD2),
  14807. 216: uint8(_BT_LEAD2),
  14808. 217: uint8(_BT_LEAD2),
  14809. 218: uint8(_BT_LEAD2),
  14810. 219: uint8(_BT_LEAD2),
  14811. 220: uint8(_BT_LEAD2),
  14812. 221: uint8(_BT_LEAD2),
  14813. 222: uint8(_BT_LEAD2),
  14814. 223: uint8(_BT_LEAD2),
  14815. 224: uint8(_BT_LEAD3),
  14816. 225: uint8(_BT_LEAD3),
  14817. 226: uint8(_BT_LEAD3),
  14818. 227: uint8(_BT_LEAD3),
  14819. 228: uint8(_BT_LEAD3),
  14820. 229: uint8(_BT_LEAD3),
  14821. 230: uint8(_BT_LEAD3),
  14822. 231: uint8(_BT_LEAD3),
  14823. 232: uint8(_BT_LEAD3),
  14824. 233: uint8(_BT_LEAD3),
  14825. 234: uint8(_BT_LEAD3),
  14826. 235: uint8(_BT_LEAD3),
  14827. 236: uint8(_BT_LEAD3),
  14828. 237: uint8(_BT_LEAD3),
  14829. 238: uint8(_BT_LEAD3),
  14830. 239: uint8(_BT_LEAD3),
  14831. 240: uint8(_BT_LEAD4),
  14832. 241: uint8(_BT_LEAD4),
  14833. 242: uint8(_BT_LEAD4),
  14834. 243: uint8(_BT_LEAD4),
  14835. 244: uint8(_BT_LEAD4),
  14836. 254: uint8(_BT_MALFORM),
  14837. 255: uint8(_BT_MALFORM),
  14838. },
  14839. }
  14840. func init() {
  14841. p := unsafe.Pointer(&_internal_utf8_encoding)
  14842. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  14843. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  14844. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  14845. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  14846. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  14847. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  14848. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  14849. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  14850. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  14851. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  14852. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  14853. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  14854. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  14855. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  14856. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  14857. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  14858. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  14859. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  14860. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  14861. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  14862. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  14863. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  14864. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  14865. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  14866. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  14867. }
  14868. func _latin1_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  14869. var c uint8
  14870. var v2, v3, v4, v5, v6, v7, v8, v9 uintptr
  14871. _, _, _, _, _, _, _, _, _ = c, v2, v3, v4, v5, v6, v7, v8, v9
  14872. _ = enc
  14873. for {
  14874. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  14875. return int32(_XML_CONVERT_COMPLETED)
  14876. }
  14877. c = *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))
  14878. if libc.Int32FromUint8(c)&int32(0x80) != 0 {
  14879. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  14880. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  14881. }
  14882. v3 = toP
  14883. v2 = *(*uintptr)(unsafe.Pointer(v3))
  14884. *(*uintptr)(unsafe.Pointer(v3))++
  14885. *(*uint8)(unsafe.Pointer(v2)) = libc.Uint8FromInt32(libc.Int32FromUint8(c)>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  14886. v5 = toP
  14887. v4 = *(*uintptr)(unsafe.Pointer(v5))
  14888. *(*uintptr)(unsafe.Pointer(v5))++
  14889. *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(libc.Int32FromUint8(c)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  14890. *(*uintptr)(unsafe.Pointer(fromP))++
  14891. } else {
  14892. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  14893. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  14894. }
  14895. v7 = toP
  14896. v6 = *(*uintptr)(unsafe.Pointer(v7))
  14897. *(*uintptr)(unsafe.Pointer(v7))++
  14898. v9 = fromP
  14899. v8 = *(*uintptr)(unsafe.Pointer(v9))
  14900. *(*uintptr)(unsafe.Pointer(v9))++
  14901. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(v8))
  14902. }
  14903. goto _1
  14904. _1:
  14905. }
  14906. return r
  14907. }
  14908. func _latin1_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  14909. var v1, v2, v3, v4 uintptr
  14910. _, _, _, _ = v1, v2, v3, v4
  14911. _ = enc
  14912. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  14913. v2 = toP
  14914. v1 = *(*uintptr)(unsafe.Pointer(v2))
  14915. *(*uintptr)(unsafe.Pointer(v2)) += 2
  14916. v4 = fromP
  14917. v3 = *(*uintptr)(unsafe.Pointer(v4))
  14918. *(*uintptr)(unsafe.Pointer(v4))++
  14919. *(*uint16)(unsafe.Pointer(v1)) = uint16(*(*uint8)(unsafe.Pointer(v3)))
  14920. }
  14921. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  14922. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  14923. } else {
  14924. return int32(_XML_CONVERT_COMPLETED)
  14925. }
  14926. return r
  14927. }
  14928. var _latin1_encoding_ns = Tnormal_encoding{
  14929. Fenc: TENCODING{
  14930. Fscanners: [4]TSCANNER{},
  14931. FliteralScanners: [2]TSCANNER{},
  14932. FminBytesPerChar: int32(1),
  14933. },
  14934. Ftype1: [256]uint8{
  14935. 9: uint8(_BT_S),
  14936. 10: uint8(_BT_LF),
  14937. 13: uint8(_BT_CR),
  14938. 32: uint8(_BT_S),
  14939. 33: uint8(_BT_EXCL),
  14940. 34: uint8(_BT_QUOT),
  14941. 35: uint8(_BT_NUM),
  14942. 36: uint8(_BT_OTHER),
  14943. 37: uint8(_BT_PERCNT),
  14944. 38: uint8(_BT_AMP),
  14945. 39: uint8(_BT_APOS),
  14946. 40: uint8(_BT_LPAR),
  14947. 41: uint8(_BT_RPAR),
  14948. 42: uint8(_BT_AST),
  14949. 43: uint8(_BT_PLUS),
  14950. 44: uint8(_BT_COMMA),
  14951. 45: uint8(_BT_MINUS),
  14952. 46: uint8(_BT_NAME),
  14953. 47: uint8(_BT_SOL),
  14954. 48: uint8(_BT_DIGIT),
  14955. 49: uint8(_BT_DIGIT),
  14956. 50: uint8(_BT_DIGIT),
  14957. 51: uint8(_BT_DIGIT),
  14958. 52: uint8(_BT_DIGIT),
  14959. 53: uint8(_BT_DIGIT),
  14960. 54: uint8(_BT_DIGIT),
  14961. 55: uint8(_BT_DIGIT),
  14962. 56: uint8(_BT_DIGIT),
  14963. 57: uint8(_BT_DIGIT),
  14964. 58: uint8(_BT_COLON),
  14965. 59: uint8(_BT_SEMI),
  14966. 60: uint8(_BT_LT),
  14967. 61: uint8(_BT_EQUALS),
  14968. 62: uint8(_BT_GT),
  14969. 63: uint8(_BT_QUEST),
  14970. 64: uint8(_BT_OTHER),
  14971. 65: uint8(_BT_HEX),
  14972. 66: uint8(_BT_HEX),
  14973. 67: uint8(_BT_HEX),
  14974. 68: uint8(_BT_HEX),
  14975. 69: uint8(_BT_HEX),
  14976. 70: uint8(_BT_HEX),
  14977. 71: uint8(_BT_NMSTRT),
  14978. 72: uint8(_BT_NMSTRT),
  14979. 73: uint8(_BT_NMSTRT),
  14980. 74: uint8(_BT_NMSTRT),
  14981. 75: uint8(_BT_NMSTRT),
  14982. 76: uint8(_BT_NMSTRT),
  14983. 77: uint8(_BT_NMSTRT),
  14984. 78: uint8(_BT_NMSTRT),
  14985. 79: uint8(_BT_NMSTRT),
  14986. 80: uint8(_BT_NMSTRT),
  14987. 81: uint8(_BT_NMSTRT),
  14988. 82: uint8(_BT_NMSTRT),
  14989. 83: uint8(_BT_NMSTRT),
  14990. 84: uint8(_BT_NMSTRT),
  14991. 85: uint8(_BT_NMSTRT),
  14992. 86: uint8(_BT_NMSTRT),
  14993. 87: uint8(_BT_NMSTRT),
  14994. 88: uint8(_BT_NMSTRT),
  14995. 89: uint8(_BT_NMSTRT),
  14996. 90: uint8(_BT_NMSTRT),
  14997. 91: uint8(_BT_LSQB),
  14998. 92: uint8(_BT_OTHER),
  14999. 93: uint8(_BT_RSQB),
  15000. 94: uint8(_BT_OTHER),
  15001. 95: uint8(_BT_NMSTRT),
  15002. 96: uint8(_BT_OTHER),
  15003. 97: uint8(_BT_HEX),
  15004. 98: uint8(_BT_HEX),
  15005. 99: uint8(_BT_HEX),
  15006. 100: uint8(_BT_HEX),
  15007. 101: uint8(_BT_HEX),
  15008. 102: uint8(_BT_HEX),
  15009. 103: uint8(_BT_NMSTRT),
  15010. 104: uint8(_BT_NMSTRT),
  15011. 105: uint8(_BT_NMSTRT),
  15012. 106: uint8(_BT_NMSTRT),
  15013. 107: uint8(_BT_NMSTRT),
  15014. 108: uint8(_BT_NMSTRT),
  15015. 109: uint8(_BT_NMSTRT),
  15016. 110: uint8(_BT_NMSTRT),
  15017. 111: uint8(_BT_NMSTRT),
  15018. 112: uint8(_BT_NMSTRT),
  15019. 113: uint8(_BT_NMSTRT),
  15020. 114: uint8(_BT_NMSTRT),
  15021. 115: uint8(_BT_NMSTRT),
  15022. 116: uint8(_BT_NMSTRT),
  15023. 117: uint8(_BT_NMSTRT),
  15024. 118: uint8(_BT_NMSTRT),
  15025. 119: uint8(_BT_NMSTRT),
  15026. 120: uint8(_BT_NMSTRT),
  15027. 121: uint8(_BT_NMSTRT),
  15028. 122: uint8(_BT_NMSTRT),
  15029. 123: uint8(_BT_OTHER),
  15030. 124: uint8(_BT_VERBAR),
  15031. 125: uint8(_BT_OTHER),
  15032. 126: uint8(_BT_OTHER),
  15033. 127: uint8(_BT_OTHER),
  15034. 128: uint8(_BT_OTHER),
  15035. 129: uint8(_BT_OTHER),
  15036. 130: uint8(_BT_OTHER),
  15037. 131: uint8(_BT_OTHER),
  15038. 132: uint8(_BT_OTHER),
  15039. 133: uint8(_BT_OTHER),
  15040. 134: uint8(_BT_OTHER),
  15041. 135: uint8(_BT_OTHER),
  15042. 136: uint8(_BT_OTHER),
  15043. 137: uint8(_BT_OTHER),
  15044. 138: uint8(_BT_OTHER),
  15045. 139: uint8(_BT_OTHER),
  15046. 140: uint8(_BT_OTHER),
  15047. 141: uint8(_BT_OTHER),
  15048. 142: uint8(_BT_OTHER),
  15049. 143: uint8(_BT_OTHER),
  15050. 144: uint8(_BT_OTHER),
  15051. 145: uint8(_BT_OTHER),
  15052. 146: uint8(_BT_OTHER),
  15053. 147: uint8(_BT_OTHER),
  15054. 148: uint8(_BT_OTHER),
  15055. 149: uint8(_BT_OTHER),
  15056. 150: uint8(_BT_OTHER),
  15057. 151: uint8(_BT_OTHER),
  15058. 152: uint8(_BT_OTHER),
  15059. 153: uint8(_BT_OTHER),
  15060. 154: uint8(_BT_OTHER),
  15061. 155: uint8(_BT_OTHER),
  15062. 156: uint8(_BT_OTHER),
  15063. 157: uint8(_BT_OTHER),
  15064. 158: uint8(_BT_OTHER),
  15065. 159: uint8(_BT_OTHER),
  15066. 160: uint8(_BT_OTHER),
  15067. 161: uint8(_BT_OTHER),
  15068. 162: uint8(_BT_OTHER),
  15069. 163: uint8(_BT_OTHER),
  15070. 164: uint8(_BT_OTHER),
  15071. 165: uint8(_BT_OTHER),
  15072. 166: uint8(_BT_OTHER),
  15073. 167: uint8(_BT_OTHER),
  15074. 168: uint8(_BT_OTHER),
  15075. 169: uint8(_BT_OTHER),
  15076. 170: uint8(_BT_NMSTRT),
  15077. 171: uint8(_BT_OTHER),
  15078. 172: uint8(_BT_OTHER),
  15079. 173: uint8(_BT_OTHER),
  15080. 174: uint8(_BT_OTHER),
  15081. 175: uint8(_BT_OTHER),
  15082. 176: uint8(_BT_OTHER),
  15083. 177: uint8(_BT_OTHER),
  15084. 178: uint8(_BT_OTHER),
  15085. 179: uint8(_BT_OTHER),
  15086. 180: uint8(_BT_OTHER),
  15087. 181: uint8(_BT_NMSTRT),
  15088. 182: uint8(_BT_OTHER),
  15089. 183: uint8(_BT_NAME),
  15090. 184: uint8(_BT_OTHER),
  15091. 185: uint8(_BT_OTHER),
  15092. 186: uint8(_BT_NMSTRT),
  15093. 187: uint8(_BT_OTHER),
  15094. 188: uint8(_BT_OTHER),
  15095. 189: uint8(_BT_OTHER),
  15096. 190: uint8(_BT_OTHER),
  15097. 191: uint8(_BT_OTHER),
  15098. 192: uint8(_BT_NMSTRT),
  15099. 193: uint8(_BT_NMSTRT),
  15100. 194: uint8(_BT_NMSTRT),
  15101. 195: uint8(_BT_NMSTRT),
  15102. 196: uint8(_BT_NMSTRT),
  15103. 197: uint8(_BT_NMSTRT),
  15104. 198: uint8(_BT_NMSTRT),
  15105. 199: uint8(_BT_NMSTRT),
  15106. 200: uint8(_BT_NMSTRT),
  15107. 201: uint8(_BT_NMSTRT),
  15108. 202: uint8(_BT_NMSTRT),
  15109. 203: uint8(_BT_NMSTRT),
  15110. 204: uint8(_BT_NMSTRT),
  15111. 205: uint8(_BT_NMSTRT),
  15112. 206: uint8(_BT_NMSTRT),
  15113. 207: uint8(_BT_NMSTRT),
  15114. 208: uint8(_BT_NMSTRT),
  15115. 209: uint8(_BT_NMSTRT),
  15116. 210: uint8(_BT_NMSTRT),
  15117. 211: uint8(_BT_NMSTRT),
  15118. 212: uint8(_BT_NMSTRT),
  15119. 213: uint8(_BT_NMSTRT),
  15120. 214: uint8(_BT_NMSTRT),
  15121. 215: uint8(_BT_OTHER),
  15122. 216: uint8(_BT_NMSTRT),
  15123. 217: uint8(_BT_NMSTRT),
  15124. 218: uint8(_BT_NMSTRT),
  15125. 219: uint8(_BT_NMSTRT),
  15126. 220: uint8(_BT_NMSTRT),
  15127. 221: uint8(_BT_NMSTRT),
  15128. 222: uint8(_BT_NMSTRT),
  15129. 223: uint8(_BT_NMSTRT),
  15130. 224: uint8(_BT_NMSTRT),
  15131. 225: uint8(_BT_NMSTRT),
  15132. 226: uint8(_BT_NMSTRT),
  15133. 227: uint8(_BT_NMSTRT),
  15134. 228: uint8(_BT_NMSTRT),
  15135. 229: uint8(_BT_NMSTRT),
  15136. 230: uint8(_BT_NMSTRT),
  15137. 231: uint8(_BT_NMSTRT),
  15138. 232: uint8(_BT_NMSTRT),
  15139. 233: uint8(_BT_NMSTRT),
  15140. 234: uint8(_BT_NMSTRT),
  15141. 235: uint8(_BT_NMSTRT),
  15142. 236: uint8(_BT_NMSTRT),
  15143. 237: uint8(_BT_NMSTRT),
  15144. 238: uint8(_BT_NMSTRT),
  15145. 239: uint8(_BT_NMSTRT),
  15146. 240: uint8(_BT_NMSTRT),
  15147. 241: uint8(_BT_NMSTRT),
  15148. 242: uint8(_BT_NMSTRT),
  15149. 243: uint8(_BT_NMSTRT),
  15150. 244: uint8(_BT_NMSTRT),
  15151. 245: uint8(_BT_NMSTRT),
  15152. 246: uint8(_BT_NMSTRT),
  15153. 247: uint8(_BT_OTHER),
  15154. 248: uint8(_BT_NMSTRT),
  15155. 249: uint8(_BT_NMSTRT),
  15156. 250: uint8(_BT_NMSTRT),
  15157. 251: uint8(_BT_NMSTRT),
  15158. 252: uint8(_BT_NMSTRT),
  15159. 253: uint8(_BT_NMSTRT),
  15160. 254: uint8(_BT_NMSTRT),
  15161. 255: uint8(_BT_NMSTRT),
  15162. },
  15163. }
  15164. func init() {
  15165. p := unsafe.Pointer(&_latin1_encoding_ns)
  15166. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  15167. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  15168. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  15169. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  15170. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  15171. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  15172. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  15173. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  15174. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  15175. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  15176. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  15177. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  15178. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  15179. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  15180. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_latin1_toUtf8)
  15181. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  15182. }
  15183. var _latin1_encoding = Tnormal_encoding{
  15184. Fenc: TENCODING{
  15185. Fscanners: [4]TSCANNER{},
  15186. FliteralScanners: [2]TSCANNER{},
  15187. FminBytesPerChar: int32(1),
  15188. },
  15189. Ftype1: [256]uint8{
  15190. 9: uint8(_BT_S),
  15191. 10: uint8(_BT_LF),
  15192. 13: uint8(_BT_CR),
  15193. 32: uint8(_BT_S),
  15194. 33: uint8(_BT_EXCL),
  15195. 34: uint8(_BT_QUOT),
  15196. 35: uint8(_BT_NUM),
  15197. 36: uint8(_BT_OTHER),
  15198. 37: uint8(_BT_PERCNT),
  15199. 38: uint8(_BT_AMP),
  15200. 39: uint8(_BT_APOS),
  15201. 40: uint8(_BT_LPAR),
  15202. 41: uint8(_BT_RPAR),
  15203. 42: uint8(_BT_AST),
  15204. 43: uint8(_BT_PLUS),
  15205. 44: uint8(_BT_COMMA),
  15206. 45: uint8(_BT_MINUS),
  15207. 46: uint8(_BT_NAME),
  15208. 47: uint8(_BT_SOL),
  15209. 48: uint8(_BT_DIGIT),
  15210. 49: uint8(_BT_DIGIT),
  15211. 50: uint8(_BT_DIGIT),
  15212. 51: uint8(_BT_DIGIT),
  15213. 52: uint8(_BT_DIGIT),
  15214. 53: uint8(_BT_DIGIT),
  15215. 54: uint8(_BT_DIGIT),
  15216. 55: uint8(_BT_DIGIT),
  15217. 56: uint8(_BT_DIGIT),
  15218. 57: uint8(_BT_DIGIT),
  15219. 58: uint8(_BT_NMSTRT),
  15220. 59: uint8(_BT_SEMI),
  15221. 60: uint8(_BT_LT),
  15222. 61: uint8(_BT_EQUALS),
  15223. 62: uint8(_BT_GT),
  15224. 63: uint8(_BT_QUEST),
  15225. 64: uint8(_BT_OTHER),
  15226. 65: uint8(_BT_HEX),
  15227. 66: uint8(_BT_HEX),
  15228. 67: uint8(_BT_HEX),
  15229. 68: uint8(_BT_HEX),
  15230. 69: uint8(_BT_HEX),
  15231. 70: uint8(_BT_HEX),
  15232. 71: uint8(_BT_NMSTRT),
  15233. 72: uint8(_BT_NMSTRT),
  15234. 73: uint8(_BT_NMSTRT),
  15235. 74: uint8(_BT_NMSTRT),
  15236. 75: uint8(_BT_NMSTRT),
  15237. 76: uint8(_BT_NMSTRT),
  15238. 77: uint8(_BT_NMSTRT),
  15239. 78: uint8(_BT_NMSTRT),
  15240. 79: uint8(_BT_NMSTRT),
  15241. 80: uint8(_BT_NMSTRT),
  15242. 81: uint8(_BT_NMSTRT),
  15243. 82: uint8(_BT_NMSTRT),
  15244. 83: uint8(_BT_NMSTRT),
  15245. 84: uint8(_BT_NMSTRT),
  15246. 85: uint8(_BT_NMSTRT),
  15247. 86: uint8(_BT_NMSTRT),
  15248. 87: uint8(_BT_NMSTRT),
  15249. 88: uint8(_BT_NMSTRT),
  15250. 89: uint8(_BT_NMSTRT),
  15251. 90: uint8(_BT_NMSTRT),
  15252. 91: uint8(_BT_LSQB),
  15253. 92: uint8(_BT_OTHER),
  15254. 93: uint8(_BT_RSQB),
  15255. 94: uint8(_BT_OTHER),
  15256. 95: uint8(_BT_NMSTRT),
  15257. 96: uint8(_BT_OTHER),
  15258. 97: uint8(_BT_HEX),
  15259. 98: uint8(_BT_HEX),
  15260. 99: uint8(_BT_HEX),
  15261. 100: uint8(_BT_HEX),
  15262. 101: uint8(_BT_HEX),
  15263. 102: uint8(_BT_HEX),
  15264. 103: uint8(_BT_NMSTRT),
  15265. 104: uint8(_BT_NMSTRT),
  15266. 105: uint8(_BT_NMSTRT),
  15267. 106: uint8(_BT_NMSTRT),
  15268. 107: uint8(_BT_NMSTRT),
  15269. 108: uint8(_BT_NMSTRT),
  15270. 109: uint8(_BT_NMSTRT),
  15271. 110: uint8(_BT_NMSTRT),
  15272. 111: uint8(_BT_NMSTRT),
  15273. 112: uint8(_BT_NMSTRT),
  15274. 113: uint8(_BT_NMSTRT),
  15275. 114: uint8(_BT_NMSTRT),
  15276. 115: uint8(_BT_NMSTRT),
  15277. 116: uint8(_BT_NMSTRT),
  15278. 117: uint8(_BT_NMSTRT),
  15279. 118: uint8(_BT_NMSTRT),
  15280. 119: uint8(_BT_NMSTRT),
  15281. 120: uint8(_BT_NMSTRT),
  15282. 121: uint8(_BT_NMSTRT),
  15283. 122: uint8(_BT_NMSTRT),
  15284. 123: uint8(_BT_OTHER),
  15285. 124: uint8(_BT_VERBAR),
  15286. 125: uint8(_BT_OTHER),
  15287. 126: uint8(_BT_OTHER),
  15288. 127: uint8(_BT_OTHER),
  15289. 128: uint8(_BT_OTHER),
  15290. 129: uint8(_BT_OTHER),
  15291. 130: uint8(_BT_OTHER),
  15292. 131: uint8(_BT_OTHER),
  15293. 132: uint8(_BT_OTHER),
  15294. 133: uint8(_BT_OTHER),
  15295. 134: uint8(_BT_OTHER),
  15296. 135: uint8(_BT_OTHER),
  15297. 136: uint8(_BT_OTHER),
  15298. 137: uint8(_BT_OTHER),
  15299. 138: uint8(_BT_OTHER),
  15300. 139: uint8(_BT_OTHER),
  15301. 140: uint8(_BT_OTHER),
  15302. 141: uint8(_BT_OTHER),
  15303. 142: uint8(_BT_OTHER),
  15304. 143: uint8(_BT_OTHER),
  15305. 144: uint8(_BT_OTHER),
  15306. 145: uint8(_BT_OTHER),
  15307. 146: uint8(_BT_OTHER),
  15308. 147: uint8(_BT_OTHER),
  15309. 148: uint8(_BT_OTHER),
  15310. 149: uint8(_BT_OTHER),
  15311. 150: uint8(_BT_OTHER),
  15312. 151: uint8(_BT_OTHER),
  15313. 152: uint8(_BT_OTHER),
  15314. 153: uint8(_BT_OTHER),
  15315. 154: uint8(_BT_OTHER),
  15316. 155: uint8(_BT_OTHER),
  15317. 156: uint8(_BT_OTHER),
  15318. 157: uint8(_BT_OTHER),
  15319. 158: uint8(_BT_OTHER),
  15320. 159: uint8(_BT_OTHER),
  15321. 160: uint8(_BT_OTHER),
  15322. 161: uint8(_BT_OTHER),
  15323. 162: uint8(_BT_OTHER),
  15324. 163: uint8(_BT_OTHER),
  15325. 164: uint8(_BT_OTHER),
  15326. 165: uint8(_BT_OTHER),
  15327. 166: uint8(_BT_OTHER),
  15328. 167: uint8(_BT_OTHER),
  15329. 168: uint8(_BT_OTHER),
  15330. 169: uint8(_BT_OTHER),
  15331. 170: uint8(_BT_NMSTRT),
  15332. 171: uint8(_BT_OTHER),
  15333. 172: uint8(_BT_OTHER),
  15334. 173: uint8(_BT_OTHER),
  15335. 174: uint8(_BT_OTHER),
  15336. 175: uint8(_BT_OTHER),
  15337. 176: uint8(_BT_OTHER),
  15338. 177: uint8(_BT_OTHER),
  15339. 178: uint8(_BT_OTHER),
  15340. 179: uint8(_BT_OTHER),
  15341. 180: uint8(_BT_OTHER),
  15342. 181: uint8(_BT_NMSTRT),
  15343. 182: uint8(_BT_OTHER),
  15344. 183: uint8(_BT_NAME),
  15345. 184: uint8(_BT_OTHER),
  15346. 185: uint8(_BT_OTHER),
  15347. 186: uint8(_BT_NMSTRT),
  15348. 187: uint8(_BT_OTHER),
  15349. 188: uint8(_BT_OTHER),
  15350. 189: uint8(_BT_OTHER),
  15351. 190: uint8(_BT_OTHER),
  15352. 191: uint8(_BT_OTHER),
  15353. 192: uint8(_BT_NMSTRT),
  15354. 193: uint8(_BT_NMSTRT),
  15355. 194: uint8(_BT_NMSTRT),
  15356. 195: uint8(_BT_NMSTRT),
  15357. 196: uint8(_BT_NMSTRT),
  15358. 197: uint8(_BT_NMSTRT),
  15359. 198: uint8(_BT_NMSTRT),
  15360. 199: uint8(_BT_NMSTRT),
  15361. 200: uint8(_BT_NMSTRT),
  15362. 201: uint8(_BT_NMSTRT),
  15363. 202: uint8(_BT_NMSTRT),
  15364. 203: uint8(_BT_NMSTRT),
  15365. 204: uint8(_BT_NMSTRT),
  15366. 205: uint8(_BT_NMSTRT),
  15367. 206: uint8(_BT_NMSTRT),
  15368. 207: uint8(_BT_NMSTRT),
  15369. 208: uint8(_BT_NMSTRT),
  15370. 209: uint8(_BT_NMSTRT),
  15371. 210: uint8(_BT_NMSTRT),
  15372. 211: uint8(_BT_NMSTRT),
  15373. 212: uint8(_BT_NMSTRT),
  15374. 213: uint8(_BT_NMSTRT),
  15375. 214: uint8(_BT_NMSTRT),
  15376. 215: uint8(_BT_OTHER),
  15377. 216: uint8(_BT_NMSTRT),
  15378. 217: uint8(_BT_NMSTRT),
  15379. 218: uint8(_BT_NMSTRT),
  15380. 219: uint8(_BT_NMSTRT),
  15381. 220: uint8(_BT_NMSTRT),
  15382. 221: uint8(_BT_NMSTRT),
  15383. 222: uint8(_BT_NMSTRT),
  15384. 223: uint8(_BT_NMSTRT),
  15385. 224: uint8(_BT_NMSTRT),
  15386. 225: uint8(_BT_NMSTRT),
  15387. 226: uint8(_BT_NMSTRT),
  15388. 227: uint8(_BT_NMSTRT),
  15389. 228: uint8(_BT_NMSTRT),
  15390. 229: uint8(_BT_NMSTRT),
  15391. 230: uint8(_BT_NMSTRT),
  15392. 231: uint8(_BT_NMSTRT),
  15393. 232: uint8(_BT_NMSTRT),
  15394. 233: uint8(_BT_NMSTRT),
  15395. 234: uint8(_BT_NMSTRT),
  15396. 235: uint8(_BT_NMSTRT),
  15397. 236: uint8(_BT_NMSTRT),
  15398. 237: uint8(_BT_NMSTRT),
  15399. 238: uint8(_BT_NMSTRT),
  15400. 239: uint8(_BT_NMSTRT),
  15401. 240: uint8(_BT_NMSTRT),
  15402. 241: uint8(_BT_NMSTRT),
  15403. 242: uint8(_BT_NMSTRT),
  15404. 243: uint8(_BT_NMSTRT),
  15405. 244: uint8(_BT_NMSTRT),
  15406. 245: uint8(_BT_NMSTRT),
  15407. 246: uint8(_BT_NMSTRT),
  15408. 247: uint8(_BT_OTHER),
  15409. 248: uint8(_BT_NMSTRT),
  15410. 249: uint8(_BT_NMSTRT),
  15411. 250: uint8(_BT_NMSTRT),
  15412. 251: uint8(_BT_NMSTRT),
  15413. 252: uint8(_BT_NMSTRT),
  15414. 253: uint8(_BT_NMSTRT),
  15415. 254: uint8(_BT_NMSTRT),
  15416. 255: uint8(_BT_NMSTRT),
  15417. },
  15418. }
  15419. func init() {
  15420. p := unsafe.Pointer(&_latin1_encoding)
  15421. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  15422. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  15423. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  15424. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  15425. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  15426. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  15427. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  15428. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  15429. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  15430. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  15431. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  15432. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  15433. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  15434. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  15435. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_latin1_toUtf8)
  15436. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  15437. }
  15438. func _ascii_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  15439. var v1, v2, v3, v4 uintptr
  15440. _, _, _, _ = v1, v2, v3, v4
  15441. _ = enc
  15442. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  15443. v2 = toP
  15444. v1 = *(*uintptr)(unsafe.Pointer(v2))
  15445. *(*uintptr)(unsafe.Pointer(v2))++
  15446. v4 = fromP
  15447. v3 = *(*uintptr)(unsafe.Pointer(v4))
  15448. *(*uintptr)(unsafe.Pointer(v4))++
  15449. *(*uint8)(unsafe.Pointer(v1)) = *(*uint8)(unsafe.Pointer(v3))
  15450. }
  15451. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  15452. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15453. } else {
  15454. return int32(_XML_CONVERT_COMPLETED)
  15455. }
  15456. return r
  15457. }
  15458. var _ascii_encoding_ns = Tnormal_encoding{
  15459. Fenc: TENCODING{
  15460. Fscanners: [4]TSCANNER{},
  15461. FliteralScanners: [2]TSCANNER{},
  15462. FminBytesPerChar: int32(1),
  15463. FisUtf8: uint8(1),
  15464. },
  15465. Ftype1: [256]uint8{
  15466. 9: uint8(_BT_S),
  15467. 10: uint8(_BT_LF),
  15468. 13: uint8(_BT_CR),
  15469. 32: uint8(_BT_S),
  15470. 33: uint8(_BT_EXCL),
  15471. 34: uint8(_BT_QUOT),
  15472. 35: uint8(_BT_NUM),
  15473. 36: uint8(_BT_OTHER),
  15474. 37: uint8(_BT_PERCNT),
  15475. 38: uint8(_BT_AMP),
  15476. 39: uint8(_BT_APOS),
  15477. 40: uint8(_BT_LPAR),
  15478. 41: uint8(_BT_RPAR),
  15479. 42: uint8(_BT_AST),
  15480. 43: uint8(_BT_PLUS),
  15481. 44: uint8(_BT_COMMA),
  15482. 45: uint8(_BT_MINUS),
  15483. 46: uint8(_BT_NAME),
  15484. 47: uint8(_BT_SOL),
  15485. 48: uint8(_BT_DIGIT),
  15486. 49: uint8(_BT_DIGIT),
  15487. 50: uint8(_BT_DIGIT),
  15488. 51: uint8(_BT_DIGIT),
  15489. 52: uint8(_BT_DIGIT),
  15490. 53: uint8(_BT_DIGIT),
  15491. 54: uint8(_BT_DIGIT),
  15492. 55: uint8(_BT_DIGIT),
  15493. 56: uint8(_BT_DIGIT),
  15494. 57: uint8(_BT_DIGIT),
  15495. 58: uint8(_BT_COLON),
  15496. 59: uint8(_BT_SEMI),
  15497. 60: uint8(_BT_LT),
  15498. 61: uint8(_BT_EQUALS),
  15499. 62: uint8(_BT_GT),
  15500. 63: uint8(_BT_QUEST),
  15501. 64: uint8(_BT_OTHER),
  15502. 65: uint8(_BT_HEX),
  15503. 66: uint8(_BT_HEX),
  15504. 67: uint8(_BT_HEX),
  15505. 68: uint8(_BT_HEX),
  15506. 69: uint8(_BT_HEX),
  15507. 70: uint8(_BT_HEX),
  15508. 71: uint8(_BT_NMSTRT),
  15509. 72: uint8(_BT_NMSTRT),
  15510. 73: uint8(_BT_NMSTRT),
  15511. 74: uint8(_BT_NMSTRT),
  15512. 75: uint8(_BT_NMSTRT),
  15513. 76: uint8(_BT_NMSTRT),
  15514. 77: uint8(_BT_NMSTRT),
  15515. 78: uint8(_BT_NMSTRT),
  15516. 79: uint8(_BT_NMSTRT),
  15517. 80: uint8(_BT_NMSTRT),
  15518. 81: uint8(_BT_NMSTRT),
  15519. 82: uint8(_BT_NMSTRT),
  15520. 83: uint8(_BT_NMSTRT),
  15521. 84: uint8(_BT_NMSTRT),
  15522. 85: uint8(_BT_NMSTRT),
  15523. 86: uint8(_BT_NMSTRT),
  15524. 87: uint8(_BT_NMSTRT),
  15525. 88: uint8(_BT_NMSTRT),
  15526. 89: uint8(_BT_NMSTRT),
  15527. 90: uint8(_BT_NMSTRT),
  15528. 91: uint8(_BT_LSQB),
  15529. 92: uint8(_BT_OTHER),
  15530. 93: uint8(_BT_RSQB),
  15531. 94: uint8(_BT_OTHER),
  15532. 95: uint8(_BT_NMSTRT),
  15533. 96: uint8(_BT_OTHER),
  15534. 97: uint8(_BT_HEX),
  15535. 98: uint8(_BT_HEX),
  15536. 99: uint8(_BT_HEX),
  15537. 100: uint8(_BT_HEX),
  15538. 101: uint8(_BT_HEX),
  15539. 102: uint8(_BT_HEX),
  15540. 103: uint8(_BT_NMSTRT),
  15541. 104: uint8(_BT_NMSTRT),
  15542. 105: uint8(_BT_NMSTRT),
  15543. 106: uint8(_BT_NMSTRT),
  15544. 107: uint8(_BT_NMSTRT),
  15545. 108: uint8(_BT_NMSTRT),
  15546. 109: uint8(_BT_NMSTRT),
  15547. 110: uint8(_BT_NMSTRT),
  15548. 111: uint8(_BT_NMSTRT),
  15549. 112: uint8(_BT_NMSTRT),
  15550. 113: uint8(_BT_NMSTRT),
  15551. 114: uint8(_BT_NMSTRT),
  15552. 115: uint8(_BT_NMSTRT),
  15553. 116: uint8(_BT_NMSTRT),
  15554. 117: uint8(_BT_NMSTRT),
  15555. 118: uint8(_BT_NMSTRT),
  15556. 119: uint8(_BT_NMSTRT),
  15557. 120: uint8(_BT_NMSTRT),
  15558. 121: uint8(_BT_NMSTRT),
  15559. 122: uint8(_BT_NMSTRT),
  15560. 123: uint8(_BT_OTHER),
  15561. 124: uint8(_BT_VERBAR),
  15562. 125: uint8(_BT_OTHER),
  15563. 126: uint8(_BT_OTHER),
  15564. 127: uint8(_BT_OTHER),
  15565. },
  15566. }
  15567. func init() {
  15568. p := unsafe.Pointer(&_ascii_encoding_ns)
  15569. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  15570. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  15571. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  15572. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  15573. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  15574. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  15575. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  15576. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  15577. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  15578. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  15579. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  15580. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  15581. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  15582. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  15583. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_ascii_toUtf8)
  15584. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  15585. }
  15586. var _ascii_encoding = Tnormal_encoding{
  15587. Fenc: TENCODING{
  15588. Fscanners: [4]TSCANNER{},
  15589. FliteralScanners: [2]TSCANNER{},
  15590. FminBytesPerChar: int32(1),
  15591. FisUtf8: uint8(1),
  15592. },
  15593. Ftype1: [256]uint8{
  15594. 9: uint8(_BT_S),
  15595. 10: uint8(_BT_LF),
  15596. 13: uint8(_BT_CR),
  15597. 32: uint8(_BT_S),
  15598. 33: uint8(_BT_EXCL),
  15599. 34: uint8(_BT_QUOT),
  15600. 35: uint8(_BT_NUM),
  15601. 36: uint8(_BT_OTHER),
  15602. 37: uint8(_BT_PERCNT),
  15603. 38: uint8(_BT_AMP),
  15604. 39: uint8(_BT_APOS),
  15605. 40: uint8(_BT_LPAR),
  15606. 41: uint8(_BT_RPAR),
  15607. 42: uint8(_BT_AST),
  15608. 43: uint8(_BT_PLUS),
  15609. 44: uint8(_BT_COMMA),
  15610. 45: uint8(_BT_MINUS),
  15611. 46: uint8(_BT_NAME),
  15612. 47: uint8(_BT_SOL),
  15613. 48: uint8(_BT_DIGIT),
  15614. 49: uint8(_BT_DIGIT),
  15615. 50: uint8(_BT_DIGIT),
  15616. 51: uint8(_BT_DIGIT),
  15617. 52: uint8(_BT_DIGIT),
  15618. 53: uint8(_BT_DIGIT),
  15619. 54: uint8(_BT_DIGIT),
  15620. 55: uint8(_BT_DIGIT),
  15621. 56: uint8(_BT_DIGIT),
  15622. 57: uint8(_BT_DIGIT),
  15623. 58: uint8(_BT_NMSTRT),
  15624. 59: uint8(_BT_SEMI),
  15625. 60: uint8(_BT_LT),
  15626. 61: uint8(_BT_EQUALS),
  15627. 62: uint8(_BT_GT),
  15628. 63: uint8(_BT_QUEST),
  15629. 64: uint8(_BT_OTHER),
  15630. 65: uint8(_BT_HEX),
  15631. 66: uint8(_BT_HEX),
  15632. 67: uint8(_BT_HEX),
  15633. 68: uint8(_BT_HEX),
  15634. 69: uint8(_BT_HEX),
  15635. 70: uint8(_BT_HEX),
  15636. 71: uint8(_BT_NMSTRT),
  15637. 72: uint8(_BT_NMSTRT),
  15638. 73: uint8(_BT_NMSTRT),
  15639. 74: uint8(_BT_NMSTRT),
  15640. 75: uint8(_BT_NMSTRT),
  15641. 76: uint8(_BT_NMSTRT),
  15642. 77: uint8(_BT_NMSTRT),
  15643. 78: uint8(_BT_NMSTRT),
  15644. 79: uint8(_BT_NMSTRT),
  15645. 80: uint8(_BT_NMSTRT),
  15646. 81: uint8(_BT_NMSTRT),
  15647. 82: uint8(_BT_NMSTRT),
  15648. 83: uint8(_BT_NMSTRT),
  15649. 84: uint8(_BT_NMSTRT),
  15650. 85: uint8(_BT_NMSTRT),
  15651. 86: uint8(_BT_NMSTRT),
  15652. 87: uint8(_BT_NMSTRT),
  15653. 88: uint8(_BT_NMSTRT),
  15654. 89: uint8(_BT_NMSTRT),
  15655. 90: uint8(_BT_NMSTRT),
  15656. 91: uint8(_BT_LSQB),
  15657. 92: uint8(_BT_OTHER),
  15658. 93: uint8(_BT_RSQB),
  15659. 94: uint8(_BT_OTHER),
  15660. 95: uint8(_BT_NMSTRT),
  15661. 96: uint8(_BT_OTHER),
  15662. 97: uint8(_BT_HEX),
  15663. 98: uint8(_BT_HEX),
  15664. 99: uint8(_BT_HEX),
  15665. 100: uint8(_BT_HEX),
  15666. 101: uint8(_BT_HEX),
  15667. 102: uint8(_BT_HEX),
  15668. 103: uint8(_BT_NMSTRT),
  15669. 104: uint8(_BT_NMSTRT),
  15670. 105: uint8(_BT_NMSTRT),
  15671. 106: uint8(_BT_NMSTRT),
  15672. 107: uint8(_BT_NMSTRT),
  15673. 108: uint8(_BT_NMSTRT),
  15674. 109: uint8(_BT_NMSTRT),
  15675. 110: uint8(_BT_NMSTRT),
  15676. 111: uint8(_BT_NMSTRT),
  15677. 112: uint8(_BT_NMSTRT),
  15678. 113: uint8(_BT_NMSTRT),
  15679. 114: uint8(_BT_NMSTRT),
  15680. 115: uint8(_BT_NMSTRT),
  15681. 116: uint8(_BT_NMSTRT),
  15682. 117: uint8(_BT_NMSTRT),
  15683. 118: uint8(_BT_NMSTRT),
  15684. 119: uint8(_BT_NMSTRT),
  15685. 120: uint8(_BT_NMSTRT),
  15686. 121: uint8(_BT_NMSTRT),
  15687. 122: uint8(_BT_NMSTRT),
  15688. 123: uint8(_BT_OTHER),
  15689. 124: uint8(_BT_VERBAR),
  15690. 125: uint8(_BT_OTHER),
  15691. 126: uint8(_BT_OTHER),
  15692. 127: uint8(_BT_OTHER),
  15693. },
  15694. }
  15695. func init() {
  15696. p := unsafe.Pointer(&_ascii_encoding)
  15697. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  15698. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  15699. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  15700. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  15701. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  15702. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  15703. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  15704. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  15705. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  15706. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  15707. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  15708. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  15709. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  15710. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  15711. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_ascii_toUtf8)
  15712. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  15713. }
  15714. func _unicode_byte_type(tls *libc.TLS, hi uint8, lo uint8) (r int32) {
  15715. switch libc.Int32FromUint8(hi) {
  15716. /* 0xD800-0xDBFF first 16-bit code unit or high surrogate (W1) */
  15717. case int32(0xD8):
  15718. fallthrough
  15719. case int32(0xD9):
  15720. fallthrough
  15721. case int32(0xDA):
  15722. fallthrough
  15723. case int32(0xDB):
  15724. return int32(_BT_LEAD4)
  15725. /* 0xDC00-0xDFFF second 16-bit code unit or low surrogate (W2) */
  15726. fallthrough
  15727. case int32(0xDC):
  15728. fallthrough
  15729. case int32(0xDD):
  15730. fallthrough
  15731. case int32(0xDE):
  15732. fallthrough
  15733. case int32(0xDF):
  15734. return int32(_BT_TRAIL)
  15735. case int32(0xFF):
  15736. switch libc.Int32FromUint8(lo) {
  15737. case int32(0xFF): /* noncharacter-FFFF */
  15738. fallthrough
  15739. case int32(0xFE): /* noncharacter-FFFE */
  15740. return int32(_BT_NONXML)
  15741. }
  15742. break
  15743. }
  15744. return int32(_BT_NONASCII)
  15745. }
  15746. func _little2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  15747. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  15748. var hi, lo, lo2 uint8
  15749. var plane int32
  15750. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = from, hi, lo, lo2, plane, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9
  15751. from = *(*uintptr)(unsafe.Pointer(fromP))
  15752. _ = enc
  15753. fromLim = from + uintptr((int64(fromLim)-int64(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  15754. for {
  15755. if !(from < fromLim) {
  15756. break
  15757. }
  15758. lo = *(*uint8)(unsafe.Pointer(from))
  15759. hi = *(*uint8)(unsafe.Pointer(from + 1))
  15760. switch libc.Int32FromUint8(hi) {
  15761. case 0:
  15762. if libc.Int32FromUint8(lo) < int32(0x80) {
  15763. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  15764. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15765. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15766. }
  15767. v3 = toP
  15768. v2 = *(*uintptr)(unsafe.Pointer(v3))
  15769. *(*uintptr)(unsafe.Pointer(v3))++
  15770. *(*uint8)(unsafe.Pointer(v2)) = lo
  15771. break
  15772. } /* fall through */
  15773. fallthrough
  15774. case int32(0x1):
  15775. fallthrough
  15776. case int32(0x2):
  15777. fallthrough
  15778. case int32(0x3):
  15779. fallthrough
  15780. case int32(0x4):
  15781. fallthrough
  15782. case int32(0x5):
  15783. fallthrough
  15784. case int32(0x6):
  15785. fallthrough
  15786. case int32(0x7):
  15787. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  15788. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15789. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15790. }
  15791. v5 = toP
  15792. v4 = *(*uintptr)(unsafe.Pointer(v5))
  15793. *(*uintptr)(unsafe.Pointer(v5))++
  15794. *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  15795. v7 = toP
  15796. v6 = *(*uintptr)(unsafe.Pointer(v7))
  15797. *(*uintptr)(unsafe.Pointer(v7))++
  15798. *(*uint8)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  15799. default:
  15800. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(3) {
  15801. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15802. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15803. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  15804. v9 = toP
  15805. v8 = *(*uintptr)(unsafe.Pointer(v9))
  15806. *(*uintptr)(unsafe.Pointer(v9))++
  15807. *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  15808. v11 = toP
  15809. v10 = *(*uintptr)(unsafe.Pointer(v11))
  15810. *(*uintptr)(unsafe.Pointer(v11))++
  15811. *(*uint8)(unsafe.Pointer(v10)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  15812. v13 = toP
  15813. v12 = *(*uintptr)(unsafe.Pointer(v13))
  15814. *(*uintptr)(unsafe.Pointer(v13))++
  15815. *(*uint8)(unsafe.Pointer(v12)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  15816. case int32(0xD8):
  15817. fallthrough
  15818. case int32(0xD9):
  15819. fallthrough
  15820. case int32(0xDA):
  15821. fallthrough
  15822. case int32(0xDB):
  15823. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(4) {
  15824. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15825. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15826. }
  15827. if int64(fromLim)-int64(from) < int64(4) {
  15828. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15829. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  15830. }
  15831. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  15832. v15 = toP
  15833. v14 = *(*uintptr)(unsafe.Pointer(v15))
  15834. *(*uintptr)(unsafe.Pointer(v15))++
  15835. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  15836. v17 = toP
  15837. v16 = *(*uintptr)(unsafe.Pointer(v17))
  15838. *(*uintptr)(unsafe.Pointer(v17))++
  15839. *(*uint8)(unsafe.Pointer(v16)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  15840. from += uintptr(2)
  15841. lo2 = *(*uint8)(unsafe.Pointer(from))
  15842. v19 = toP
  15843. v18 = *(*uintptr)(unsafe.Pointer(v19))
  15844. *(*uintptr)(unsafe.Pointer(v19))++
  15845. *(*uint8)(unsafe.Pointer(v18)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo2)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  15846. v21 = toP
  15847. v20 = *(*uintptr)(unsafe.Pointer(v21))
  15848. *(*uintptr)(unsafe.Pointer(v21))++
  15849. *(*uint8)(unsafe.Pointer(v20)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  15850. break
  15851. }
  15852. goto _1
  15853. _1:
  15854. ;
  15855. from += uintptr(2)
  15856. }
  15857. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15858. if from < fromLim {
  15859. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  15860. } else {
  15861. return int32(_XML_CONVERT_COMPLETED)
  15862. }
  15863. return r
  15864. }
  15865. func _little2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  15866. var res _XML_Convert_Result
  15867. var v2, v3 uintptr
  15868. _, _, _ = res, v2, v3
  15869. res = int32(_XML_CONVERT_COMPLETED)
  15870. _ = enc
  15871. fromLim = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr((int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */ /* Avoid copying first half only of surrogate */
  15872. if int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))) > (int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))))/2<<libc.Int32FromInt32(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(fromLim - libc.UintptrFromInt32(2) + 1)))&int32(0xF8) == int32(0xD8) {
  15873. fromLim -= uintptr(2)
  15874. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  15875. }
  15876. for {
  15877. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  15878. break
  15879. }
  15880. v3 = toP
  15881. v2 = *(*uintptr)(unsafe.Pointer(v3))
  15882. *(*uintptr)(unsafe.Pointer(v3)) += 2
  15883. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)) + 1)))<<int32(8) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))
  15884. goto _1
  15885. _1:
  15886. ;
  15887. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  15888. }
  15889. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  15890. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15891. } else {
  15892. return res
  15893. }
  15894. return r
  15895. }
  15896. func _big2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  15897. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  15898. var hi, lo, lo2 uint8
  15899. var plane int32
  15900. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = from, hi, lo, lo2, plane, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9
  15901. from = *(*uintptr)(unsafe.Pointer(fromP))
  15902. _ = enc
  15903. fromLim = from + uintptr((int64(fromLim)-int64(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  15904. for {
  15905. if !(from < fromLim) {
  15906. break
  15907. }
  15908. lo = *(*uint8)(unsafe.Pointer(from + 1))
  15909. hi = *(*uint8)(unsafe.Pointer(from))
  15910. switch libc.Int32FromUint8(hi) {
  15911. case 0:
  15912. if libc.Int32FromUint8(lo) < int32(0x80) {
  15913. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  15914. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15915. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15916. }
  15917. v3 = toP
  15918. v2 = *(*uintptr)(unsafe.Pointer(v3))
  15919. *(*uintptr)(unsafe.Pointer(v3))++
  15920. *(*uint8)(unsafe.Pointer(v2)) = lo
  15921. break
  15922. } /* fall through */
  15923. fallthrough
  15924. case int32(0x1):
  15925. fallthrough
  15926. case int32(0x2):
  15927. fallthrough
  15928. case int32(0x3):
  15929. fallthrough
  15930. case int32(0x4):
  15931. fallthrough
  15932. case int32(0x5):
  15933. fallthrough
  15934. case int32(0x6):
  15935. fallthrough
  15936. case int32(0x7):
  15937. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  15938. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15939. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15940. }
  15941. v5 = toP
  15942. v4 = *(*uintptr)(unsafe.Pointer(v5))
  15943. *(*uintptr)(unsafe.Pointer(v5))++
  15944. *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  15945. v7 = toP
  15946. v6 = *(*uintptr)(unsafe.Pointer(v7))
  15947. *(*uintptr)(unsafe.Pointer(v7))++
  15948. *(*uint8)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  15949. default:
  15950. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(3) {
  15951. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15952. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15953. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  15954. v9 = toP
  15955. v8 = *(*uintptr)(unsafe.Pointer(v9))
  15956. *(*uintptr)(unsafe.Pointer(v9))++
  15957. *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  15958. v11 = toP
  15959. v10 = *(*uintptr)(unsafe.Pointer(v11))
  15960. *(*uintptr)(unsafe.Pointer(v11))++
  15961. *(*uint8)(unsafe.Pointer(v10)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  15962. v13 = toP
  15963. v12 = *(*uintptr)(unsafe.Pointer(v13))
  15964. *(*uintptr)(unsafe.Pointer(v13))++
  15965. *(*uint8)(unsafe.Pointer(v12)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  15966. case int32(0xD8):
  15967. fallthrough
  15968. case int32(0xD9):
  15969. fallthrough
  15970. case int32(0xDA):
  15971. fallthrough
  15972. case int32(0xDB):
  15973. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(4) {
  15974. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15975. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15976. }
  15977. if int64(fromLim)-int64(from) < int64(4) {
  15978. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15979. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  15980. }
  15981. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  15982. v15 = toP
  15983. v14 = *(*uintptr)(unsafe.Pointer(v15))
  15984. *(*uintptr)(unsafe.Pointer(v15))++
  15985. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  15986. v17 = toP
  15987. v16 = *(*uintptr)(unsafe.Pointer(v17))
  15988. *(*uintptr)(unsafe.Pointer(v17))++
  15989. *(*uint8)(unsafe.Pointer(v16)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  15990. from += uintptr(2)
  15991. lo2 = *(*uint8)(unsafe.Pointer(from + 1))
  15992. v19 = toP
  15993. v18 = *(*uintptr)(unsafe.Pointer(v19))
  15994. *(*uintptr)(unsafe.Pointer(v19))++
  15995. *(*uint8)(unsafe.Pointer(v18)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo2)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  15996. v21 = toP
  15997. v20 = *(*uintptr)(unsafe.Pointer(v21))
  15998. *(*uintptr)(unsafe.Pointer(v21))++
  15999. *(*uint8)(unsafe.Pointer(v20)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  16000. break
  16001. }
  16002. goto _1
  16003. _1:
  16004. ;
  16005. from += uintptr(2)
  16006. }
  16007. *(*uintptr)(unsafe.Pointer(fromP)) = from
  16008. if from < fromLim {
  16009. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16010. } else {
  16011. return int32(_XML_CONVERT_COMPLETED)
  16012. }
  16013. return r
  16014. }
  16015. func _big2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  16016. var res _XML_Convert_Result
  16017. var v2, v3 uintptr
  16018. _, _, _ = res, v2, v3
  16019. res = int32(_XML_CONVERT_COMPLETED)
  16020. _ = enc
  16021. fromLim = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr((int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */ /* Avoid copying first half only of surrogate */
  16022. if int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))) > (int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))))/2<<libc.Int32FromInt32(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(fromLim - libc.UintptrFromInt32(2))))&int32(0xF8) == int32(0xD8) {
  16023. fromLim -= uintptr(2)
  16024. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16025. }
  16026. for {
  16027. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  16028. break
  16029. }
  16030. v3 = toP
  16031. v2 = *(*uintptr)(unsafe.Pointer(v3))
  16032. *(*uintptr)(unsafe.Pointer(v3)) += 2
  16033. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))<<int32(8) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)) + 1))))
  16034. goto _1
  16035. _1:
  16036. ;
  16037. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  16038. }
  16039. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  16040. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16041. } else {
  16042. return res
  16043. }
  16044. return r
  16045. }
  16046. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  16047. /* This file is included!
  16048. __ __ _
  16049. ___\ \/ /_ __ __ _| |_
  16050. / _ \\ /| '_ \ / _` | __|
  16051. | __// \| |_) | (_| | |_
  16052. \___/_/\_\ .__/ \__,_|\__|
  16053. |_| XML parser
  16054. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  16055. Copyright (c) 2000-2017 Expat development team
  16056. Licensed under the MIT license:
  16057. Permission is hereby granted, free of charge, to any person obtaining
  16058. a copy of this software and associated documentation files (the
  16059. "Software"), to deal in the Software without restriction, including
  16060. without limitation the rights to use, copy, modify, merge, publish,
  16061. distribute, sublicense, and/or sell copies of the Software, and to permit
  16062. persons to whom the Software is furnished to do so, subject to the
  16063. following conditions:
  16064. The above copyright notice and this permission notice shall be included
  16065. in all copies or substantial portions of the Software.
  16066. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16067. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16068. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  16069. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  16070. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16071. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  16072. USE OR OTHER DEALINGS IN THE SOFTWARE.
  16073. */
  16074. /* ptr points to character following "<!-" */
  16075. func _little2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16076. var v1 int32
  16077. _ = v1
  16078. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16079. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1)) {
  16080. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16081. return m_XML_TOK_INVALID
  16082. }
  16083. ptr += uintptr(2)
  16084. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16085. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16086. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16087. } else {
  16088. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16089. }
  16090. switch v1 {
  16091. case int32(_BT_LEAD2):
  16092. if int64(end)-int64(ptr) < int64(2) {
  16093. return -int32(2)
  16094. }
  16095. if 0 != 0 {
  16096. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16097. return m_XML_TOK_INVALID
  16098. }
  16099. ptr += uintptr(2)
  16100. case int32(_BT_LEAD3):
  16101. if int64(end)-int64(ptr) < int64(3) {
  16102. return -int32(2)
  16103. }
  16104. if 0 != 0 {
  16105. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16106. return m_XML_TOK_INVALID
  16107. }
  16108. ptr += uintptr(3)
  16109. case int32(_BT_LEAD4):
  16110. if int64(end)-int64(ptr) < int64(4) {
  16111. return -int32(2)
  16112. }
  16113. if 0 != 0 {
  16114. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16115. return m_XML_TOK_INVALID
  16116. }
  16117. ptr += uintptr(4)
  16118. case int32(_BT_NONXML):
  16119. fallthrough
  16120. case int32(_BT_MALFORM):
  16121. fallthrough
  16122. case int32(_BT_TRAIL):
  16123. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16124. return m_XML_TOK_INVALID
  16125. case int32(_BT_MINUS):
  16126. ptr += uintptr(2)
  16127. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16128. return -int32(1)
  16129. }
  16130. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  16131. ptr += uintptr(2)
  16132. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16133. return -int32(1)
  16134. }
  16135. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  16136. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16137. return m_XML_TOK_INVALID
  16138. }
  16139. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16140. return int32(m_XML_TOK_COMMENT)
  16141. }
  16142. default:
  16143. ptr += uintptr(2)
  16144. break
  16145. }
  16146. }
  16147. }
  16148. return -int32(1)
  16149. }
  16150. /* ptr points to character following "<!" */
  16151. func _little2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16152. var v1, v2, v3 int32
  16153. _, _, _ = v1, v2, v3
  16154. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16155. return -int32(1)
  16156. }
  16157. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16158. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16159. } else {
  16160. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16161. }
  16162. switch v1 {
  16163. case int32(_BT_MINUS):
  16164. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  16165. case int32(_BT_LSQB):
  16166. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16167. return int32(m_XML_TOK_COND_SECT_OPEN)
  16168. case int32(_BT_NMSTRT):
  16169. fallthrough
  16170. case int32(_BT_HEX):
  16171. ptr += uintptr(2)
  16172. default:
  16173. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16174. return m_XML_TOK_INVALID
  16175. }
  16176. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16177. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16178. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16179. } else {
  16180. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16181. }
  16182. switch v2 {
  16183. case int32(_BT_PERCNT):
  16184. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  16185. return -int32(1)
  16186. }
  16187. /* don't allow <!ENTITY% foo "whatever"> */
  16188. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  16189. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))))))
  16190. } else {
  16191. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  16192. }
  16193. switch v3 {
  16194. case int32(_BT_S):
  16195. fallthrough
  16196. case int32(_BT_CR):
  16197. fallthrough
  16198. case int32(_BT_LF):
  16199. fallthrough
  16200. case int32(_BT_PERCNT):
  16201. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16202. return m_XML_TOK_INVALID
  16203. }
  16204. /* fall through */
  16205. fallthrough
  16206. case int32(_BT_S):
  16207. fallthrough
  16208. case int32(_BT_CR):
  16209. fallthrough
  16210. case int32(_BT_LF):
  16211. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16212. return int32(m_XML_TOK_DECL_OPEN)
  16213. case int32(_BT_NMSTRT):
  16214. fallthrough
  16215. case int32(_BT_HEX):
  16216. ptr += uintptr(2)
  16217. default:
  16218. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16219. return m_XML_TOK_INVALID
  16220. }
  16221. }
  16222. return -int32(1)
  16223. }
  16224. func _little2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  16225. var upper, v1, v2, v3 int32
  16226. _, _, _, _ = upper, v1, v2, v3
  16227. upper = 0
  16228. _ = enc
  16229. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  16230. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(3)) {
  16231. return int32(1)
  16232. }
  16233. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16234. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  16235. } else {
  16236. v1 = -int32(1)
  16237. }
  16238. switch v1 {
  16239. case int32(m_ASCII_x):
  16240. case int32(m_ASCII_X):
  16241. upper = int32(1)
  16242. default:
  16243. return int32(1)
  16244. }
  16245. ptr += uintptr(2)
  16246. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16247. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  16248. } else {
  16249. v2 = -int32(1)
  16250. }
  16251. switch v2 {
  16252. case int32(m_ASCII_m):
  16253. case int32(m_ASCII_M):
  16254. upper = int32(1)
  16255. default:
  16256. return int32(1)
  16257. }
  16258. ptr += uintptr(2)
  16259. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16260. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  16261. } else {
  16262. v3 = -int32(1)
  16263. }
  16264. switch v3 {
  16265. case int32(m_ASCII_l):
  16266. case int32(m_ASCII_L):
  16267. upper = int32(1)
  16268. default:
  16269. return int32(1)
  16270. }
  16271. if upper != 0 {
  16272. return 0
  16273. }
  16274. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  16275. return int32(1)
  16276. }
  16277. /* ptr points to character following "<?" */
  16278. func _little2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16279. bp := tls.Alloc(16)
  16280. defer tls.Free(16)
  16281. var target uintptr
  16282. var v1, v2, v3 int32
  16283. var _ /* tok at bp+0 */ int32
  16284. _, _, _, _ = target, v1, v2, v3
  16285. target = ptr
  16286. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16287. return -int32(1)
  16288. }
  16289. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16290. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16291. } else {
  16292. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16293. }
  16294. switch v1 {
  16295. case int32(_BT_NONASCII):
  16296. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  16297. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16298. return m_XML_TOK_INVALID
  16299. } /* fall through */
  16300. fallthrough
  16301. case int32(_BT_NMSTRT):
  16302. fallthrough
  16303. case int32(_BT_HEX):
  16304. ptr += uintptr(2)
  16305. case int32(_BT_LEAD2):
  16306. if int64(end)-int64(ptr) < int64(2) {
  16307. return -int32(2)
  16308. }
  16309. if !(libc.Int32FromInt32(0) != 0) {
  16310. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16311. return m_XML_TOK_INVALID
  16312. }
  16313. ptr += uintptr(2)
  16314. case int32(_BT_LEAD3):
  16315. if int64(end)-int64(ptr) < int64(3) {
  16316. return -int32(2)
  16317. }
  16318. if !(libc.Int32FromInt32(0) != 0) {
  16319. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16320. return m_XML_TOK_INVALID
  16321. }
  16322. ptr += uintptr(3)
  16323. case int32(_BT_LEAD4):
  16324. if int64(end)-int64(ptr) < int64(4) {
  16325. return -int32(2)
  16326. }
  16327. if !(libc.Int32FromInt32(0) != 0) {
  16328. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16329. return m_XML_TOK_INVALID
  16330. }
  16331. ptr += uintptr(4)
  16332. default:
  16333. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16334. return m_XML_TOK_INVALID
  16335. }
  16336. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16337. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16338. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16339. } else {
  16340. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16341. }
  16342. switch v2 {
  16343. case int32(_BT_NONASCII):
  16344. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  16345. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16346. return m_XML_TOK_INVALID
  16347. } /* fall through */
  16348. fallthrough
  16349. case int32(_BT_NMSTRT):
  16350. fallthrough
  16351. case int32(_BT_HEX):
  16352. fallthrough
  16353. case int32(_BT_DIGIT):
  16354. fallthrough
  16355. case int32(_BT_NAME):
  16356. fallthrough
  16357. case int32(_BT_MINUS):
  16358. ptr += uintptr(2)
  16359. case int32(_BT_LEAD2):
  16360. if int64(end)-int64(ptr) < int64(2) {
  16361. return -int32(2)
  16362. }
  16363. if !(libc.Int32FromInt32(0) != 0) {
  16364. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16365. return m_XML_TOK_INVALID
  16366. }
  16367. ptr += uintptr(2)
  16368. case int32(_BT_LEAD3):
  16369. if int64(end)-int64(ptr) < int64(3) {
  16370. return -int32(2)
  16371. }
  16372. if !(libc.Int32FromInt32(0) != 0) {
  16373. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16374. return m_XML_TOK_INVALID
  16375. }
  16376. ptr += uintptr(3)
  16377. case int32(_BT_LEAD4):
  16378. if int64(end)-int64(ptr) < int64(4) {
  16379. return -int32(2)
  16380. }
  16381. if !(libc.Int32FromInt32(0) != 0) {
  16382. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16383. return m_XML_TOK_INVALID
  16384. }
  16385. ptr += uintptr(4)
  16386. case int32(_BT_S):
  16387. fallthrough
  16388. case int32(_BT_CR):
  16389. fallthrough
  16390. case int32(_BT_LF):
  16391. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  16392. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16393. return m_XML_TOK_INVALID
  16394. }
  16395. ptr += uintptr(2)
  16396. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16397. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16398. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16399. } else {
  16400. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16401. }
  16402. switch v3 {
  16403. case int32(_BT_LEAD2):
  16404. if int64(end)-int64(ptr) < int64(2) {
  16405. return -int32(2)
  16406. }
  16407. if 0 != 0 {
  16408. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16409. return m_XML_TOK_INVALID
  16410. }
  16411. ptr += uintptr(2)
  16412. case int32(_BT_LEAD3):
  16413. if int64(end)-int64(ptr) < int64(3) {
  16414. return -int32(2)
  16415. }
  16416. if 0 != 0 {
  16417. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16418. return m_XML_TOK_INVALID
  16419. }
  16420. ptr += uintptr(3)
  16421. case int32(_BT_LEAD4):
  16422. if int64(end)-int64(ptr) < int64(4) {
  16423. return -int32(2)
  16424. }
  16425. if 0 != 0 {
  16426. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16427. return m_XML_TOK_INVALID
  16428. }
  16429. ptr += uintptr(4)
  16430. case int32(_BT_NONXML):
  16431. fallthrough
  16432. case int32(_BT_MALFORM):
  16433. fallthrough
  16434. case int32(_BT_TRAIL):
  16435. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16436. return m_XML_TOK_INVALID
  16437. case int32(_BT_QUEST):
  16438. ptr += uintptr(2)
  16439. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16440. return -int32(1)
  16441. }
  16442. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  16443. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16444. return *(*int32)(unsafe.Pointer(bp))
  16445. }
  16446. default:
  16447. ptr += uintptr(2)
  16448. break
  16449. }
  16450. }
  16451. return -int32(1)
  16452. case int32(_BT_QUEST):
  16453. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  16454. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16455. return m_XML_TOK_INVALID
  16456. }
  16457. ptr += uintptr(2)
  16458. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16459. return -int32(1)
  16460. }
  16461. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  16462. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16463. return *(*int32)(unsafe.Pointer(bp))
  16464. }
  16465. /* fall through */
  16466. fallthrough
  16467. default:
  16468. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16469. return m_XML_TOK_INVALID
  16470. }
  16471. }
  16472. return -int32(1)
  16473. }
  16474. func _little2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16475. var i int32
  16476. _ = i
  16477. _ = enc
  16478. /* CDATA[ */
  16479. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))) {
  16480. return -int32(1)
  16481. }
  16482. i = 0
  16483. for {
  16484. if !(i < int32(6)) {
  16485. break
  16486. }
  16487. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromUint8(_CDATA_LSQB1[i])) {
  16488. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16489. return m_XML_TOK_INVALID
  16490. }
  16491. goto _1
  16492. _1:
  16493. ;
  16494. i++
  16495. ptr += uintptr(2)
  16496. }
  16497. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16498. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  16499. }
  16500. var _CDATA_LSQB1 = [6]uint8{
  16501. 0: uint8(m_ASCII_C),
  16502. 1: uint8(m_ASCII_D),
  16503. 2: uint8(m_ASCII_A),
  16504. 3: uint8(m_ASCII_T),
  16505. 4: uint8(m_ASCII_A),
  16506. 5: uint8(m_ASCII_LSQB1),
  16507. }
  16508. func _little2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16509. var n Tsize_t
  16510. var v1, v2, v3 int32
  16511. _, _, _, _ = n, v1, v2, v3
  16512. if ptr >= end {
  16513. return -int32(4)
  16514. }
  16515. if int32(2) > int32(1) {
  16516. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  16517. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  16518. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  16519. if n == uint64(0) {
  16520. return -int32(1)
  16521. }
  16522. end = ptr + uintptr(n)
  16523. }
  16524. }
  16525. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16526. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16527. } else {
  16528. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16529. }
  16530. switch v1 {
  16531. case int32(_BT_RSQB):
  16532. ptr += uintptr(2)
  16533. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16534. return -int32(1)
  16535. }
  16536. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  16537. break
  16538. }
  16539. ptr += uintptr(2)
  16540. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16541. return -int32(1)
  16542. }
  16543. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  16544. ptr -= uintptr(2)
  16545. break
  16546. }
  16547. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16548. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  16549. case int32(_BT_CR):
  16550. ptr += uintptr(2)
  16551. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16552. return -int32(1)
  16553. }
  16554. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16555. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16556. } else {
  16557. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16558. }
  16559. if v2 == int32(_BT_LF) {
  16560. ptr += uintptr(2)
  16561. }
  16562. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16563. return int32(m_XML_TOK_DATA_NEWLINE)
  16564. case int32(_BT_LF):
  16565. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16566. return int32(m_XML_TOK_DATA_NEWLINE)
  16567. case int32(_BT_LEAD2):
  16568. if int64(end)-int64(ptr) < int64(2) {
  16569. return -int32(2)
  16570. }
  16571. if 0 != 0 {
  16572. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16573. return m_XML_TOK_INVALID
  16574. }
  16575. ptr += uintptr(2)
  16576. case int32(_BT_LEAD3):
  16577. if int64(end)-int64(ptr) < int64(3) {
  16578. return -int32(2)
  16579. }
  16580. if 0 != 0 {
  16581. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16582. return m_XML_TOK_INVALID
  16583. }
  16584. ptr += uintptr(3)
  16585. case int32(_BT_LEAD4):
  16586. if int64(end)-int64(ptr) < int64(4) {
  16587. return -int32(2)
  16588. }
  16589. if 0 != 0 {
  16590. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16591. return m_XML_TOK_INVALID
  16592. }
  16593. ptr += uintptr(4)
  16594. case int32(_BT_NONXML):
  16595. fallthrough
  16596. case int32(_BT_MALFORM):
  16597. fallthrough
  16598. case int32(_BT_TRAIL):
  16599. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16600. return m_XML_TOK_INVALID
  16601. default:
  16602. ptr += uintptr(2)
  16603. break
  16604. }
  16605. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16606. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16607. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16608. } else {
  16609. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16610. }
  16611. switch v3 {
  16612. case int32(_BT_LEAD2):
  16613. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  16614. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16615. return int32(m_XML_TOK_DATA_CHARS)
  16616. }
  16617. ptr += uintptr(2)
  16618. case int32(_BT_LEAD3):
  16619. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  16620. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16621. return int32(m_XML_TOK_DATA_CHARS)
  16622. }
  16623. ptr += uintptr(3)
  16624. case int32(_BT_LEAD4):
  16625. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  16626. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16627. return int32(m_XML_TOK_DATA_CHARS)
  16628. }
  16629. ptr += uintptr(4)
  16630. case int32(_BT_NONXML):
  16631. fallthrough
  16632. case int32(_BT_MALFORM):
  16633. fallthrough
  16634. case int32(_BT_TRAIL):
  16635. fallthrough
  16636. case int32(_BT_CR):
  16637. fallthrough
  16638. case int32(_BT_LF):
  16639. fallthrough
  16640. case int32(_BT_RSQB):
  16641. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16642. return int32(m_XML_TOK_DATA_CHARS)
  16643. default:
  16644. ptr += uintptr(2)
  16645. break
  16646. }
  16647. }
  16648. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16649. return int32(m_XML_TOK_DATA_CHARS)
  16650. }
  16651. /* ptr points to character following "</" */
  16652. func _little2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16653. var v1, v2, v22 int32
  16654. _, _, _ = v1, v2, v22
  16655. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16656. return -int32(1)
  16657. }
  16658. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16659. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16660. } else {
  16661. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16662. }
  16663. switch v1 {
  16664. case int32(_BT_NONASCII):
  16665. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  16666. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16667. return m_XML_TOK_INVALID
  16668. } /* fall through */
  16669. fallthrough
  16670. case int32(_BT_NMSTRT):
  16671. fallthrough
  16672. case int32(_BT_HEX):
  16673. ptr += uintptr(2)
  16674. case int32(_BT_LEAD2):
  16675. if int64(end)-int64(ptr) < int64(2) {
  16676. return -int32(2)
  16677. }
  16678. if !(libc.Int32FromInt32(0) != 0) {
  16679. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16680. return m_XML_TOK_INVALID
  16681. }
  16682. ptr += uintptr(2)
  16683. case int32(_BT_LEAD3):
  16684. if int64(end)-int64(ptr) < int64(3) {
  16685. return -int32(2)
  16686. }
  16687. if !(libc.Int32FromInt32(0) != 0) {
  16688. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16689. return m_XML_TOK_INVALID
  16690. }
  16691. ptr += uintptr(3)
  16692. case int32(_BT_LEAD4):
  16693. if int64(end)-int64(ptr) < int64(4) {
  16694. return -int32(2)
  16695. }
  16696. if !(libc.Int32FromInt32(0) != 0) {
  16697. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16698. return m_XML_TOK_INVALID
  16699. }
  16700. ptr += uintptr(4)
  16701. default:
  16702. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16703. return m_XML_TOK_INVALID
  16704. }
  16705. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16706. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16707. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16708. } else {
  16709. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16710. }
  16711. switch v2 {
  16712. case int32(_BT_NONASCII):
  16713. goto _3
  16714. case int32(_BT_MINUS):
  16715. goto _4
  16716. case int32(_BT_NAME):
  16717. goto _5
  16718. case int32(_BT_DIGIT):
  16719. goto _6
  16720. case int32(_BT_HEX):
  16721. goto _7
  16722. case int32(_BT_NMSTRT):
  16723. goto _8
  16724. case int32(_BT_LEAD2):
  16725. goto _9
  16726. case int32(_BT_LEAD3):
  16727. goto _10
  16728. case int32(_BT_LEAD4):
  16729. goto _11
  16730. case int32(_BT_LF):
  16731. goto _12
  16732. case int32(_BT_CR):
  16733. goto _13
  16734. case int32(_BT_S):
  16735. goto _14
  16736. case int32(_BT_COLON):
  16737. goto _15
  16738. case int32(_BT_GT):
  16739. goto _16
  16740. default:
  16741. goto _17
  16742. }
  16743. goto _18
  16744. _3:
  16745. ;
  16746. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  16747. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16748. return m_XML_TOK_INVALID
  16749. } /* fall through */
  16750. _8:
  16751. ;
  16752. _7:
  16753. ;
  16754. _6:
  16755. ;
  16756. _5:
  16757. ;
  16758. _4:
  16759. ;
  16760. ptr += uintptr(2)
  16761. goto _18
  16762. _9:
  16763. ;
  16764. if int64(end)-int64(ptr) < int64(2) {
  16765. return -int32(2)
  16766. }
  16767. if !(libc.Int32FromInt32(0) != 0) {
  16768. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16769. return m_XML_TOK_INVALID
  16770. }
  16771. ptr += uintptr(2)
  16772. goto _18
  16773. _10:
  16774. ;
  16775. if int64(end)-int64(ptr) < int64(3) {
  16776. return -int32(2)
  16777. }
  16778. if !(libc.Int32FromInt32(0) != 0) {
  16779. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16780. return m_XML_TOK_INVALID
  16781. }
  16782. ptr += uintptr(3)
  16783. goto _18
  16784. _11:
  16785. ;
  16786. if int64(end)-int64(ptr) < int64(4) {
  16787. return -int32(2)
  16788. }
  16789. if !(libc.Int32FromInt32(0) != 0) {
  16790. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16791. return m_XML_TOK_INVALID
  16792. }
  16793. ptr += uintptr(4)
  16794. goto _18
  16795. _14:
  16796. ;
  16797. _13:
  16798. ;
  16799. _12:
  16800. ;
  16801. ptr += uintptr(2)
  16802. _21:
  16803. ;
  16804. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16805. goto _19
  16806. }
  16807. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16808. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16809. } else {
  16810. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16811. }
  16812. switch v22 {
  16813. case int32(_BT_S):
  16814. fallthrough
  16815. case int32(_BT_CR):
  16816. fallthrough
  16817. case int32(_BT_LF):
  16818. case int32(_BT_GT):
  16819. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16820. return int32(m_XML_TOK_END_TAG)
  16821. default:
  16822. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16823. return m_XML_TOK_INVALID
  16824. }
  16825. goto _20
  16826. _20:
  16827. ;
  16828. ptr += uintptr(2)
  16829. goto _21
  16830. goto _19
  16831. _19:
  16832. ;
  16833. return -int32(1)
  16834. _15:
  16835. ;
  16836. /* no need to check qname syntax here,
  16837. since end-tag must match exactly */
  16838. ptr += uintptr(2)
  16839. goto _18
  16840. _16:
  16841. ;
  16842. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16843. return int32(m_XML_TOK_END_TAG)
  16844. _17:
  16845. ;
  16846. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16847. return m_XML_TOK_INVALID
  16848. _18:
  16849. }
  16850. return -int32(1)
  16851. }
  16852. /* ptr points to character following "&#X" */
  16853. func _little2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16854. var v1, v3 int32
  16855. _, _ = v1, v3
  16856. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16857. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16858. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16859. } else {
  16860. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16861. }
  16862. switch v1 {
  16863. case int32(_BT_DIGIT):
  16864. fallthrough
  16865. case int32(_BT_HEX):
  16866. default:
  16867. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16868. return m_XML_TOK_INVALID
  16869. }
  16870. ptr += uintptr(2)
  16871. for {
  16872. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16873. break
  16874. }
  16875. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16876. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16877. } else {
  16878. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16879. }
  16880. switch v3 {
  16881. case int32(_BT_DIGIT):
  16882. fallthrough
  16883. case int32(_BT_HEX):
  16884. case int32(_BT_SEMI):
  16885. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16886. return int32(m_XML_TOK_CHAR_REF)
  16887. default:
  16888. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16889. return m_XML_TOK_INVALID
  16890. }
  16891. goto _2
  16892. _2:
  16893. ;
  16894. ptr += uintptr(2)
  16895. }
  16896. }
  16897. return -int32(1)
  16898. }
  16899. /* ptr points to character following "&#" */
  16900. func _little2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16901. var v1, v3 int32
  16902. _, _ = v1, v3
  16903. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16904. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x) {
  16905. return _little2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  16906. }
  16907. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16908. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16909. } else {
  16910. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16911. }
  16912. switch v1 {
  16913. case int32(_BT_DIGIT):
  16914. default:
  16915. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16916. return m_XML_TOK_INVALID
  16917. }
  16918. ptr += uintptr(2)
  16919. for {
  16920. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16921. break
  16922. }
  16923. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16924. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16925. } else {
  16926. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16927. }
  16928. switch v3 {
  16929. case int32(_BT_DIGIT):
  16930. case int32(_BT_SEMI):
  16931. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16932. return int32(m_XML_TOK_CHAR_REF)
  16933. default:
  16934. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16935. return m_XML_TOK_INVALID
  16936. }
  16937. goto _2
  16938. _2:
  16939. ;
  16940. ptr += uintptr(2)
  16941. }
  16942. }
  16943. return -int32(1)
  16944. }
  16945. /* ptr points to character following "&" */
  16946. func _little2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16947. var v1, v2 int32
  16948. _, _ = v1, v2
  16949. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16950. return -int32(1)
  16951. }
  16952. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16953. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16954. } else {
  16955. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16956. }
  16957. switch v1 {
  16958. case int32(_BT_NONASCII):
  16959. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  16960. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16961. return m_XML_TOK_INVALID
  16962. } /* fall through */
  16963. fallthrough
  16964. case int32(_BT_NMSTRT):
  16965. fallthrough
  16966. case int32(_BT_HEX):
  16967. ptr += uintptr(2)
  16968. case int32(_BT_LEAD2):
  16969. if int64(end)-int64(ptr) < int64(2) {
  16970. return -int32(2)
  16971. }
  16972. if !(libc.Int32FromInt32(0) != 0) {
  16973. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16974. return m_XML_TOK_INVALID
  16975. }
  16976. ptr += uintptr(2)
  16977. case int32(_BT_LEAD3):
  16978. if int64(end)-int64(ptr) < int64(3) {
  16979. return -int32(2)
  16980. }
  16981. if !(libc.Int32FromInt32(0) != 0) {
  16982. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16983. return m_XML_TOK_INVALID
  16984. }
  16985. ptr += uintptr(3)
  16986. case int32(_BT_LEAD4):
  16987. if int64(end)-int64(ptr) < int64(4) {
  16988. return -int32(2)
  16989. }
  16990. if !(libc.Int32FromInt32(0) != 0) {
  16991. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16992. return m_XML_TOK_INVALID
  16993. }
  16994. ptr += uintptr(4)
  16995. case int32(_BT_NUM):
  16996. return _little2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  16997. default:
  16998. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16999. return m_XML_TOK_INVALID
  17000. }
  17001. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  17002. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17003. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17004. } else {
  17005. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17006. }
  17007. switch v2 {
  17008. case int32(_BT_NONASCII):
  17009. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  17010. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17011. return m_XML_TOK_INVALID
  17012. } /* fall through */
  17013. fallthrough
  17014. case int32(_BT_NMSTRT):
  17015. fallthrough
  17016. case int32(_BT_HEX):
  17017. fallthrough
  17018. case int32(_BT_DIGIT):
  17019. fallthrough
  17020. case int32(_BT_NAME):
  17021. fallthrough
  17022. case int32(_BT_MINUS):
  17023. ptr += uintptr(2)
  17024. case int32(_BT_LEAD2):
  17025. if int64(end)-int64(ptr) < int64(2) {
  17026. return -int32(2)
  17027. }
  17028. if !(libc.Int32FromInt32(0) != 0) {
  17029. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17030. return m_XML_TOK_INVALID
  17031. }
  17032. ptr += uintptr(2)
  17033. case int32(_BT_LEAD3):
  17034. if int64(end)-int64(ptr) < int64(3) {
  17035. return -int32(2)
  17036. }
  17037. if !(libc.Int32FromInt32(0) != 0) {
  17038. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17039. return m_XML_TOK_INVALID
  17040. }
  17041. ptr += uintptr(3)
  17042. case int32(_BT_LEAD4):
  17043. if int64(end)-int64(ptr) < int64(4) {
  17044. return -int32(2)
  17045. }
  17046. if !(libc.Int32FromInt32(0) != 0) {
  17047. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17048. return m_XML_TOK_INVALID
  17049. }
  17050. ptr += uintptr(4)
  17051. case int32(_BT_SEMI):
  17052. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  17053. return int32(m_XML_TOK_ENTITY_REF)
  17054. default:
  17055. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17056. return m_XML_TOK_INVALID
  17057. }
  17058. }
  17059. return -int32(1)
  17060. }
  17061. /* ptr points to character following first character of attribute name */
  17062. func _little2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  17063. bp := tls.Alloc(16)
  17064. defer tls.Free(16)
  17065. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  17066. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  17067. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  17068. hadColon = 0
  17069. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  17070. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  17071. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  17072. } else {
  17073. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  17074. }
  17075. switch v1 {
  17076. case int32(_BT_NONASCII):
  17077. goto _2
  17078. case int32(_BT_MINUS):
  17079. goto _3
  17080. case int32(_BT_NAME):
  17081. goto _4
  17082. case int32(_BT_DIGIT):
  17083. goto _5
  17084. case int32(_BT_HEX):
  17085. goto _6
  17086. case int32(_BT_NMSTRT):
  17087. goto _7
  17088. case int32(_BT_LEAD2):
  17089. goto _8
  17090. case int32(_BT_LEAD3):
  17091. goto _9
  17092. case int32(_BT_LEAD4):
  17093. goto _10
  17094. case int32(_BT_COLON):
  17095. goto _11
  17096. case int32(_BT_LF):
  17097. goto _12
  17098. case int32(_BT_CR):
  17099. goto _13
  17100. case int32(_BT_S):
  17101. goto _14
  17102. case int32(_BT_EQUALS):
  17103. goto _15
  17104. default:
  17105. goto _16
  17106. }
  17107. goto _17
  17108. _2:
  17109. ;
  17110. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))&libc.Int32FromInt32(0x1F))) != 0) {
  17111. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17112. return m_XML_TOK_INVALID
  17113. } /* fall through */
  17114. _7:
  17115. ;
  17116. _6:
  17117. ;
  17118. _5:
  17119. ;
  17120. _4:
  17121. ;
  17122. _3:
  17123. ;
  17124. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17125. goto _17
  17126. _8:
  17127. ;
  17128. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  17129. return -int32(2)
  17130. }
  17131. if !(libc.Int32FromInt32(0) != 0) {
  17132. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17133. return m_XML_TOK_INVALID
  17134. }
  17135. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17136. goto _17
  17137. _9:
  17138. ;
  17139. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  17140. return -int32(2)
  17141. }
  17142. if !(libc.Int32FromInt32(0) != 0) {
  17143. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17144. return m_XML_TOK_INVALID
  17145. }
  17146. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  17147. goto _17
  17148. _10:
  17149. ;
  17150. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  17151. return -int32(2)
  17152. }
  17153. if !(libc.Int32FromInt32(0) != 0) {
  17154. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17155. return m_XML_TOK_INVALID
  17156. }
  17157. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  17158. goto _17
  17159. _11:
  17160. ;
  17161. if hadColon != 0 {
  17162. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17163. return m_XML_TOK_INVALID
  17164. }
  17165. hadColon = int32(1)
  17166. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17167. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17168. return -int32(1)
  17169. }
  17170. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  17171. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  17172. } else {
  17173. v18 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  17174. }
  17175. switch v18 {
  17176. case int32(_BT_NONASCII):
  17177. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))&libc.Int32FromInt32(0x1F))) != 0) {
  17178. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17179. return m_XML_TOK_INVALID
  17180. } /* fall through */
  17181. fallthrough
  17182. case int32(_BT_NMSTRT):
  17183. fallthrough
  17184. case int32(_BT_HEX):
  17185. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17186. case int32(_BT_LEAD2):
  17187. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  17188. return -int32(2)
  17189. }
  17190. if !(libc.Int32FromInt32(0) != 0) {
  17191. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17192. return m_XML_TOK_INVALID
  17193. }
  17194. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17195. case int32(_BT_LEAD3):
  17196. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  17197. return -int32(2)
  17198. }
  17199. if !(libc.Int32FromInt32(0) != 0) {
  17200. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17201. return m_XML_TOK_INVALID
  17202. }
  17203. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  17204. case int32(_BT_LEAD4):
  17205. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  17206. return -int32(2)
  17207. }
  17208. if !(libc.Int32FromInt32(0) != 0) {
  17209. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17210. return m_XML_TOK_INVALID
  17211. }
  17212. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  17213. default:
  17214. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17215. return m_XML_TOK_INVALID
  17216. }
  17217. goto _17
  17218. _14:
  17219. ;
  17220. _13:
  17221. ;
  17222. _12:
  17223. ;
  17224. _21:
  17225. ;
  17226. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17227. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17228. return -int32(1)
  17229. }
  17230. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  17231. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  17232. } else {
  17233. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  17234. }
  17235. t = v22
  17236. if t == int32(_BT_EQUALS) {
  17237. goto _19
  17238. }
  17239. switch t {
  17240. case int32(_BT_S):
  17241. fallthrough
  17242. case int32(_BT_LF):
  17243. fallthrough
  17244. case int32(_BT_CR):
  17245. default:
  17246. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17247. return m_XML_TOK_INVALID
  17248. }
  17249. goto _20
  17250. _20:
  17251. ;
  17252. goto _21
  17253. goto _19
  17254. _19:
  17255. ;
  17256. /* fall through */
  17257. _15:
  17258. ;
  17259. hadColon = 0
  17260. for {
  17261. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17262. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17263. return -int32(1)
  17264. }
  17265. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  17266. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  17267. } else {
  17268. v24 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  17269. }
  17270. open = v24
  17271. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  17272. break
  17273. }
  17274. switch open {
  17275. case int32(_BT_S):
  17276. fallthrough
  17277. case int32(_BT_LF):
  17278. fallthrough
  17279. case int32(_BT_CR):
  17280. default:
  17281. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17282. return m_XML_TOK_INVALID
  17283. }
  17284. goto _23
  17285. _23:
  17286. }
  17287. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17288. /* in attribute value */
  17289. for {
  17290. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17291. return -int32(1)
  17292. }
  17293. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  17294. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  17295. } else {
  17296. v26 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  17297. }
  17298. t1 = v26
  17299. if t1 == open {
  17300. break
  17301. }
  17302. switch t1 {
  17303. case int32(_BT_LEAD2):
  17304. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  17305. return -int32(2)
  17306. }
  17307. if 0 != 0 {
  17308. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17309. return m_XML_TOK_INVALID
  17310. }
  17311. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17312. case int32(_BT_LEAD3):
  17313. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  17314. return -int32(2)
  17315. }
  17316. if 0 != 0 {
  17317. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17318. return m_XML_TOK_INVALID
  17319. }
  17320. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  17321. case int32(_BT_LEAD4):
  17322. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  17323. return -int32(2)
  17324. }
  17325. if 0 != 0 {
  17326. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17327. return m_XML_TOK_INVALID
  17328. }
  17329. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  17330. case int32(_BT_NONXML):
  17331. fallthrough
  17332. case int32(_BT_MALFORM):
  17333. fallthrough
  17334. case int32(_BT_TRAIL):
  17335. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17336. return m_XML_TOK_INVALID
  17337. case int32(_BT_AMP):
  17338. tok = _little2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  17339. if tok <= 0 {
  17340. if tok == m_XML_TOK_INVALID {
  17341. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17342. }
  17343. return tok
  17344. }
  17345. case int32(_BT_LT):
  17346. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17347. return m_XML_TOK_INVALID
  17348. default:
  17349. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17350. break
  17351. }
  17352. goto _25
  17353. _25:
  17354. }
  17355. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17356. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17357. return -int32(1)
  17358. }
  17359. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  17360. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  17361. } else {
  17362. v27 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  17363. }
  17364. switch v27 {
  17365. case int32(_BT_S):
  17366. fallthrough
  17367. case int32(_BT_CR):
  17368. fallthrough
  17369. case int32(_BT_LF):
  17370. case int32(_BT_SOL):
  17371. goto sol
  17372. case int32(_BT_GT):
  17373. goto gt
  17374. default:
  17375. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17376. return m_XML_TOK_INVALID
  17377. }
  17378. /* ptr points to closing quote */
  17379. _30:
  17380. ;
  17381. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17382. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17383. return -int32(1)
  17384. }
  17385. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  17386. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  17387. } else {
  17388. v31 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  17389. }
  17390. switch v31 {
  17391. case int32(_BT_NONASCII):
  17392. goto _32
  17393. case int32(_BT_HEX):
  17394. goto _33
  17395. case int32(_BT_NMSTRT):
  17396. goto _34
  17397. case int32(_BT_LEAD2):
  17398. goto _35
  17399. case int32(_BT_LEAD3):
  17400. goto _36
  17401. case int32(_BT_LEAD4):
  17402. goto _37
  17403. case int32(_BT_LF):
  17404. goto _38
  17405. case int32(_BT_CR):
  17406. goto _39
  17407. case int32(_BT_S):
  17408. goto _40
  17409. case int32(_BT_GT):
  17410. goto _41
  17411. case int32(_BT_SOL):
  17412. goto _42
  17413. default:
  17414. goto _43
  17415. }
  17416. goto _44
  17417. _32:
  17418. ;
  17419. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))&libc.Int32FromInt32(0x1F))) != 0) {
  17420. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17421. return m_XML_TOK_INVALID
  17422. } /* fall through */
  17423. _34:
  17424. ;
  17425. _33:
  17426. ;
  17427. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17428. goto _44
  17429. _35:
  17430. ;
  17431. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  17432. return -int32(2)
  17433. }
  17434. if !(libc.Int32FromInt32(0) != 0) {
  17435. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17436. return m_XML_TOK_INVALID
  17437. }
  17438. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17439. goto _44
  17440. _36:
  17441. ;
  17442. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  17443. return -int32(2)
  17444. }
  17445. if !(libc.Int32FromInt32(0) != 0) {
  17446. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17447. return m_XML_TOK_INVALID
  17448. }
  17449. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  17450. goto _44
  17451. _37:
  17452. ;
  17453. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  17454. return -int32(2)
  17455. }
  17456. if !(libc.Int32FromInt32(0) != 0) {
  17457. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17458. return m_XML_TOK_INVALID
  17459. }
  17460. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  17461. goto _44
  17462. _40:
  17463. ;
  17464. _39:
  17465. ;
  17466. _38:
  17467. ;
  17468. goto _29
  17469. _41:
  17470. ;
  17471. goto gt
  17472. gt:
  17473. ;
  17474. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  17475. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  17476. _42:
  17477. ;
  17478. goto sol
  17479. sol:
  17480. ;
  17481. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17482. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17483. return -int32(1)
  17484. }
  17485. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == int32(m_ASCII_GT1)) {
  17486. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17487. return m_XML_TOK_INVALID
  17488. }
  17489. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  17490. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  17491. _43:
  17492. ;
  17493. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17494. return m_XML_TOK_INVALID
  17495. _44:
  17496. ;
  17497. goto _28
  17498. goto _29
  17499. _29:
  17500. ;
  17501. goto _30
  17502. goto _28
  17503. _28:
  17504. ;
  17505. goto _17
  17506. _16:
  17507. ;
  17508. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17509. return m_XML_TOK_INVALID
  17510. _17:
  17511. }
  17512. return -int32(1)
  17513. }
  17514. /* ptr points to character following "<" */
  17515. func _little2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  17516. var hadColon, v1, v2, v21, v22, v3 int32
  17517. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  17518. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17519. return -int32(1)
  17520. }
  17521. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17522. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17523. } else {
  17524. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17525. }
  17526. switch v1 {
  17527. case int32(_BT_NONASCII):
  17528. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  17529. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17530. return m_XML_TOK_INVALID
  17531. } /* fall through */
  17532. fallthrough
  17533. case int32(_BT_NMSTRT):
  17534. fallthrough
  17535. case int32(_BT_HEX):
  17536. ptr += uintptr(2)
  17537. case int32(_BT_LEAD2):
  17538. if int64(end)-int64(ptr) < int64(2) {
  17539. return -int32(2)
  17540. }
  17541. if !(libc.Int32FromInt32(0) != 0) {
  17542. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17543. return m_XML_TOK_INVALID
  17544. }
  17545. ptr += uintptr(2)
  17546. case int32(_BT_LEAD3):
  17547. if int64(end)-int64(ptr) < int64(3) {
  17548. return -int32(2)
  17549. }
  17550. if !(libc.Int32FromInt32(0) != 0) {
  17551. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17552. return m_XML_TOK_INVALID
  17553. }
  17554. ptr += uintptr(3)
  17555. case int32(_BT_LEAD4):
  17556. if int64(end)-int64(ptr) < int64(4) {
  17557. return -int32(2)
  17558. }
  17559. if !(libc.Int32FromInt32(0) != 0) {
  17560. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17561. return m_XML_TOK_INVALID
  17562. }
  17563. ptr += uintptr(4)
  17564. case int32(_BT_EXCL):
  17565. ptr += uintptr(2)
  17566. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17567. return -int32(1)
  17568. }
  17569. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17570. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17571. } else {
  17572. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17573. }
  17574. switch v2 {
  17575. case int32(_BT_MINUS):
  17576. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  17577. case int32(_BT_LSQB):
  17578. return _little2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  17579. }
  17580. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17581. return m_XML_TOK_INVALID
  17582. case int32(_BT_QUEST):
  17583. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  17584. case int32(_BT_SOL):
  17585. return _little2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  17586. default:
  17587. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17588. return m_XML_TOK_INVALID
  17589. }
  17590. hadColon = 0
  17591. /* we have a start-tag */
  17592. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  17593. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17594. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17595. } else {
  17596. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17597. }
  17598. switch v3 {
  17599. case int32(_BT_NONASCII):
  17600. goto _4
  17601. case int32(_BT_MINUS):
  17602. goto _5
  17603. case int32(_BT_NAME):
  17604. goto _6
  17605. case int32(_BT_DIGIT):
  17606. goto _7
  17607. case int32(_BT_HEX):
  17608. goto _8
  17609. case int32(_BT_NMSTRT):
  17610. goto _9
  17611. case int32(_BT_LEAD2):
  17612. goto _10
  17613. case int32(_BT_LEAD3):
  17614. goto _11
  17615. case int32(_BT_LEAD4):
  17616. goto _12
  17617. case int32(_BT_COLON):
  17618. goto _13
  17619. case int32(_BT_LF):
  17620. goto _14
  17621. case int32(_BT_CR):
  17622. goto _15
  17623. case int32(_BT_S):
  17624. goto _16
  17625. case int32(_BT_GT):
  17626. goto _17
  17627. case int32(_BT_SOL):
  17628. goto _18
  17629. default:
  17630. goto _19
  17631. }
  17632. goto _20
  17633. _4:
  17634. ;
  17635. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  17636. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17637. return m_XML_TOK_INVALID
  17638. } /* fall through */
  17639. _9:
  17640. ;
  17641. _8:
  17642. ;
  17643. _7:
  17644. ;
  17645. _6:
  17646. ;
  17647. _5:
  17648. ;
  17649. ptr += uintptr(2)
  17650. goto _20
  17651. _10:
  17652. ;
  17653. if int64(end)-int64(ptr) < int64(2) {
  17654. return -int32(2)
  17655. }
  17656. if !(libc.Int32FromInt32(0) != 0) {
  17657. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17658. return m_XML_TOK_INVALID
  17659. }
  17660. ptr += uintptr(2)
  17661. goto _20
  17662. _11:
  17663. ;
  17664. if int64(end)-int64(ptr) < int64(3) {
  17665. return -int32(2)
  17666. }
  17667. if !(libc.Int32FromInt32(0) != 0) {
  17668. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17669. return m_XML_TOK_INVALID
  17670. }
  17671. ptr += uintptr(3)
  17672. goto _20
  17673. _12:
  17674. ;
  17675. if int64(end)-int64(ptr) < int64(4) {
  17676. return -int32(2)
  17677. }
  17678. if !(libc.Int32FromInt32(0) != 0) {
  17679. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17680. return m_XML_TOK_INVALID
  17681. }
  17682. ptr += uintptr(4)
  17683. goto _20
  17684. _13:
  17685. ;
  17686. if hadColon != 0 {
  17687. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17688. return m_XML_TOK_INVALID
  17689. }
  17690. hadColon = int32(1)
  17691. ptr += uintptr(2)
  17692. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17693. return -int32(1)
  17694. }
  17695. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17696. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17697. } else {
  17698. v21 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17699. }
  17700. switch v21 {
  17701. case int32(_BT_NONASCII):
  17702. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  17703. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17704. return m_XML_TOK_INVALID
  17705. } /* fall through */
  17706. fallthrough
  17707. case int32(_BT_NMSTRT):
  17708. fallthrough
  17709. case int32(_BT_HEX):
  17710. ptr += uintptr(2)
  17711. case int32(_BT_LEAD2):
  17712. if int64(end)-int64(ptr) < int64(2) {
  17713. return -int32(2)
  17714. }
  17715. if !(libc.Int32FromInt32(0) != 0) {
  17716. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17717. return m_XML_TOK_INVALID
  17718. }
  17719. ptr += uintptr(2)
  17720. case int32(_BT_LEAD3):
  17721. if int64(end)-int64(ptr) < int64(3) {
  17722. return -int32(2)
  17723. }
  17724. if !(libc.Int32FromInt32(0) != 0) {
  17725. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17726. return m_XML_TOK_INVALID
  17727. }
  17728. ptr += uintptr(3)
  17729. case int32(_BT_LEAD4):
  17730. if int64(end)-int64(ptr) < int64(4) {
  17731. return -int32(2)
  17732. }
  17733. if !(libc.Int32FromInt32(0) != 0) {
  17734. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17735. return m_XML_TOK_INVALID
  17736. }
  17737. ptr += uintptr(4)
  17738. default:
  17739. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17740. return m_XML_TOK_INVALID
  17741. }
  17742. goto _20
  17743. _16:
  17744. ;
  17745. _15:
  17746. ;
  17747. _14:
  17748. ;
  17749. ptr += uintptr(2)
  17750. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  17751. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17752. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17753. } else {
  17754. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17755. }
  17756. switch v22 {
  17757. case int32(_BT_NONASCII):
  17758. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  17759. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17760. return m_XML_TOK_INVALID
  17761. } /* fall through */
  17762. fallthrough
  17763. case int32(_BT_NMSTRT):
  17764. fallthrough
  17765. case int32(_BT_HEX):
  17766. ptr += uintptr(2)
  17767. case int32(_BT_LEAD2):
  17768. if int64(end)-int64(ptr) < int64(2) {
  17769. return -int32(2)
  17770. }
  17771. if !(libc.Int32FromInt32(0) != 0) {
  17772. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17773. return m_XML_TOK_INVALID
  17774. }
  17775. ptr += uintptr(2)
  17776. case int32(_BT_LEAD3):
  17777. if int64(end)-int64(ptr) < int64(3) {
  17778. return -int32(2)
  17779. }
  17780. if !(libc.Int32FromInt32(0) != 0) {
  17781. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17782. return m_XML_TOK_INVALID
  17783. }
  17784. ptr += uintptr(3)
  17785. case int32(_BT_LEAD4):
  17786. if int64(end)-int64(ptr) < int64(4) {
  17787. return -int32(2)
  17788. }
  17789. if !(libc.Int32FromInt32(0) != 0) {
  17790. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17791. return m_XML_TOK_INVALID
  17792. }
  17793. ptr += uintptr(4)
  17794. case int32(_BT_GT):
  17795. goto gt
  17796. case int32(_BT_SOL):
  17797. goto sol
  17798. case int32(_BT_S):
  17799. fallthrough
  17800. case int32(_BT_CR):
  17801. fallthrough
  17802. case int32(_BT_LF):
  17803. ptr += uintptr(2)
  17804. continue
  17805. default:
  17806. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17807. return m_XML_TOK_INVALID
  17808. }
  17809. return _little2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  17810. }
  17811. return -int32(1)
  17812. _17:
  17813. ;
  17814. goto gt
  17815. gt:
  17816. ;
  17817. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  17818. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  17819. _18:
  17820. ;
  17821. goto sol
  17822. sol:
  17823. ;
  17824. ptr += uintptr(2)
  17825. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17826. return -int32(1)
  17827. }
  17828. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  17829. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17830. return m_XML_TOK_INVALID
  17831. }
  17832. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  17833. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  17834. _19:
  17835. ;
  17836. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17837. return m_XML_TOK_INVALID
  17838. _20:
  17839. }
  17840. return -int32(1)
  17841. }
  17842. func _little2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  17843. var n Tsize_t
  17844. var v1, v2, v3 int32
  17845. _, _, _, _ = n, v1, v2, v3
  17846. if ptr >= end {
  17847. return -int32(4)
  17848. }
  17849. if int32(2) > int32(1) {
  17850. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  17851. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  17852. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  17853. if n == uint64(0) {
  17854. return -int32(1)
  17855. }
  17856. end = ptr + uintptr(n)
  17857. }
  17858. }
  17859. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17860. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17861. } else {
  17862. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17863. }
  17864. switch v1 {
  17865. case int32(_BT_LT):
  17866. return _little2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  17867. case int32(_BT_AMP):
  17868. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  17869. case int32(_BT_CR):
  17870. ptr += uintptr(2)
  17871. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17872. return -int32(3)
  17873. }
  17874. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17875. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17876. } else {
  17877. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17878. }
  17879. if v2 == int32(_BT_LF) {
  17880. ptr += uintptr(2)
  17881. }
  17882. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17883. return int32(m_XML_TOK_DATA_NEWLINE)
  17884. case int32(_BT_LF):
  17885. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  17886. return int32(m_XML_TOK_DATA_NEWLINE)
  17887. case int32(_BT_RSQB):
  17888. ptr += uintptr(2)
  17889. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17890. return -int32(5)
  17891. }
  17892. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  17893. break
  17894. }
  17895. ptr += uintptr(2)
  17896. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17897. return -int32(5)
  17898. }
  17899. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  17900. ptr -= uintptr(2)
  17901. break
  17902. }
  17903. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17904. return m_XML_TOK_INVALID
  17905. case int32(_BT_LEAD2):
  17906. if int64(end)-int64(ptr) < int64(2) {
  17907. return -int32(2)
  17908. }
  17909. if 0 != 0 {
  17910. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17911. return m_XML_TOK_INVALID
  17912. }
  17913. ptr += uintptr(2)
  17914. case int32(_BT_LEAD3):
  17915. if int64(end)-int64(ptr) < int64(3) {
  17916. return -int32(2)
  17917. }
  17918. if 0 != 0 {
  17919. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17920. return m_XML_TOK_INVALID
  17921. }
  17922. ptr += uintptr(3)
  17923. case int32(_BT_LEAD4):
  17924. if int64(end)-int64(ptr) < int64(4) {
  17925. return -int32(2)
  17926. }
  17927. if 0 != 0 {
  17928. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17929. return m_XML_TOK_INVALID
  17930. }
  17931. ptr += uintptr(4)
  17932. case int32(_BT_NONXML):
  17933. fallthrough
  17934. case int32(_BT_MALFORM):
  17935. fallthrough
  17936. case int32(_BT_TRAIL):
  17937. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17938. return m_XML_TOK_INVALID
  17939. default:
  17940. ptr += uintptr(2)
  17941. break
  17942. }
  17943. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  17944. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17945. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17946. } else {
  17947. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17948. }
  17949. switch v3 {
  17950. case int32(_BT_LEAD2):
  17951. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  17952. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17953. return int32(m_XML_TOK_DATA_CHARS)
  17954. }
  17955. ptr += uintptr(2)
  17956. case int32(_BT_LEAD3):
  17957. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  17958. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17959. return int32(m_XML_TOK_DATA_CHARS)
  17960. }
  17961. ptr += uintptr(3)
  17962. case int32(_BT_LEAD4):
  17963. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  17964. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17965. return int32(m_XML_TOK_DATA_CHARS)
  17966. }
  17967. ptr += uintptr(4)
  17968. case int32(_BT_RSQB):
  17969. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  17970. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_RSQB1)) {
  17971. ptr += uintptr(2)
  17972. break
  17973. }
  17974. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)) {
  17975. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))))) == int32(m_ASCII_GT1)) {
  17976. ptr += uintptr(2)
  17977. break
  17978. }
  17979. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  17980. return m_XML_TOK_INVALID
  17981. }
  17982. }
  17983. /* fall through */
  17984. fallthrough
  17985. case int32(_BT_AMP):
  17986. fallthrough
  17987. case int32(_BT_LT):
  17988. fallthrough
  17989. case int32(_BT_NONXML):
  17990. fallthrough
  17991. case int32(_BT_MALFORM):
  17992. fallthrough
  17993. case int32(_BT_TRAIL):
  17994. fallthrough
  17995. case int32(_BT_CR):
  17996. fallthrough
  17997. case int32(_BT_LF):
  17998. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17999. return int32(m_XML_TOK_DATA_CHARS)
  18000. default:
  18001. ptr += uintptr(2)
  18002. break
  18003. }
  18004. }
  18005. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18006. return int32(m_XML_TOK_DATA_CHARS)
  18007. }
  18008. /* ptr points to character following "%" */
  18009. func _little2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18010. var v1, v2 int32
  18011. _, _ = v1, v2
  18012. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18013. return -int32(1)
  18014. }
  18015. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18016. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18017. } else {
  18018. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18019. }
  18020. switch v1 {
  18021. case int32(_BT_NONASCII):
  18022. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  18023. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18024. return m_XML_TOK_INVALID
  18025. } /* fall through */
  18026. fallthrough
  18027. case int32(_BT_NMSTRT):
  18028. fallthrough
  18029. case int32(_BT_HEX):
  18030. ptr += uintptr(2)
  18031. case int32(_BT_LEAD2):
  18032. if int64(end)-int64(ptr) < int64(2) {
  18033. return -int32(2)
  18034. }
  18035. if !(libc.Int32FromInt32(0) != 0) {
  18036. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18037. return m_XML_TOK_INVALID
  18038. }
  18039. ptr += uintptr(2)
  18040. case int32(_BT_LEAD3):
  18041. if int64(end)-int64(ptr) < int64(3) {
  18042. return -int32(2)
  18043. }
  18044. if !(libc.Int32FromInt32(0) != 0) {
  18045. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18046. return m_XML_TOK_INVALID
  18047. }
  18048. ptr += uintptr(3)
  18049. case int32(_BT_LEAD4):
  18050. if int64(end)-int64(ptr) < int64(4) {
  18051. return -int32(2)
  18052. }
  18053. if !(libc.Int32FromInt32(0) != 0) {
  18054. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18055. return m_XML_TOK_INVALID
  18056. }
  18057. ptr += uintptr(4)
  18058. case int32(_BT_S):
  18059. fallthrough
  18060. case int32(_BT_LF):
  18061. fallthrough
  18062. case int32(_BT_CR):
  18063. fallthrough
  18064. case int32(_BT_PERCNT):
  18065. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18066. return int32(m_XML_TOK_PERCENT)
  18067. default:
  18068. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18069. return m_XML_TOK_INVALID
  18070. }
  18071. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18072. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18073. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18074. } else {
  18075. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18076. }
  18077. switch v2 {
  18078. case int32(_BT_NONASCII):
  18079. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  18080. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18081. return m_XML_TOK_INVALID
  18082. } /* fall through */
  18083. fallthrough
  18084. case int32(_BT_NMSTRT):
  18085. fallthrough
  18086. case int32(_BT_HEX):
  18087. fallthrough
  18088. case int32(_BT_DIGIT):
  18089. fallthrough
  18090. case int32(_BT_NAME):
  18091. fallthrough
  18092. case int32(_BT_MINUS):
  18093. ptr += uintptr(2)
  18094. case int32(_BT_LEAD2):
  18095. if int64(end)-int64(ptr) < int64(2) {
  18096. return -int32(2)
  18097. }
  18098. if !(libc.Int32FromInt32(0) != 0) {
  18099. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18100. return m_XML_TOK_INVALID
  18101. }
  18102. ptr += uintptr(2)
  18103. case int32(_BT_LEAD3):
  18104. if int64(end)-int64(ptr) < int64(3) {
  18105. return -int32(2)
  18106. }
  18107. if !(libc.Int32FromInt32(0) != 0) {
  18108. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18109. return m_XML_TOK_INVALID
  18110. }
  18111. ptr += uintptr(3)
  18112. case int32(_BT_LEAD4):
  18113. if int64(end)-int64(ptr) < int64(4) {
  18114. return -int32(2)
  18115. }
  18116. if !(libc.Int32FromInt32(0) != 0) {
  18117. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18118. return m_XML_TOK_INVALID
  18119. }
  18120. ptr += uintptr(4)
  18121. case int32(_BT_SEMI):
  18122. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18123. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  18124. default:
  18125. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18126. return m_XML_TOK_INVALID
  18127. }
  18128. }
  18129. return -int32(1)
  18130. }
  18131. func _little2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18132. var v1, v2 int32
  18133. _, _ = v1, v2
  18134. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18135. return -int32(1)
  18136. }
  18137. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18138. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18139. } else {
  18140. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18141. }
  18142. switch v1 {
  18143. case int32(_BT_NONASCII):
  18144. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  18145. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18146. return m_XML_TOK_INVALID
  18147. } /* fall through */
  18148. fallthrough
  18149. case int32(_BT_NMSTRT):
  18150. fallthrough
  18151. case int32(_BT_HEX):
  18152. ptr += uintptr(2)
  18153. case int32(_BT_LEAD2):
  18154. if int64(end)-int64(ptr) < int64(2) {
  18155. return -int32(2)
  18156. }
  18157. if !(libc.Int32FromInt32(0) != 0) {
  18158. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18159. return m_XML_TOK_INVALID
  18160. }
  18161. ptr += uintptr(2)
  18162. case int32(_BT_LEAD3):
  18163. if int64(end)-int64(ptr) < int64(3) {
  18164. return -int32(2)
  18165. }
  18166. if !(libc.Int32FromInt32(0) != 0) {
  18167. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18168. return m_XML_TOK_INVALID
  18169. }
  18170. ptr += uintptr(3)
  18171. case int32(_BT_LEAD4):
  18172. if int64(end)-int64(ptr) < int64(4) {
  18173. return -int32(2)
  18174. }
  18175. if !(libc.Int32FromInt32(0) != 0) {
  18176. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18177. return m_XML_TOK_INVALID
  18178. }
  18179. ptr += uintptr(4)
  18180. default:
  18181. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18182. return m_XML_TOK_INVALID
  18183. }
  18184. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18185. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18186. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18187. } else {
  18188. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18189. }
  18190. switch v2 {
  18191. case int32(_BT_NONASCII):
  18192. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  18193. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18194. return m_XML_TOK_INVALID
  18195. } /* fall through */
  18196. fallthrough
  18197. case int32(_BT_NMSTRT):
  18198. fallthrough
  18199. case int32(_BT_HEX):
  18200. fallthrough
  18201. case int32(_BT_DIGIT):
  18202. fallthrough
  18203. case int32(_BT_NAME):
  18204. fallthrough
  18205. case int32(_BT_MINUS):
  18206. ptr += uintptr(2)
  18207. case int32(_BT_LEAD2):
  18208. if int64(end)-int64(ptr) < int64(2) {
  18209. return -int32(2)
  18210. }
  18211. if !(libc.Int32FromInt32(0) != 0) {
  18212. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18213. return m_XML_TOK_INVALID
  18214. }
  18215. ptr += uintptr(2)
  18216. case int32(_BT_LEAD3):
  18217. if int64(end)-int64(ptr) < int64(3) {
  18218. return -int32(2)
  18219. }
  18220. if !(libc.Int32FromInt32(0) != 0) {
  18221. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18222. return m_XML_TOK_INVALID
  18223. }
  18224. ptr += uintptr(3)
  18225. case int32(_BT_LEAD4):
  18226. if int64(end)-int64(ptr) < int64(4) {
  18227. return -int32(2)
  18228. }
  18229. if !(libc.Int32FromInt32(0) != 0) {
  18230. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18231. return m_XML_TOK_INVALID
  18232. }
  18233. ptr += uintptr(4)
  18234. case int32(_BT_CR):
  18235. fallthrough
  18236. case int32(_BT_LF):
  18237. fallthrough
  18238. case int32(_BT_S):
  18239. fallthrough
  18240. case int32(_BT_RPAR):
  18241. fallthrough
  18242. case int32(_BT_GT):
  18243. fallthrough
  18244. case int32(_BT_PERCNT):
  18245. fallthrough
  18246. case int32(_BT_VERBAR):
  18247. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18248. return int32(m_XML_TOK_POUND_NAME)
  18249. default:
  18250. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18251. return m_XML_TOK_INVALID
  18252. }
  18253. }
  18254. return -int32(m_XML_TOK_POUND_NAME)
  18255. }
  18256. func _little2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18257. var t, v1, v2 int32
  18258. _, _, _ = t, v1, v2
  18259. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18260. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18261. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18262. } else {
  18263. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18264. }
  18265. t = v1
  18266. switch t {
  18267. case int32(_BT_LEAD2):
  18268. if int64(end)-int64(ptr) < int64(2) {
  18269. return -int32(2)
  18270. }
  18271. if 0 != 0 {
  18272. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18273. return m_XML_TOK_INVALID
  18274. }
  18275. ptr += uintptr(2)
  18276. case int32(_BT_LEAD3):
  18277. if int64(end)-int64(ptr) < int64(3) {
  18278. return -int32(2)
  18279. }
  18280. if 0 != 0 {
  18281. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18282. return m_XML_TOK_INVALID
  18283. }
  18284. ptr += uintptr(3)
  18285. case int32(_BT_LEAD4):
  18286. if int64(end)-int64(ptr) < int64(4) {
  18287. return -int32(2)
  18288. }
  18289. if 0 != 0 {
  18290. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18291. return m_XML_TOK_INVALID
  18292. }
  18293. ptr += uintptr(4)
  18294. case int32(_BT_NONXML):
  18295. fallthrough
  18296. case int32(_BT_MALFORM):
  18297. fallthrough
  18298. case int32(_BT_TRAIL):
  18299. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18300. return m_XML_TOK_INVALID
  18301. case int32(_BT_QUOT):
  18302. fallthrough
  18303. case int32(_BT_APOS):
  18304. ptr += uintptr(2)
  18305. if t != open {
  18306. break
  18307. }
  18308. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18309. return -int32(m_XML_TOK_LITERAL)
  18310. }
  18311. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18312. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18313. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18314. } else {
  18315. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18316. }
  18317. switch v2 {
  18318. case int32(_BT_S):
  18319. fallthrough
  18320. case int32(_BT_CR):
  18321. fallthrough
  18322. case int32(_BT_LF):
  18323. fallthrough
  18324. case int32(_BT_GT):
  18325. fallthrough
  18326. case int32(_BT_PERCNT):
  18327. fallthrough
  18328. case int32(_BT_LSQB):
  18329. return int32(m_XML_TOK_LITERAL)
  18330. default:
  18331. return m_XML_TOK_INVALID
  18332. }
  18333. fallthrough
  18334. default:
  18335. ptr += uintptr(2)
  18336. break
  18337. }
  18338. }
  18339. return -int32(1)
  18340. }
  18341. func _little2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18342. var n Tsize_t
  18343. var tok, v1, v29, v33, v34, v35, v36 int32
  18344. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  18345. if ptr >= end {
  18346. return -int32(4)
  18347. }
  18348. if int32(2) > int32(1) {
  18349. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  18350. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  18351. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  18352. if n == uint64(0) {
  18353. return -int32(1)
  18354. }
  18355. end = ptr + uintptr(n)
  18356. }
  18357. }
  18358. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18359. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18360. } else {
  18361. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18362. }
  18363. switch v1 {
  18364. case int32(_BT_QUOT):
  18365. goto _2
  18366. case int32(_BT_APOS):
  18367. goto _3
  18368. case int32(_BT_LT):
  18369. goto _4
  18370. case int32(_BT_CR):
  18371. goto _5
  18372. case int32(_BT_LF):
  18373. goto _6
  18374. case int32(_BT_S):
  18375. goto _7
  18376. case int32(_BT_PERCNT):
  18377. goto _8
  18378. case int32(_BT_COMMA):
  18379. goto _9
  18380. case int32(_BT_LSQB):
  18381. goto _10
  18382. case int32(_BT_RSQB):
  18383. goto _11
  18384. case int32(_BT_LPAR):
  18385. goto _12
  18386. case int32(_BT_RPAR):
  18387. goto _13
  18388. case int32(_BT_VERBAR):
  18389. goto _14
  18390. case int32(_BT_GT):
  18391. goto _15
  18392. case int32(_BT_NUM):
  18393. goto _16
  18394. case int32(_BT_LEAD2):
  18395. goto _17
  18396. case int32(_BT_LEAD3):
  18397. goto _18
  18398. case int32(_BT_LEAD4):
  18399. goto _19
  18400. case int32(_BT_HEX):
  18401. goto _20
  18402. case int32(_BT_NMSTRT):
  18403. goto _21
  18404. case int32(_BT_COLON):
  18405. goto _22
  18406. case int32(_BT_MINUS):
  18407. goto _23
  18408. case int32(_BT_NAME):
  18409. goto _24
  18410. case int32(_BT_DIGIT):
  18411. goto _25
  18412. case int32(_BT_NONASCII):
  18413. goto _26
  18414. default:
  18415. goto _27
  18416. }
  18417. goto _28
  18418. _2:
  18419. ;
  18420. return _little2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  18421. _3:
  18422. ;
  18423. return _little2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  18424. _4:
  18425. ;
  18426. ptr += uintptr(2)
  18427. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18428. return -int32(1)
  18429. }
  18430. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18431. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18432. } else {
  18433. v29 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18434. }
  18435. switch v29 {
  18436. case int32(_BT_EXCL):
  18437. return _little2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18438. case int32(_BT_QUEST):
  18439. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18440. case int32(_BT_NMSTRT):
  18441. fallthrough
  18442. case int32(_BT_HEX):
  18443. fallthrough
  18444. case int32(_BT_NONASCII):
  18445. fallthrough
  18446. case int32(_BT_LEAD2):
  18447. fallthrough
  18448. case int32(_BT_LEAD3):
  18449. fallthrough
  18450. case int32(_BT_LEAD4):
  18451. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  18452. return int32(m_XML_TOK_INSTANCE_START)
  18453. }
  18454. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18455. return m_XML_TOK_INVALID
  18456. _5:
  18457. ;
  18458. if ptr+uintptr(2) == end {
  18459. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  18460. /* indicate that this might be part of a CR/LF pair */
  18461. return -int32(m_XML_TOK_PROLOG_S)
  18462. }
  18463. /* fall through */
  18464. _7:
  18465. ;
  18466. _6:
  18467. ;
  18468. _32:
  18469. ;
  18470. ptr += uintptr(2)
  18471. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18472. goto _30
  18473. }
  18474. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18475. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18476. } else {
  18477. v33 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18478. }
  18479. switch v33 {
  18480. case int32(_BT_S):
  18481. fallthrough
  18482. case int32(_BT_LF):
  18483. case int32(_BT_CR):
  18484. /* don't split CR/LF pair */
  18485. if ptr+uintptr(2) != end {
  18486. break
  18487. }
  18488. /* fall through */
  18489. fallthrough
  18490. default:
  18491. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18492. return int32(m_XML_TOK_PROLOG_S)
  18493. }
  18494. goto _31
  18495. _31:
  18496. ;
  18497. goto _32
  18498. goto _30
  18499. _30:
  18500. ;
  18501. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18502. return int32(m_XML_TOK_PROLOG_S)
  18503. _8:
  18504. ;
  18505. return _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18506. _9:
  18507. ;
  18508. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18509. return int32(m_XML_TOK_COMMA)
  18510. _10:
  18511. ;
  18512. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18513. return int32(m_XML_TOK_OPEN_BRACKET)
  18514. _11:
  18515. ;
  18516. ptr += uintptr(2)
  18517. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18518. return -int32(m_XML_TOK_CLOSE_BRACKET)
  18519. }
  18520. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  18521. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  18522. return -int32(1)
  18523. }
  18524. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_GT1) {
  18525. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  18526. return int32(m_XML_TOK_COND_SECT_CLOSE)
  18527. }
  18528. }
  18529. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18530. return int32(m_XML_TOK_CLOSE_BRACKET)
  18531. _12:
  18532. ;
  18533. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18534. return int32(m_XML_TOK_OPEN_PAREN)
  18535. _13:
  18536. ;
  18537. ptr += uintptr(2)
  18538. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18539. return -int32(m_XML_TOK_CLOSE_PAREN)
  18540. }
  18541. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18542. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18543. } else {
  18544. v34 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18545. }
  18546. switch v34 {
  18547. case int32(_BT_AST):
  18548. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18549. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  18550. case int32(_BT_QUEST):
  18551. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18552. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  18553. case int32(_BT_PLUS):
  18554. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18555. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  18556. case int32(_BT_CR):
  18557. fallthrough
  18558. case int32(_BT_LF):
  18559. fallthrough
  18560. case int32(_BT_S):
  18561. fallthrough
  18562. case int32(_BT_GT):
  18563. fallthrough
  18564. case int32(_BT_COMMA):
  18565. fallthrough
  18566. case int32(_BT_VERBAR):
  18567. fallthrough
  18568. case int32(_BT_RPAR):
  18569. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18570. return int32(m_XML_TOK_CLOSE_PAREN)
  18571. }
  18572. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18573. return m_XML_TOK_INVALID
  18574. _14:
  18575. ;
  18576. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18577. return int32(m_XML_TOK_OR)
  18578. _15:
  18579. ;
  18580. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18581. return int32(m_XML_TOK_DECL_CLOSE)
  18582. _16:
  18583. ;
  18584. return _little2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18585. _17:
  18586. ;
  18587. if int64(end)-int64(ptr) < int64(2) {
  18588. return -int32(2)
  18589. }
  18590. if 0 != 0 {
  18591. ptr += uintptr(2)
  18592. tok = int32(m_XML_TOK_NAME)
  18593. goto _28
  18594. }
  18595. if 0 != 0 {
  18596. ptr += uintptr(2)
  18597. tok = int32(m_XML_TOK_NMTOKEN)
  18598. goto _28
  18599. }
  18600. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18601. return m_XML_TOK_INVALID
  18602. _18:
  18603. ;
  18604. if int64(end)-int64(ptr) < int64(3) {
  18605. return -int32(2)
  18606. }
  18607. if 0 != 0 {
  18608. ptr += uintptr(3)
  18609. tok = int32(m_XML_TOK_NAME)
  18610. goto _28
  18611. }
  18612. if 0 != 0 {
  18613. ptr += uintptr(3)
  18614. tok = int32(m_XML_TOK_NMTOKEN)
  18615. goto _28
  18616. }
  18617. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18618. return m_XML_TOK_INVALID
  18619. _19:
  18620. ;
  18621. if int64(end)-int64(ptr) < int64(4) {
  18622. return -int32(2)
  18623. }
  18624. if 0 != 0 {
  18625. ptr += uintptr(4)
  18626. tok = int32(m_XML_TOK_NAME)
  18627. goto _28
  18628. }
  18629. if 0 != 0 {
  18630. ptr += uintptr(4)
  18631. tok = int32(m_XML_TOK_NMTOKEN)
  18632. goto _28
  18633. }
  18634. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18635. return m_XML_TOK_INVALID
  18636. _21:
  18637. ;
  18638. _20:
  18639. ;
  18640. tok = int32(m_XML_TOK_NAME)
  18641. ptr += uintptr(2)
  18642. goto _28
  18643. _25:
  18644. ;
  18645. _24:
  18646. ;
  18647. _23:
  18648. ;
  18649. _22:
  18650. ;
  18651. tok = int32(m_XML_TOK_NMTOKEN)
  18652. ptr += uintptr(2)
  18653. goto _28
  18654. _26:
  18655. ;
  18656. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&int32(0x1F))) != 0 {
  18657. ptr += uintptr(2)
  18658. tok = int32(m_XML_TOK_NAME)
  18659. goto _28
  18660. }
  18661. if _namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&int32(0x1F))) != 0 {
  18662. ptr += uintptr(2)
  18663. tok = int32(m_XML_TOK_NMTOKEN)
  18664. goto _28
  18665. }
  18666. /* fall through */
  18667. _27:
  18668. ;
  18669. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18670. return m_XML_TOK_INVALID
  18671. _28:
  18672. ;
  18673. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18674. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18675. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18676. } else {
  18677. v35 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18678. }
  18679. switch v35 {
  18680. case int32(_BT_NONASCII):
  18681. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  18682. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18683. return m_XML_TOK_INVALID
  18684. } /* fall through */
  18685. fallthrough
  18686. case int32(_BT_NMSTRT):
  18687. fallthrough
  18688. case int32(_BT_HEX):
  18689. fallthrough
  18690. case int32(_BT_DIGIT):
  18691. fallthrough
  18692. case int32(_BT_NAME):
  18693. fallthrough
  18694. case int32(_BT_MINUS):
  18695. ptr += uintptr(2)
  18696. case int32(_BT_LEAD2):
  18697. if int64(end)-int64(ptr) < int64(2) {
  18698. return -int32(2)
  18699. }
  18700. if !(libc.Int32FromInt32(0) != 0) {
  18701. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18702. return m_XML_TOK_INVALID
  18703. }
  18704. ptr += uintptr(2)
  18705. case int32(_BT_LEAD3):
  18706. if int64(end)-int64(ptr) < int64(3) {
  18707. return -int32(2)
  18708. }
  18709. if !(libc.Int32FromInt32(0) != 0) {
  18710. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18711. return m_XML_TOK_INVALID
  18712. }
  18713. ptr += uintptr(3)
  18714. case int32(_BT_LEAD4):
  18715. if int64(end)-int64(ptr) < int64(4) {
  18716. return -int32(2)
  18717. }
  18718. if !(libc.Int32FromInt32(0) != 0) {
  18719. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18720. return m_XML_TOK_INVALID
  18721. }
  18722. ptr += uintptr(4)
  18723. case int32(_BT_GT):
  18724. fallthrough
  18725. case int32(_BT_RPAR):
  18726. fallthrough
  18727. case int32(_BT_COMMA):
  18728. fallthrough
  18729. case int32(_BT_VERBAR):
  18730. fallthrough
  18731. case int32(_BT_LSQB):
  18732. fallthrough
  18733. case int32(_BT_PERCNT):
  18734. fallthrough
  18735. case int32(_BT_S):
  18736. fallthrough
  18737. case int32(_BT_CR):
  18738. fallthrough
  18739. case int32(_BT_LF):
  18740. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18741. return tok
  18742. case int32(_BT_COLON):
  18743. ptr += uintptr(2)
  18744. switch tok {
  18745. case int32(m_XML_TOK_NAME):
  18746. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18747. return -int32(1)
  18748. }
  18749. tok = int32(m_XML_TOK_PREFIXED_NAME)
  18750. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18751. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18752. } else {
  18753. v36 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18754. }
  18755. switch v36 {
  18756. case int32(_BT_NONASCII):
  18757. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  18758. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18759. return m_XML_TOK_INVALID
  18760. } /* fall through */
  18761. fallthrough
  18762. case int32(_BT_NMSTRT):
  18763. fallthrough
  18764. case int32(_BT_HEX):
  18765. fallthrough
  18766. case int32(_BT_DIGIT):
  18767. fallthrough
  18768. case int32(_BT_NAME):
  18769. fallthrough
  18770. case int32(_BT_MINUS):
  18771. ptr += uintptr(2)
  18772. case int32(_BT_LEAD2):
  18773. if int64(end)-int64(ptr) < int64(2) {
  18774. return -int32(2)
  18775. }
  18776. if !(libc.Int32FromInt32(0) != 0) {
  18777. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18778. return m_XML_TOK_INVALID
  18779. }
  18780. ptr += uintptr(2)
  18781. case int32(_BT_LEAD3):
  18782. if int64(end)-int64(ptr) < int64(3) {
  18783. return -int32(2)
  18784. }
  18785. if !(libc.Int32FromInt32(0) != 0) {
  18786. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18787. return m_XML_TOK_INVALID
  18788. }
  18789. ptr += uintptr(3)
  18790. case int32(_BT_LEAD4):
  18791. if int64(end)-int64(ptr) < int64(4) {
  18792. return -int32(2)
  18793. }
  18794. if !(libc.Int32FromInt32(0) != 0) {
  18795. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18796. return m_XML_TOK_INVALID
  18797. }
  18798. ptr += uintptr(4)
  18799. default:
  18800. tok = int32(m_XML_TOK_NMTOKEN)
  18801. break
  18802. }
  18803. case int32(m_XML_TOK_PREFIXED_NAME):
  18804. tok = int32(m_XML_TOK_NMTOKEN)
  18805. break
  18806. }
  18807. case int32(_BT_PLUS):
  18808. if tok == int32(m_XML_TOK_NMTOKEN) {
  18809. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18810. return m_XML_TOK_INVALID
  18811. }
  18812. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18813. return int32(m_XML_TOK_NAME_PLUS)
  18814. case int32(_BT_AST):
  18815. if tok == int32(m_XML_TOK_NMTOKEN) {
  18816. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18817. return m_XML_TOK_INVALID
  18818. }
  18819. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18820. return int32(m_XML_TOK_NAME_ASTERISK)
  18821. case int32(_BT_QUEST):
  18822. if tok == int32(m_XML_TOK_NMTOKEN) {
  18823. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18824. return m_XML_TOK_INVALID
  18825. }
  18826. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18827. return int32(m_XML_TOK_NAME_QUESTION)
  18828. default:
  18829. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18830. return m_XML_TOK_INVALID
  18831. }
  18832. }
  18833. return -tok
  18834. }
  18835. func _little2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18836. var start uintptr
  18837. var v1, v2 int32
  18838. _, _, _ = start, v1, v2
  18839. if ptr >= end {
  18840. return -int32(4)
  18841. } else {
  18842. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18843. /* This line cannot be executed. The incoming data has already
  18844. * been tokenized once, so incomplete characters like this have
  18845. * already been eliminated from the input. Retaining the paranoia
  18846. * check is still valuable, however.
  18847. */
  18848. return -int32(1) /* LCOV_EXCL_LINE */
  18849. }
  18850. }
  18851. start = ptr
  18852. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18853. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18854. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18855. } else {
  18856. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18857. }
  18858. switch v1 {
  18859. case int32(_BT_LEAD2):
  18860. ptr += uintptr(2)
  18861. case int32(_BT_LEAD3):
  18862. ptr += uintptr(3)
  18863. case int32(_BT_LEAD4):
  18864. ptr += uintptr(4)
  18865. case int32(_BT_AMP):
  18866. if ptr == start {
  18867. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18868. }
  18869. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18870. return int32(m_XML_TOK_DATA_CHARS)
  18871. case int32(_BT_LT):
  18872. /* this is for inside entity references */
  18873. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18874. return m_XML_TOK_INVALID
  18875. case int32(_BT_LF):
  18876. if ptr == start {
  18877. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18878. return int32(m_XML_TOK_DATA_NEWLINE)
  18879. }
  18880. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18881. return int32(m_XML_TOK_DATA_CHARS)
  18882. case int32(_BT_CR):
  18883. if ptr == start {
  18884. ptr += uintptr(2)
  18885. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18886. return -int32(3)
  18887. }
  18888. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18889. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18890. } else {
  18891. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18892. }
  18893. if v2 == int32(_BT_LF) {
  18894. ptr += uintptr(2)
  18895. }
  18896. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18897. return int32(m_XML_TOK_DATA_NEWLINE)
  18898. }
  18899. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18900. return int32(m_XML_TOK_DATA_CHARS)
  18901. case int32(_BT_S):
  18902. if ptr == start {
  18903. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18904. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  18905. }
  18906. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18907. return int32(m_XML_TOK_DATA_CHARS)
  18908. default:
  18909. ptr += uintptr(2)
  18910. break
  18911. }
  18912. }
  18913. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18914. return int32(m_XML_TOK_DATA_CHARS)
  18915. }
  18916. func _little2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18917. var start uintptr
  18918. var tok, v1, v2, v3 int32
  18919. _, _, _, _, _ = start, tok, v1, v2, v3
  18920. if ptr >= end {
  18921. return -int32(4)
  18922. } else {
  18923. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18924. /* This line cannot be executed. The incoming data has already
  18925. * been tokenized once, so incomplete characters like this have
  18926. * already been eliminated from the input. Retaining the paranoia
  18927. * check is still valuable, however.
  18928. */
  18929. return -int32(1) /* LCOV_EXCL_LINE */
  18930. }
  18931. }
  18932. start = ptr
  18933. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18934. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18935. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18936. } else {
  18937. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18938. }
  18939. switch v1 {
  18940. case int32(_BT_LEAD2):
  18941. ptr += uintptr(2)
  18942. case int32(_BT_LEAD3):
  18943. ptr += uintptr(3)
  18944. case int32(_BT_LEAD4):
  18945. ptr += uintptr(4)
  18946. case int32(_BT_AMP):
  18947. if ptr == start {
  18948. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18949. }
  18950. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18951. return int32(m_XML_TOK_DATA_CHARS)
  18952. case int32(_BT_PERCNT):
  18953. if ptr == start {
  18954. tok = _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18955. if tok == int32(m_XML_TOK_PERCENT) {
  18956. v2 = m_XML_TOK_INVALID
  18957. } else {
  18958. v2 = tok
  18959. }
  18960. return v2
  18961. }
  18962. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18963. return int32(m_XML_TOK_DATA_CHARS)
  18964. case int32(_BT_LF):
  18965. if ptr == start {
  18966. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18967. return int32(m_XML_TOK_DATA_NEWLINE)
  18968. }
  18969. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18970. return int32(m_XML_TOK_DATA_CHARS)
  18971. case int32(_BT_CR):
  18972. if ptr == start {
  18973. ptr += uintptr(2)
  18974. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18975. return -int32(3)
  18976. }
  18977. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18978. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18979. } else {
  18980. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18981. }
  18982. if v3 == int32(_BT_LF) {
  18983. ptr += uintptr(2)
  18984. }
  18985. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18986. return int32(m_XML_TOK_DATA_NEWLINE)
  18987. }
  18988. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18989. return int32(m_XML_TOK_DATA_CHARS)
  18990. default:
  18991. ptr += uintptr(2)
  18992. break
  18993. }
  18994. }
  18995. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18996. return int32(m_XML_TOK_DATA_CHARS)
  18997. }
  18998. func _little2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18999. var level, v1 int32
  19000. var n Tsize_t
  19001. _, _, _ = level, n, v1
  19002. level = 0
  19003. if int32(2) > int32(1) {
  19004. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  19005. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  19006. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  19007. end = ptr + uintptr(n)
  19008. }
  19009. }
  19010. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19011. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19012. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19013. } else {
  19014. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19015. }
  19016. switch v1 {
  19017. case int32(_BT_LEAD2):
  19018. if int64(end)-int64(ptr) < int64(2) {
  19019. return -int32(2)
  19020. }
  19021. if 0 != 0 {
  19022. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19023. return m_XML_TOK_INVALID
  19024. }
  19025. ptr += uintptr(2)
  19026. case int32(_BT_LEAD3):
  19027. if int64(end)-int64(ptr) < int64(3) {
  19028. return -int32(2)
  19029. }
  19030. if 0 != 0 {
  19031. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19032. return m_XML_TOK_INVALID
  19033. }
  19034. ptr += uintptr(3)
  19035. case int32(_BT_LEAD4):
  19036. if int64(end)-int64(ptr) < int64(4) {
  19037. return -int32(2)
  19038. }
  19039. if 0 != 0 {
  19040. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19041. return m_XML_TOK_INVALID
  19042. }
  19043. ptr += uintptr(4)
  19044. case int32(_BT_NONXML):
  19045. fallthrough
  19046. case int32(_BT_MALFORM):
  19047. fallthrough
  19048. case int32(_BT_TRAIL):
  19049. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19050. return m_XML_TOK_INVALID
  19051. case int32(_BT_LT):
  19052. ptr += uintptr(2)
  19053. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19054. return -int32(1)
  19055. }
  19056. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL) {
  19057. ptr += uintptr(2)
  19058. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19059. return -int32(1)
  19060. }
  19061. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  19062. level++
  19063. ptr += uintptr(2)
  19064. }
  19065. }
  19066. case int32(_BT_RSQB):
  19067. ptr += uintptr(2)
  19068. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19069. return -int32(1)
  19070. }
  19071. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  19072. ptr += uintptr(2)
  19073. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19074. return -int32(1)
  19075. }
  19076. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  19077. ptr += uintptr(2)
  19078. if level == 0 {
  19079. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19080. return int32(m_XML_TOK_IGNORE_SECT)
  19081. }
  19082. level--
  19083. }
  19084. }
  19085. default:
  19086. ptr += uintptr(2)
  19087. break
  19088. }
  19089. }
  19090. return -int32(1)
  19091. }
  19092. func _little2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  19093. var v2, v3, v4 int32
  19094. _, _, _ = v2, v3, v4
  19095. ptr += uintptr(2)
  19096. end -= uintptr(2)
  19097. for {
  19098. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19099. break
  19100. }
  19101. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19102. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19103. } else {
  19104. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19105. }
  19106. switch v2 {
  19107. case int32(_BT_DIGIT):
  19108. fallthrough
  19109. case int32(_BT_HEX):
  19110. fallthrough
  19111. case int32(_BT_MINUS):
  19112. fallthrough
  19113. case int32(_BT_APOS):
  19114. fallthrough
  19115. case int32(_BT_LPAR):
  19116. fallthrough
  19117. case int32(_BT_RPAR):
  19118. fallthrough
  19119. case int32(_BT_PLUS):
  19120. fallthrough
  19121. case int32(_BT_COMMA):
  19122. fallthrough
  19123. case int32(_BT_SOL):
  19124. fallthrough
  19125. case int32(_BT_EQUALS):
  19126. fallthrough
  19127. case int32(_BT_QUEST):
  19128. fallthrough
  19129. case int32(_BT_CR):
  19130. fallthrough
  19131. case int32(_BT_LF):
  19132. fallthrough
  19133. case int32(_BT_SEMI):
  19134. fallthrough
  19135. case int32(_BT_EXCL):
  19136. fallthrough
  19137. case int32(_BT_AST):
  19138. fallthrough
  19139. case int32(_BT_PERCNT):
  19140. fallthrough
  19141. case int32(_BT_NUM):
  19142. fallthrough
  19143. case int32(_BT_COLON):
  19144. case int32(_BT_S):
  19145. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  19146. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  19147. return 0
  19148. }
  19149. case int32(_BT_NAME):
  19150. fallthrough
  19151. case int32(_BT_NMSTRT):
  19152. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19153. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  19154. } else {
  19155. v3 = -int32(1)
  19156. }
  19157. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  19158. break
  19159. }
  19160. /* fall through */
  19161. fallthrough
  19162. default:
  19163. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19164. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  19165. } else {
  19166. v4 = -int32(1)
  19167. }
  19168. switch v4 {
  19169. case int32(0x24): /* $ */
  19170. fallthrough
  19171. case int32(0x40): /* @ */
  19172. default:
  19173. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  19174. return 0
  19175. }
  19176. break
  19177. }
  19178. goto _1
  19179. _1:
  19180. ;
  19181. ptr += uintptr(2)
  19182. }
  19183. return int32(1)
  19184. }
  19185. /* This must only be called for a well-formed start-tag or empty
  19186. element tag. Returns the number of attributes. Pointers to the
  19187. first attsMax attributes are stored in atts.
  19188. */
  19189. func _little2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  19190. var nAtts, open, state, v2, v3, v5, v7 int32
  19191. var v4, v6, v8, v9 bool
  19192. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  19193. state = 1
  19194. nAtts = 0
  19195. open = 0 /* defined when state == inValue;
  19196. initialization just to shut up compilers */
  19197. ptr += uintptr(2)
  19198. for {
  19199. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19200. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19201. } else {
  19202. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19203. }
  19204. switch v2 {
  19205. case int32(_BT_LEAD2):
  19206. if state == 0 {
  19207. if nAtts < attsMax {
  19208. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  19209. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  19210. }
  19211. state = 1
  19212. }
  19213. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  19214. case int32(_BT_LEAD3):
  19215. if state == 0 {
  19216. if nAtts < attsMax {
  19217. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  19218. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  19219. }
  19220. state = 1
  19221. }
  19222. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  19223. case int32(_BT_LEAD4):
  19224. if state == 0 {
  19225. if nAtts < attsMax {
  19226. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  19227. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  19228. }
  19229. state = 1
  19230. }
  19231. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  19232. case int32(_BT_NONASCII):
  19233. fallthrough
  19234. case int32(_BT_NMSTRT):
  19235. fallthrough
  19236. case int32(_BT_HEX):
  19237. if state == 0 {
  19238. if nAtts < attsMax {
  19239. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  19240. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  19241. }
  19242. state = 1
  19243. }
  19244. case int32(_BT_QUOT):
  19245. if state != 2 {
  19246. if nAtts < attsMax {
  19247. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  19248. }
  19249. state = 2
  19250. open = int32(_BT_QUOT)
  19251. } else {
  19252. if open == int32(_BT_QUOT) {
  19253. state = 0
  19254. if nAtts < attsMax {
  19255. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  19256. }
  19257. nAtts++
  19258. }
  19259. }
  19260. case int32(_BT_APOS):
  19261. if state != 2 {
  19262. if nAtts < attsMax {
  19263. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  19264. }
  19265. state = 2
  19266. open = int32(_BT_APOS)
  19267. } else {
  19268. if open == int32(_BT_APOS) {
  19269. state = 0
  19270. if nAtts < attsMax {
  19271. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  19272. }
  19273. nAtts++
  19274. }
  19275. }
  19276. case int32(_BT_AMP):
  19277. if nAtts < attsMax {
  19278. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  19279. }
  19280. case int32(_BT_S):
  19281. if state == 1 {
  19282. state = 0
  19283. } else {
  19284. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0; v9 {
  19285. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr; !v4 {
  19286. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19287. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  19288. } else {
  19289. v3 = -int32(1)
  19290. }
  19291. }
  19292. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  19293. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  19294. v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  19295. } else {
  19296. v5 = -int32(1)
  19297. }
  19298. }
  19299. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  19300. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  19301. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))))))
  19302. } else {
  19303. v7 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  19304. }
  19305. }
  19306. }
  19307. if v9 && (v8 || v7 == open) {
  19308. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  19309. }
  19310. }
  19311. case int32(_BT_CR):
  19312. fallthrough
  19313. case int32(_BT_LF):
  19314. /* This case ensures that the first attribute name is counted
  19315. Apart from that we could just change state on the quote. */
  19316. if state == 1 {
  19317. state = 0
  19318. } else {
  19319. if state == 2 && nAtts < attsMax {
  19320. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  19321. }
  19322. }
  19323. case int32(_BT_GT):
  19324. fallthrough
  19325. case int32(_BT_SOL):
  19326. if state != 2 {
  19327. return nAtts
  19328. }
  19329. default:
  19330. break
  19331. }
  19332. goto _1
  19333. _1:
  19334. ;
  19335. ptr += uintptr(2)
  19336. }
  19337. /* not reached */
  19338. return r
  19339. }
  19340. func _little2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  19341. var c, c1, result, v2, v4 int32
  19342. _, _, _, _, _ = c, c1, result, v2, v4
  19343. result = 0
  19344. /* skip &# */
  19345. _ = enc
  19346. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  19347. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x) {
  19348. ptr += uintptr(2)
  19349. for {
  19350. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  19351. break
  19352. }
  19353. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19354. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  19355. } else {
  19356. v2 = -int32(1)
  19357. }
  19358. c = v2
  19359. switch c {
  19360. case int32(m_ASCII_0):
  19361. fallthrough
  19362. case int32(m_ASCII_1):
  19363. fallthrough
  19364. case int32(m_ASCII_2):
  19365. fallthrough
  19366. case int32(m_ASCII_3):
  19367. fallthrough
  19368. case int32(m_ASCII_41):
  19369. fallthrough
  19370. case int32(m_ASCII_51):
  19371. fallthrough
  19372. case int32(m_ASCII_61):
  19373. fallthrough
  19374. case int32(m_ASCII_71):
  19375. fallthrough
  19376. case int32(m_ASCII_8):
  19377. fallthrough
  19378. case int32(m_ASCII_9):
  19379. result <<= int32(4)
  19380. result |= c - int32(m_ASCII_0)
  19381. case int32(m_ASCII_A):
  19382. fallthrough
  19383. case int32(m_ASCII_B1):
  19384. fallthrough
  19385. case int32(m_ASCII_C):
  19386. fallthrough
  19387. case int32(m_ASCII_D):
  19388. fallthrough
  19389. case int32(m_ASCII_E):
  19390. fallthrough
  19391. case int32(m_ASCII_F):
  19392. result <<= int32(4)
  19393. result += int32(10) + (c - int32(m_ASCII_A))
  19394. case int32(m_ASCII_a):
  19395. fallthrough
  19396. case int32(m_ASCII_b1):
  19397. fallthrough
  19398. case int32(m_ASCII_c):
  19399. fallthrough
  19400. case int32(m_ASCII_d1):
  19401. fallthrough
  19402. case int32(m_ASCII_e):
  19403. fallthrough
  19404. case int32(m_ASCII_f1):
  19405. result <<= int32(4)
  19406. result += int32(10) + (c - int32(m_ASCII_a))
  19407. break
  19408. }
  19409. if result >= int32(0x110000) {
  19410. return -int32(1)
  19411. }
  19412. goto _1
  19413. _1:
  19414. ;
  19415. ptr += uintptr(2)
  19416. }
  19417. } else {
  19418. for {
  19419. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  19420. break
  19421. }
  19422. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19423. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  19424. } else {
  19425. v4 = -int32(1)
  19426. }
  19427. c1 = v4
  19428. result *= int32(10)
  19429. result += c1 - int32(m_ASCII_0)
  19430. if result >= int32(0x110000) {
  19431. return -int32(1)
  19432. }
  19433. goto _3
  19434. _3:
  19435. ;
  19436. ptr += uintptr(2)
  19437. }
  19438. }
  19439. return _checkCharRefNumber(tls, result)
  19440. }
  19441. func _little2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  19442. var v1, v2 int32
  19443. _, _ = v1, v2
  19444. _ = enc
  19445. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(2) {
  19446. case int64(2):
  19447. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_t) {
  19448. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19449. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  19450. } else {
  19451. v1 = -int32(1)
  19452. }
  19453. switch v1 {
  19454. case int32(m_ASCII_l):
  19455. return int32(m_ASCII_LT1)
  19456. case int32(m_ASCII_g):
  19457. return int32(m_ASCII_GT1)
  19458. }
  19459. }
  19460. case int64(3):
  19461. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a) {
  19462. ptr += uintptr(2)
  19463. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m) {
  19464. ptr += uintptr(2)
  19465. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p) {
  19466. return int32(m_ASCII_AMP1)
  19467. }
  19468. }
  19469. }
  19470. case int64(4):
  19471. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19472. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  19473. } else {
  19474. v2 = -int32(1)
  19475. }
  19476. switch v2 {
  19477. case int32(m_ASCII_q1):
  19478. ptr += uintptr(2)
  19479. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  19480. ptr += uintptr(2)
  19481. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o) {
  19482. ptr += uintptr(2)
  19483. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t) {
  19484. return int32(m_ASCII_QUOT1)
  19485. }
  19486. }
  19487. }
  19488. case int32(m_ASCII_a):
  19489. ptr += uintptr(2)
  19490. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p) {
  19491. ptr += uintptr(2)
  19492. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o) {
  19493. ptr += uintptr(2)
  19494. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s) {
  19495. return int32(m_ASCII_APOS1)
  19496. }
  19497. }
  19498. }
  19499. break
  19500. }
  19501. }
  19502. return 0
  19503. }
  19504. func _little2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  19505. _ = enc
  19506. for {
  19507. if !(*(*uint8)(unsafe.Pointer(ptr2)) != 0) {
  19508. break
  19509. }
  19510. if int64(end1)-int64(ptr1) < int64(2) {
  19511. /* This line cannot be executed. The incoming data has already
  19512. * been tokenized once, so incomplete characters like this have
  19513. * already been eliminated from the input. Retaining the
  19514. * paranoia check is still valuable, however.
  19515. */
  19516. return 0 /* LCOV_EXCL_LINE */
  19517. }
  19518. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1 + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr2)))) {
  19519. return 0
  19520. }
  19521. goto _1
  19522. _1:
  19523. ;
  19524. ptr1 += uintptr(2)
  19525. ptr2++
  19526. }
  19527. return libc.BoolInt32(ptr1 == end1)
  19528. }
  19529. func _little2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  19530. var start uintptr
  19531. var v2 int32
  19532. _, _ = start, v2
  19533. start = ptr
  19534. for {
  19535. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19536. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19537. } else {
  19538. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19539. }
  19540. switch v2 {
  19541. case int32(_BT_LEAD2):
  19542. ptr += uintptr(2)
  19543. case int32(_BT_LEAD3):
  19544. ptr += uintptr(3)
  19545. case int32(_BT_LEAD4):
  19546. ptr += uintptr(4)
  19547. case int32(_BT_NONASCII):
  19548. fallthrough
  19549. case int32(_BT_NMSTRT):
  19550. fallthrough
  19551. case int32(_BT_COLON):
  19552. fallthrough
  19553. case int32(_BT_HEX):
  19554. fallthrough
  19555. case int32(_BT_DIGIT):
  19556. fallthrough
  19557. case int32(_BT_NAME):
  19558. fallthrough
  19559. case int32(_BT_MINUS):
  19560. ptr += uintptr(2)
  19561. default:
  19562. return int32(int64(ptr) - int64(start))
  19563. }
  19564. goto _1
  19565. _1:
  19566. }
  19567. return r
  19568. }
  19569. func _little2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  19570. var v2 int32
  19571. _ = v2
  19572. for {
  19573. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19574. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19575. } else {
  19576. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19577. }
  19578. switch v2 {
  19579. case int32(_BT_LF):
  19580. fallthrough
  19581. case int32(_BT_CR):
  19582. fallthrough
  19583. case int32(_BT_S):
  19584. ptr += uintptr(2)
  19585. default:
  19586. return ptr
  19587. }
  19588. goto _1
  19589. _1:
  19590. }
  19591. return r
  19592. }
  19593. func _little2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  19594. var v1, v2 int32
  19595. var v3 bool
  19596. _, _, _ = v1, v2, v3
  19597. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19598. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19599. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19600. } else {
  19601. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19602. }
  19603. switch v1 {
  19604. case int32(_BT_LEAD2):
  19605. ptr += uintptr(2)
  19606. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  19607. case int32(_BT_LEAD3):
  19608. ptr += uintptr(3)
  19609. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  19610. case int32(_BT_LEAD4):
  19611. ptr += uintptr(4)
  19612. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  19613. case int32(_BT_LF):
  19614. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  19615. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  19616. ptr += uintptr(2)
  19617. case int32(_BT_CR):
  19618. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  19619. ptr += uintptr(2)
  19620. if v3 = int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)); v3 {
  19621. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19622. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19623. } else {
  19624. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19625. }
  19626. }
  19627. if v3 && v2 == int32(_BT_LF) {
  19628. ptr += uintptr(2)
  19629. }
  19630. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  19631. default:
  19632. ptr += uintptr(2)
  19633. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  19634. break
  19635. }
  19636. }
  19637. }
  19638. var _little2_encoding_ns = Tnormal_encoding{
  19639. Fenc: TENCODING{
  19640. Fscanners: [4]TSCANNER{},
  19641. FliteralScanners: [2]TSCANNER{},
  19642. FminBytesPerChar: int32(2),
  19643. },
  19644. Ftype1: [256]uint8{
  19645. 9: uint8(_BT_S),
  19646. 10: uint8(_BT_LF),
  19647. 13: uint8(_BT_CR),
  19648. 32: uint8(_BT_S),
  19649. 33: uint8(_BT_EXCL),
  19650. 34: uint8(_BT_QUOT),
  19651. 35: uint8(_BT_NUM),
  19652. 36: uint8(_BT_OTHER),
  19653. 37: uint8(_BT_PERCNT),
  19654. 38: uint8(_BT_AMP),
  19655. 39: uint8(_BT_APOS),
  19656. 40: uint8(_BT_LPAR),
  19657. 41: uint8(_BT_RPAR),
  19658. 42: uint8(_BT_AST),
  19659. 43: uint8(_BT_PLUS),
  19660. 44: uint8(_BT_COMMA),
  19661. 45: uint8(_BT_MINUS),
  19662. 46: uint8(_BT_NAME),
  19663. 47: uint8(_BT_SOL),
  19664. 48: uint8(_BT_DIGIT),
  19665. 49: uint8(_BT_DIGIT),
  19666. 50: uint8(_BT_DIGIT),
  19667. 51: uint8(_BT_DIGIT),
  19668. 52: uint8(_BT_DIGIT),
  19669. 53: uint8(_BT_DIGIT),
  19670. 54: uint8(_BT_DIGIT),
  19671. 55: uint8(_BT_DIGIT),
  19672. 56: uint8(_BT_DIGIT),
  19673. 57: uint8(_BT_DIGIT),
  19674. 58: uint8(_BT_COLON),
  19675. 59: uint8(_BT_SEMI),
  19676. 60: uint8(_BT_LT),
  19677. 61: uint8(_BT_EQUALS),
  19678. 62: uint8(_BT_GT),
  19679. 63: uint8(_BT_QUEST),
  19680. 64: uint8(_BT_OTHER),
  19681. 65: uint8(_BT_HEX),
  19682. 66: uint8(_BT_HEX),
  19683. 67: uint8(_BT_HEX),
  19684. 68: uint8(_BT_HEX),
  19685. 69: uint8(_BT_HEX),
  19686. 70: uint8(_BT_HEX),
  19687. 71: uint8(_BT_NMSTRT),
  19688. 72: uint8(_BT_NMSTRT),
  19689. 73: uint8(_BT_NMSTRT),
  19690. 74: uint8(_BT_NMSTRT),
  19691. 75: uint8(_BT_NMSTRT),
  19692. 76: uint8(_BT_NMSTRT),
  19693. 77: uint8(_BT_NMSTRT),
  19694. 78: uint8(_BT_NMSTRT),
  19695. 79: uint8(_BT_NMSTRT),
  19696. 80: uint8(_BT_NMSTRT),
  19697. 81: uint8(_BT_NMSTRT),
  19698. 82: uint8(_BT_NMSTRT),
  19699. 83: uint8(_BT_NMSTRT),
  19700. 84: uint8(_BT_NMSTRT),
  19701. 85: uint8(_BT_NMSTRT),
  19702. 86: uint8(_BT_NMSTRT),
  19703. 87: uint8(_BT_NMSTRT),
  19704. 88: uint8(_BT_NMSTRT),
  19705. 89: uint8(_BT_NMSTRT),
  19706. 90: uint8(_BT_NMSTRT),
  19707. 91: uint8(_BT_LSQB),
  19708. 92: uint8(_BT_OTHER),
  19709. 93: uint8(_BT_RSQB),
  19710. 94: uint8(_BT_OTHER),
  19711. 95: uint8(_BT_NMSTRT),
  19712. 96: uint8(_BT_OTHER),
  19713. 97: uint8(_BT_HEX),
  19714. 98: uint8(_BT_HEX),
  19715. 99: uint8(_BT_HEX),
  19716. 100: uint8(_BT_HEX),
  19717. 101: uint8(_BT_HEX),
  19718. 102: uint8(_BT_HEX),
  19719. 103: uint8(_BT_NMSTRT),
  19720. 104: uint8(_BT_NMSTRT),
  19721. 105: uint8(_BT_NMSTRT),
  19722. 106: uint8(_BT_NMSTRT),
  19723. 107: uint8(_BT_NMSTRT),
  19724. 108: uint8(_BT_NMSTRT),
  19725. 109: uint8(_BT_NMSTRT),
  19726. 110: uint8(_BT_NMSTRT),
  19727. 111: uint8(_BT_NMSTRT),
  19728. 112: uint8(_BT_NMSTRT),
  19729. 113: uint8(_BT_NMSTRT),
  19730. 114: uint8(_BT_NMSTRT),
  19731. 115: uint8(_BT_NMSTRT),
  19732. 116: uint8(_BT_NMSTRT),
  19733. 117: uint8(_BT_NMSTRT),
  19734. 118: uint8(_BT_NMSTRT),
  19735. 119: uint8(_BT_NMSTRT),
  19736. 120: uint8(_BT_NMSTRT),
  19737. 121: uint8(_BT_NMSTRT),
  19738. 122: uint8(_BT_NMSTRT),
  19739. 123: uint8(_BT_OTHER),
  19740. 124: uint8(_BT_VERBAR),
  19741. 125: uint8(_BT_OTHER),
  19742. 126: uint8(_BT_OTHER),
  19743. 127: uint8(_BT_OTHER),
  19744. 128: uint8(_BT_OTHER),
  19745. 129: uint8(_BT_OTHER),
  19746. 130: uint8(_BT_OTHER),
  19747. 131: uint8(_BT_OTHER),
  19748. 132: uint8(_BT_OTHER),
  19749. 133: uint8(_BT_OTHER),
  19750. 134: uint8(_BT_OTHER),
  19751. 135: uint8(_BT_OTHER),
  19752. 136: uint8(_BT_OTHER),
  19753. 137: uint8(_BT_OTHER),
  19754. 138: uint8(_BT_OTHER),
  19755. 139: uint8(_BT_OTHER),
  19756. 140: uint8(_BT_OTHER),
  19757. 141: uint8(_BT_OTHER),
  19758. 142: uint8(_BT_OTHER),
  19759. 143: uint8(_BT_OTHER),
  19760. 144: uint8(_BT_OTHER),
  19761. 145: uint8(_BT_OTHER),
  19762. 146: uint8(_BT_OTHER),
  19763. 147: uint8(_BT_OTHER),
  19764. 148: uint8(_BT_OTHER),
  19765. 149: uint8(_BT_OTHER),
  19766. 150: uint8(_BT_OTHER),
  19767. 151: uint8(_BT_OTHER),
  19768. 152: uint8(_BT_OTHER),
  19769. 153: uint8(_BT_OTHER),
  19770. 154: uint8(_BT_OTHER),
  19771. 155: uint8(_BT_OTHER),
  19772. 156: uint8(_BT_OTHER),
  19773. 157: uint8(_BT_OTHER),
  19774. 158: uint8(_BT_OTHER),
  19775. 159: uint8(_BT_OTHER),
  19776. 160: uint8(_BT_OTHER),
  19777. 161: uint8(_BT_OTHER),
  19778. 162: uint8(_BT_OTHER),
  19779. 163: uint8(_BT_OTHER),
  19780. 164: uint8(_BT_OTHER),
  19781. 165: uint8(_BT_OTHER),
  19782. 166: uint8(_BT_OTHER),
  19783. 167: uint8(_BT_OTHER),
  19784. 168: uint8(_BT_OTHER),
  19785. 169: uint8(_BT_OTHER),
  19786. 170: uint8(_BT_NMSTRT),
  19787. 171: uint8(_BT_OTHER),
  19788. 172: uint8(_BT_OTHER),
  19789. 173: uint8(_BT_OTHER),
  19790. 174: uint8(_BT_OTHER),
  19791. 175: uint8(_BT_OTHER),
  19792. 176: uint8(_BT_OTHER),
  19793. 177: uint8(_BT_OTHER),
  19794. 178: uint8(_BT_OTHER),
  19795. 179: uint8(_BT_OTHER),
  19796. 180: uint8(_BT_OTHER),
  19797. 181: uint8(_BT_NMSTRT),
  19798. 182: uint8(_BT_OTHER),
  19799. 183: uint8(_BT_NAME),
  19800. 184: uint8(_BT_OTHER),
  19801. 185: uint8(_BT_OTHER),
  19802. 186: uint8(_BT_NMSTRT),
  19803. 187: uint8(_BT_OTHER),
  19804. 188: uint8(_BT_OTHER),
  19805. 189: uint8(_BT_OTHER),
  19806. 190: uint8(_BT_OTHER),
  19807. 191: uint8(_BT_OTHER),
  19808. 192: uint8(_BT_NMSTRT),
  19809. 193: uint8(_BT_NMSTRT),
  19810. 194: uint8(_BT_NMSTRT),
  19811. 195: uint8(_BT_NMSTRT),
  19812. 196: uint8(_BT_NMSTRT),
  19813. 197: uint8(_BT_NMSTRT),
  19814. 198: uint8(_BT_NMSTRT),
  19815. 199: uint8(_BT_NMSTRT),
  19816. 200: uint8(_BT_NMSTRT),
  19817. 201: uint8(_BT_NMSTRT),
  19818. 202: uint8(_BT_NMSTRT),
  19819. 203: uint8(_BT_NMSTRT),
  19820. 204: uint8(_BT_NMSTRT),
  19821. 205: uint8(_BT_NMSTRT),
  19822. 206: uint8(_BT_NMSTRT),
  19823. 207: uint8(_BT_NMSTRT),
  19824. 208: uint8(_BT_NMSTRT),
  19825. 209: uint8(_BT_NMSTRT),
  19826. 210: uint8(_BT_NMSTRT),
  19827. 211: uint8(_BT_NMSTRT),
  19828. 212: uint8(_BT_NMSTRT),
  19829. 213: uint8(_BT_NMSTRT),
  19830. 214: uint8(_BT_NMSTRT),
  19831. 215: uint8(_BT_OTHER),
  19832. 216: uint8(_BT_NMSTRT),
  19833. 217: uint8(_BT_NMSTRT),
  19834. 218: uint8(_BT_NMSTRT),
  19835. 219: uint8(_BT_NMSTRT),
  19836. 220: uint8(_BT_NMSTRT),
  19837. 221: uint8(_BT_NMSTRT),
  19838. 222: uint8(_BT_NMSTRT),
  19839. 223: uint8(_BT_NMSTRT),
  19840. 224: uint8(_BT_NMSTRT),
  19841. 225: uint8(_BT_NMSTRT),
  19842. 226: uint8(_BT_NMSTRT),
  19843. 227: uint8(_BT_NMSTRT),
  19844. 228: uint8(_BT_NMSTRT),
  19845. 229: uint8(_BT_NMSTRT),
  19846. 230: uint8(_BT_NMSTRT),
  19847. 231: uint8(_BT_NMSTRT),
  19848. 232: uint8(_BT_NMSTRT),
  19849. 233: uint8(_BT_NMSTRT),
  19850. 234: uint8(_BT_NMSTRT),
  19851. 235: uint8(_BT_NMSTRT),
  19852. 236: uint8(_BT_NMSTRT),
  19853. 237: uint8(_BT_NMSTRT),
  19854. 238: uint8(_BT_NMSTRT),
  19855. 239: uint8(_BT_NMSTRT),
  19856. 240: uint8(_BT_NMSTRT),
  19857. 241: uint8(_BT_NMSTRT),
  19858. 242: uint8(_BT_NMSTRT),
  19859. 243: uint8(_BT_NMSTRT),
  19860. 244: uint8(_BT_NMSTRT),
  19861. 245: uint8(_BT_NMSTRT),
  19862. 246: uint8(_BT_NMSTRT),
  19863. 247: uint8(_BT_OTHER),
  19864. 248: uint8(_BT_NMSTRT),
  19865. 249: uint8(_BT_NMSTRT),
  19866. 250: uint8(_BT_NMSTRT),
  19867. 251: uint8(_BT_NMSTRT),
  19868. 252: uint8(_BT_NMSTRT),
  19869. 253: uint8(_BT_NMSTRT),
  19870. 254: uint8(_BT_NMSTRT),
  19871. 255: uint8(_BT_NMSTRT),
  19872. },
  19873. }
  19874. func init() {
  19875. p := unsafe.Pointer(&_little2_encoding_ns)
  19876. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  19877. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  19878. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  19879. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  19880. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  19881. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  19882. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  19883. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  19884. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  19885. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  19886. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  19887. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  19888. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  19889. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  19890. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  19891. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  19892. }
  19893. var _little2_encoding = Tnormal_encoding{
  19894. Fenc: TENCODING{
  19895. Fscanners: [4]TSCANNER{},
  19896. FliteralScanners: [2]TSCANNER{},
  19897. FminBytesPerChar: int32(2),
  19898. },
  19899. Ftype1: [256]uint8{
  19900. 9: uint8(_BT_S),
  19901. 10: uint8(_BT_LF),
  19902. 13: uint8(_BT_CR),
  19903. 32: uint8(_BT_S),
  19904. 33: uint8(_BT_EXCL),
  19905. 34: uint8(_BT_QUOT),
  19906. 35: uint8(_BT_NUM),
  19907. 36: uint8(_BT_OTHER),
  19908. 37: uint8(_BT_PERCNT),
  19909. 38: uint8(_BT_AMP),
  19910. 39: uint8(_BT_APOS),
  19911. 40: uint8(_BT_LPAR),
  19912. 41: uint8(_BT_RPAR),
  19913. 42: uint8(_BT_AST),
  19914. 43: uint8(_BT_PLUS),
  19915. 44: uint8(_BT_COMMA),
  19916. 45: uint8(_BT_MINUS),
  19917. 46: uint8(_BT_NAME),
  19918. 47: uint8(_BT_SOL),
  19919. 48: uint8(_BT_DIGIT),
  19920. 49: uint8(_BT_DIGIT),
  19921. 50: uint8(_BT_DIGIT),
  19922. 51: uint8(_BT_DIGIT),
  19923. 52: uint8(_BT_DIGIT),
  19924. 53: uint8(_BT_DIGIT),
  19925. 54: uint8(_BT_DIGIT),
  19926. 55: uint8(_BT_DIGIT),
  19927. 56: uint8(_BT_DIGIT),
  19928. 57: uint8(_BT_DIGIT),
  19929. 58: uint8(_BT_NMSTRT),
  19930. 59: uint8(_BT_SEMI),
  19931. 60: uint8(_BT_LT),
  19932. 61: uint8(_BT_EQUALS),
  19933. 62: uint8(_BT_GT),
  19934. 63: uint8(_BT_QUEST),
  19935. 64: uint8(_BT_OTHER),
  19936. 65: uint8(_BT_HEX),
  19937. 66: uint8(_BT_HEX),
  19938. 67: uint8(_BT_HEX),
  19939. 68: uint8(_BT_HEX),
  19940. 69: uint8(_BT_HEX),
  19941. 70: uint8(_BT_HEX),
  19942. 71: uint8(_BT_NMSTRT),
  19943. 72: uint8(_BT_NMSTRT),
  19944. 73: uint8(_BT_NMSTRT),
  19945. 74: uint8(_BT_NMSTRT),
  19946. 75: uint8(_BT_NMSTRT),
  19947. 76: uint8(_BT_NMSTRT),
  19948. 77: uint8(_BT_NMSTRT),
  19949. 78: uint8(_BT_NMSTRT),
  19950. 79: uint8(_BT_NMSTRT),
  19951. 80: uint8(_BT_NMSTRT),
  19952. 81: uint8(_BT_NMSTRT),
  19953. 82: uint8(_BT_NMSTRT),
  19954. 83: uint8(_BT_NMSTRT),
  19955. 84: uint8(_BT_NMSTRT),
  19956. 85: uint8(_BT_NMSTRT),
  19957. 86: uint8(_BT_NMSTRT),
  19958. 87: uint8(_BT_NMSTRT),
  19959. 88: uint8(_BT_NMSTRT),
  19960. 89: uint8(_BT_NMSTRT),
  19961. 90: uint8(_BT_NMSTRT),
  19962. 91: uint8(_BT_LSQB),
  19963. 92: uint8(_BT_OTHER),
  19964. 93: uint8(_BT_RSQB),
  19965. 94: uint8(_BT_OTHER),
  19966. 95: uint8(_BT_NMSTRT),
  19967. 96: uint8(_BT_OTHER),
  19968. 97: uint8(_BT_HEX),
  19969. 98: uint8(_BT_HEX),
  19970. 99: uint8(_BT_HEX),
  19971. 100: uint8(_BT_HEX),
  19972. 101: uint8(_BT_HEX),
  19973. 102: uint8(_BT_HEX),
  19974. 103: uint8(_BT_NMSTRT),
  19975. 104: uint8(_BT_NMSTRT),
  19976. 105: uint8(_BT_NMSTRT),
  19977. 106: uint8(_BT_NMSTRT),
  19978. 107: uint8(_BT_NMSTRT),
  19979. 108: uint8(_BT_NMSTRT),
  19980. 109: uint8(_BT_NMSTRT),
  19981. 110: uint8(_BT_NMSTRT),
  19982. 111: uint8(_BT_NMSTRT),
  19983. 112: uint8(_BT_NMSTRT),
  19984. 113: uint8(_BT_NMSTRT),
  19985. 114: uint8(_BT_NMSTRT),
  19986. 115: uint8(_BT_NMSTRT),
  19987. 116: uint8(_BT_NMSTRT),
  19988. 117: uint8(_BT_NMSTRT),
  19989. 118: uint8(_BT_NMSTRT),
  19990. 119: uint8(_BT_NMSTRT),
  19991. 120: uint8(_BT_NMSTRT),
  19992. 121: uint8(_BT_NMSTRT),
  19993. 122: uint8(_BT_NMSTRT),
  19994. 123: uint8(_BT_OTHER),
  19995. 124: uint8(_BT_VERBAR),
  19996. 125: uint8(_BT_OTHER),
  19997. 126: uint8(_BT_OTHER),
  19998. 127: uint8(_BT_OTHER),
  19999. 128: uint8(_BT_OTHER),
  20000. 129: uint8(_BT_OTHER),
  20001. 130: uint8(_BT_OTHER),
  20002. 131: uint8(_BT_OTHER),
  20003. 132: uint8(_BT_OTHER),
  20004. 133: uint8(_BT_OTHER),
  20005. 134: uint8(_BT_OTHER),
  20006. 135: uint8(_BT_OTHER),
  20007. 136: uint8(_BT_OTHER),
  20008. 137: uint8(_BT_OTHER),
  20009. 138: uint8(_BT_OTHER),
  20010. 139: uint8(_BT_OTHER),
  20011. 140: uint8(_BT_OTHER),
  20012. 141: uint8(_BT_OTHER),
  20013. 142: uint8(_BT_OTHER),
  20014. 143: uint8(_BT_OTHER),
  20015. 144: uint8(_BT_OTHER),
  20016. 145: uint8(_BT_OTHER),
  20017. 146: uint8(_BT_OTHER),
  20018. 147: uint8(_BT_OTHER),
  20019. 148: uint8(_BT_OTHER),
  20020. 149: uint8(_BT_OTHER),
  20021. 150: uint8(_BT_OTHER),
  20022. 151: uint8(_BT_OTHER),
  20023. 152: uint8(_BT_OTHER),
  20024. 153: uint8(_BT_OTHER),
  20025. 154: uint8(_BT_OTHER),
  20026. 155: uint8(_BT_OTHER),
  20027. 156: uint8(_BT_OTHER),
  20028. 157: uint8(_BT_OTHER),
  20029. 158: uint8(_BT_OTHER),
  20030. 159: uint8(_BT_OTHER),
  20031. 160: uint8(_BT_OTHER),
  20032. 161: uint8(_BT_OTHER),
  20033. 162: uint8(_BT_OTHER),
  20034. 163: uint8(_BT_OTHER),
  20035. 164: uint8(_BT_OTHER),
  20036. 165: uint8(_BT_OTHER),
  20037. 166: uint8(_BT_OTHER),
  20038. 167: uint8(_BT_OTHER),
  20039. 168: uint8(_BT_OTHER),
  20040. 169: uint8(_BT_OTHER),
  20041. 170: uint8(_BT_NMSTRT),
  20042. 171: uint8(_BT_OTHER),
  20043. 172: uint8(_BT_OTHER),
  20044. 173: uint8(_BT_OTHER),
  20045. 174: uint8(_BT_OTHER),
  20046. 175: uint8(_BT_OTHER),
  20047. 176: uint8(_BT_OTHER),
  20048. 177: uint8(_BT_OTHER),
  20049. 178: uint8(_BT_OTHER),
  20050. 179: uint8(_BT_OTHER),
  20051. 180: uint8(_BT_OTHER),
  20052. 181: uint8(_BT_NMSTRT),
  20053. 182: uint8(_BT_OTHER),
  20054. 183: uint8(_BT_NAME),
  20055. 184: uint8(_BT_OTHER),
  20056. 185: uint8(_BT_OTHER),
  20057. 186: uint8(_BT_NMSTRT),
  20058. 187: uint8(_BT_OTHER),
  20059. 188: uint8(_BT_OTHER),
  20060. 189: uint8(_BT_OTHER),
  20061. 190: uint8(_BT_OTHER),
  20062. 191: uint8(_BT_OTHER),
  20063. 192: uint8(_BT_NMSTRT),
  20064. 193: uint8(_BT_NMSTRT),
  20065. 194: uint8(_BT_NMSTRT),
  20066. 195: uint8(_BT_NMSTRT),
  20067. 196: uint8(_BT_NMSTRT),
  20068. 197: uint8(_BT_NMSTRT),
  20069. 198: uint8(_BT_NMSTRT),
  20070. 199: uint8(_BT_NMSTRT),
  20071. 200: uint8(_BT_NMSTRT),
  20072. 201: uint8(_BT_NMSTRT),
  20073. 202: uint8(_BT_NMSTRT),
  20074. 203: uint8(_BT_NMSTRT),
  20075. 204: uint8(_BT_NMSTRT),
  20076. 205: uint8(_BT_NMSTRT),
  20077. 206: uint8(_BT_NMSTRT),
  20078. 207: uint8(_BT_NMSTRT),
  20079. 208: uint8(_BT_NMSTRT),
  20080. 209: uint8(_BT_NMSTRT),
  20081. 210: uint8(_BT_NMSTRT),
  20082. 211: uint8(_BT_NMSTRT),
  20083. 212: uint8(_BT_NMSTRT),
  20084. 213: uint8(_BT_NMSTRT),
  20085. 214: uint8(_BT_NMSTRT),
  20086. 215: uint8(_BT_OTHER),
  20087. 216: uint8(_BT_NMSTRT),
  20088. 217: uint8(_BT_NMSTRT),
  20089. 218: uint8(_BT_NMSTRT),
  20090. 219: uint8(_BT_NMSTRT),
  20091. 220: uint8(_BT_NMSTRT),
  20092. 221: uint8(_BT_NMSTRT),
  20093. 222: uint8(_BT_NMSTRT),
  20094. 223: uint8(_BT_NMSTRT),
  20095. 224: uint8(_BT_NMSTRT),
  20096. 225: uint8(_BT_NMSTRT),
  20097. 226: uint8(_BT_NMSTRT),
  20098. 227: uint8(_BT_NMSTRT),
  20099. 228: uint8(_BT_NMSTRT),
  20100. 229: uint8(_BT_NMSTRT),
  20101. 230: uint8(_BT_NMSTRT),
  20102. 231: uint8(_BT_NMSTRT),
  20103. 232: uint8(_BT_NMSTRT),
  20104. 233: uint8(_BT_NMSTRT),
  20105. 234: uint8(_BT_NMSTRT),
  20106. 235: uint8(_BT_NMSTRT),
  20107. 236: uint8(_BT_NMSTRT),
  20108. 237: uint8(_BT_NMSTRT),
  20109. 238: uint8(_BT_NMSTRT),
  20110. 239: uint8(_BT_NMSTRT),
  20111. 240: uint8(_BT_NMSTRT),
  20112. 241: uint8(_BT_NMSTRT),
  20113. 242: uint8(_BT_NMSTRT),
  20114. 243: uint8(_BT_NMSTRT),
  20115. 244: uint8(_BT_NMSTRT),
  20116. 245: uint8(_BT_NMSTRT),
  20117. 246: uint8(_BT_NMSTRT),
  20118. 247: uint8(_BT_OTHER),
  20119. 248: uint8(_BT_NMSTRT),
  20120. 249: uint8(_BT_NMSTRT),
  20121. 250: uint8(_BT_NMSTRT),
  20122. 251: uint8(_BT_NMSTRT),
  20123. 252: uint8(_BT_NMSTRT),
  20124. 253: uint8(_BT_NMSTRT),
  20125. 254: uint8(_BT_NMSTRT),
  20126. 255: uint8(_BT_NMSTRT),
  20127. },
  20128. }
  20129. func init() {
  20130. p := unsafe.Pointer(&_little2_encoding)
  20131. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  20132. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  20133. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  20134. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  20135. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  20136. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  20137. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  20138. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  20139. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  20140. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  20141. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  20142. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  20143. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  20144. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  20145. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  20146. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  20147. }
  20148. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  20149. /* This file is included!
  20150. __ __ _
  20151. ___\ \/ /_ __ __ _| |_
  20152. / _ \\ /| '_ \ / _` | __|
  20153. | __// \| |_) | (_| | |_
  20154. \___/_/\_\ .__/ \__,_|\__|
  20155. |_| XML parser
  20156. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  20157. Copyright (c) 2000-2017 Expat development team
  20158. Licensed under the MIT license:
  20159. Permission is hereby granted, free of charge, to any person obtaining
  20160. a copy of this software and associated documentation files (the
  20161. "Software"), to deal in the Software without restriction, including
  20162. without limitation the rights to use, copy, modify, merge, publish,
  20163. distribute, sublicense, and/or sell copies of the Software, and to permit
  20164. persons to whom the Software is furnished to do so, subject to the
  20165. following conditions:
  20166. The above copyright notice and this permission notice shall be included
  20167. in all copies or substantial portions of the Software.
  20168. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  20169. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20170. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  20171. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  20172. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  20173. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  20174. USE OR OTHER DEALINGS IN THE SOFTWARE.
  20175. */
  20176. /* ptr points to character following "<!-" */
  20177. func _big2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20178. var v1 int32
  20179. _ = v1
  20180. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20181. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1)) {
  20182. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20183. return m_XML_TOK_INVALID
  20184. }
  20185. ptr += uintptr(2)
  20186. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20187. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20188. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20189. } else {
  20190. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20191. }
  20192. switch v1 {
  20193. case int32(_BT_LEAD2):
  20194. if int64(end)-int64(ptr) < int64(2) {
  20195. return -int32(2)
  20196. }
  20197. if 0 != 0 {
  20198. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20199. return m_XML_TOK_INVALID
  20200. }
  20201. ptr += uintptr(2)
  20202. case int32(_BT_LEAD3):
  20203. if int64(end)-int64(ptr) < int64(3) {
  20204. return -int32(2)
  20205. }
  20206. if 0 != 0 {
  20207. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20208. return m_XML_TOK_INVALID
  20209. }
  20210. ptr += uintptr(3)
  20211. case int32(_BT_LEAD4):
  20212. if int64(end)-int64(ptr) < int64(4) {
  20213. return -int32(2)
  20214. }
  20215. if 0 != 0 {
  20216. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20217. return m_XML_TOK_INVALID
  20218. }
  20219. ptr += uintptr(4)
  20220. case int32(_BT_NONXML):
  20221. fallthrough
  20222. case int32(_BT_MALFORM):
  20223. fallthrough
  20224. case int32(_BT_TRAIL):
  20225. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20226. return m_XML_TOK_INVALID
  20227. case int32(_BT_MINUS):
  20228. ptr += uintptr(2)
  20229. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20230. return -int32(1)
  20231. }
  20232. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1) {
  20233. ptr += uintptr(2)
  20234. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20235. return -int32(1)
  20236. }
  20237. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  20238. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20239. return m_XML_TOK_INVALID
  20240. }
  20241. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20242. return int32(m_XML_TOK_COMMENT)
  20243. }
  20244. default:
  20245. ptr += uintptr(2)
  20246. break
  20247. }
  20248. }
  20249. }
  20250. return -int32(1)
  20251. }
  20252. /* ptr points to character following "<!" */
  20253. func _big2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20254. var v1, v2, v3 int32
  20255. _, _, _ = v1, v2, v3
  20256. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20257. return -int32(1)
  20258. }
  20259. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20260. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20261. } else {
  20262. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20263. }
  20264. switch v1 {
  20265. case int32(_BT_MINUS):
  20266. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20267. case int32(_BT_LSQB):
  20268. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20269. return int32(m_XML_TOK_COND_SECT_OPEN)
  20270. case int32(_BT_NMSTRT):
  20271. fallthrough
  20272. case int32(_BT_HEX):
  20273. ptr += uintptr(2)
  20274. default:
  20275. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20276. return m_XML_TOK_INVALID
  20277. }
  20278. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20279. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20280. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20281. } else {
  20282. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20283. }
  20284. switch v2 {
  20285. case int32(_BT_PERCNT):
  20286. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  20287. return -int32(1)
  20288. }
  20289. /* don't allow <!ENTITY% foo "whatever"> */
  20290. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  20291. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))))))
  20292. } else {
  20293. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  20294. }
  20295. switch v3 {
  20296. case int32(_BT_S):
  20297. fallthrough
  20298. case int32(_BT_CR):
  20299. fallthrough
  20300. case int32(_BT_LF):
  20301. fallthrough
  20302. case int32(_BT_PERCNT):
  20303. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20304. return m_XML_TOK_INVALID
  20305. }
  20306. /* fall through */
  20307. fallthrough
  20308. case int32(_BT_S):
  20309. fallthrough
  20310. case int32(_BT_CR):
  20311. fallthrough
  20312. case int32(_BT_LF):
  20313. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20314. return int32(m_XML_TOK_DECL_OPEN)
  20315. case int32(_BT_NMSTRT):
  20316. fallthrough
  20317. case int32(_BT_HEX):
  20318. ptr += uintptr(2)
  20319. default:
  20320. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20321. return m_XML_TOK_INVALID
  20322. }
  20323. }
  20324. return -int32(1)
  20325. }
  20326. func _big2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  20327. var upper, v1, v2, v3 int32
  20328. _, _, _, _ = upper, v1, v2, v3
  20329. upper = 0
  20330. _ = enc
  20331. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  20332. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(3)) {
  20333. return int32(1)
  20334. }
  20335. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20336. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  20337. } else {
  20338. v1 = -int32(1)
  20339. }
  20340. switch v1 {
  20341. case int32(m_ASCII_x):
  20342. case int32(m_ASCII_X):
  20343. upper = int32(1)
  20344. default:
  20345. return int32(1)
  20346. }
  20347. ptr += uintptr(2)
  20348. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20349. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  20350. } else {
  20351. v2 = -int32(1)
  20352. }
  20353. switch v2 {
  20354. case int32(m_ASCII_m):
  20355. case int32(m_ASCII_M):
  20356. upper = int32(1)
  20357. default:
  20358. return int32(1)
  20359. }
  20360. ptr += uintptr(2)
  20361. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20362. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  20363. } else {
  20364. v3 = -int32(1)
  20365. }
  20366. switch v3 {
  20367. case int32(m_ASCII_l):
  20368. case int32(m_ASCII_L):
  20369. upper = int32(1)
  20370. default:
  20371. return int32(1)
  20372. }
  20373. if upper != 0 {
  20374. return 0
  20375. }
  20376. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  20377. return int32(1)
  20378. }
  20379. /* ptr points to character following "<?" */
  20380. func _big2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20381. bp := tls.Alloc(16)
  20382. defer tls.Free(16)
  20383. var target uintptr
  20384. var v1, v2, v3 int32
  20385. var _ /* tok at bp+0 */ int32
  20386. _, _, _, _ = target, v1, v2, v3
  20387. target = ptr
  20388. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20389. return -int32(1)
  20390. }
  20391. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20392. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20393. } else {
  20394. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20395. }
  20396. switch v1 {
  20397. case int32(_BT_NONASCII):
  20398. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  20399. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20400. return m_XML_TOK_INVALID
  20401. } /* fall through */
  20402. fallthrough
  20403. case int32(_BT_NMSTRT):
  20404. fallthrough
  20405. case int32(_BT_HEX):
  20406. ptr += uintptr(2)
  20407. case int32(_BT_LEAD2):
  20408. if int64(end)-int64(ptr) < int64(2) {
  20409. return -int32(2)
  20410. }
  20411. if !(libc.Int32FromInt32(0) != 0) {
  20412. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20413. return m_XML_TOK_INVALID
  20414. }
  20415. ptr += uintptr(2)
  20416. case int32(_BT_LEAD3):
  20417. if int64(end)-int64(ptr) < int64(3) {
  20418. return -int32(2)
  20419. }
  20420. if !(libc.Int32FromInt32(0) != 0) {
  20421. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20422. return m_XML_TOK_INVALID
  20423. }
  20424. ptr += uintptr(3)
  20425. case int32(_BT_LEAD4):
  20426. if int64(end)-int64(ptr) < int64(4) {
  20427. return -int32(2)
  20428. }
  20429. if !(libc.Int32FromInt32(0) != 0) {
  20430. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20431. return m_XML_TOK_INVALID
  20432. }
  20433. ptr += uintptr(4)
  20434. default:
  20435. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20436. return m_XML_TOK_INVALID
  20437. }
  20438. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20439. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20440. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20441. } else {
  20442. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20443. }
  20444. switch v2 {
  20445. case int32(_BT_NONASCII):
  20446. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  20447. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20448. return m_XML_TOK_INVALID
  20449. } /* fall through */
  20450. fallthrough
  20451. case int32(_BT_NMSTRT):
  20452. fallthrough
  20453. case int32(_BT_HEX):
  20454. fallthrough
  20455. case int32(_BT_DIGIT):
  20456. fallthrough
  20457. case int32(_BT_NAME):
  20458. fallthrough
  20459. case int32(_BT_MINUS):
  20460. ptr += uintptr(2)
  20461. case int32(_BT_LEAD2):
  20462. if int64(end)-int64(ptr) < int64(2) {
  20463. return -int32(2)
  20464. }
  20465. if !(libc.Int32FromInt32(0) != 0) {
  20466. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20467. return m_XML_TOK_INVALID
  20468. }
  20469. ptr += uintptr(2)
  20470. case int32(_BT_LEAD3):
  20471. if int64(end)-int64(ptr) < int64(3) {
  20472. return -int32(2)
  20473. }
  20474. if !(libc.Int32FromInt32(0) != 0) {
  20475. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20476. return m_XML_TOK_INVALID
  20477. }
  20478. ptr += uintptr(3)
  20479. case int32(_BT_LEAD4):
  20480. if int64(end)-int64(ptr) < int64(4) {
  20481. return -int32(2)
  20482. }
  20483. if !(libc.Int32FromInt32(0) != 0) {
  20484. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20485. return m_XML_TOK_INVALID
  20486. }
  20487. ptr += uintptr(4)
  20488. case int32(_BT_S):
  20489. fallthrough
  20490. case int32(_BT_CR):
  20491. fallthrough
  20492. case int32(_BT_LF):
  20493. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  20494. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20495. return m_XML_TOK_INVALID
  20496. }
  20497. ptr += uintptr(2)
  20498. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20499. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20500. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20501. } else {
  20502. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20503. }
  20504. switch v3 {
  20505. case int32(_BT_LEAD2):
  20506. if int64(end)-int64(ptr) < int64(2) {
  20507. return -int32(2)
  20508. }
  20509. if 0 != 0 {
  20510. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20511. return m_XML_TOK_INVALID
  20512. }
  20513. ptr += uintptr(2)
  20514. case int32(_BT_LEAD3):
  20515. if int64(end)-int64(ptr) < int64(3) {
  20516. return -int32(2)
  20517. }
  20518. if 0 != 0 {
  20519. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20520. return m_XML_TOK_INVALID
  20521. }
  20522. ptr += uintptr(3)
  20523. case int32(_BT_LEAD4):
  20524. if int64(end)-int64(ptr) < int64(4) {
  20525. return -int32(2)
  20526. }
  20527. if 0 != 0 {
  20528. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20529. return m_XML_TOK_INVALID
  20530. }
  20531. ptr += uintptr(4)
  20532. case int32(_BT_NONXML):
  20533. fallthrough
  20534. case int32(_BT_MALFORM):
  20535. fallthrough
  20536. case int32(_BT_TRAIL):
  20537. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20538. return m_XML_TOK_INVALID
  20539. case int32(_BT_QUEST):
  20540. ptr += uintptr(2)
  20541. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20542. return -int32(1)
  20543. }
  20544. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  20545. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20546. return *(*int32)(unsafe.Pointer(bp))
  20547. }
  20548. default:
  20549. ptr += uintptr(2)
  20550. break
  20551. }
  20552. }
  20553. return -int32(1)
  20554. case int32(_BT_QUEST):
  20555. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  20556. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20557. return m_XML_TOK_INVALID
  20558. }
  20559. ptr += uintptr(2)
  20560. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20561. return -int32(1)
  20562. }
  20563. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  20564. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20565. return *(*int32)(unsafe.Pointer(bp))
  20566. }
  20567. /* fall through */
  20568. fallthrough
  20569. default:
  20570. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20571. return m_XML_TOK_INVALID
  20572. }
  20573. }
  20574. return -int32(1)
  20575. }
  20576. func _big2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20577. var i int32
  20578. _ = i
  20579. _ = enc
  20580. /* CDATA[ */
  20581. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))) {
  20582. return -int32(1)
  20583. }
  20584. i = 0
  20585. for {
  20586. if !(i < int32(6)) {
  20587. break
  20588. }
  20589. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == libc.Int32FromUint8(_CDATA_LSQB2[i])) {
  20590. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20591. return m_XML_TOK_INVALID
  20592. }
  20593. goto _1
  20594. _1:
  20595. ;
  20596. i++
  20597. ptr += uintptr(2)
  20598. }
  20599. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20600. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  20601. }
  20602. var _CDATA_LSQB2 = [6]uint8{
  20603. 0: uint8(m_ASCII_C),
  20604. 1: uint8(m_ASCII_D),
  20605. 2: uint8(m_ASCII_A),
  20606. 3: uint8(m_ASCII_T),
  20607. 4: uint8(m_ASCII_A),
  20608. 5: uint8(m_ASCII_LSQB1),
  20609. }
  20610. func _big2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20611. var n Tsize_t
  20612. var v1, v2, v3 int32
  20613. _, _, _, _ = n, v1, v2, v3
  20614. if ptr >= end {
  20615. return -int32(4)
  20616. }
  20617. if int32(2) > int32(1) {
  20618. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  20619. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  20620. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  20621. if n == uint64(0) {
  20622. return -int32(1)
  20623. }
  20624. end = ptr + uintptr(n)
  20625. }
  20626. }
  20627. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20628. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20629. } else {
  20630. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20631. }
  20632. switch v1 {
  20633. case int32(_BT_RSQB):
  20634. ptr += uintptr(2)
  20635. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20636. return -int32(1)
  20637. }
  20638. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  20639. break
  20640. }
  20641. ptr += uintptr(2)
  20642. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20643. return -int32(1)
  20644. }
  20645. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  20646. ptr -= uintptr(2)
  20647. break
  20648. }
  20649. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20650. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  20651. case int32(_BT_CR):
  20652. ptr += uintptr(2)
  20653. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20654. return -int32(1)
  20655. }
  20656. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20657. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20658. } else {
  20659. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20660. }
  20661. if v2 == int32(_BT_LF) {
  20662. ptr += uintptr(2)
  20663. }
  20664. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20665. return int32(m_XML_TOK_DATA_NEWLINE)
  20666. case int32(_BT_LF):
  20667. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20668. return int32(m_XML_TOK_DATA_NEWLINE)
  20669. case int32(_BT_LEAD2):
  20670. if int64(end)-int64(ptr) < int64(2) {
  20671. return -int32(2)
  20672. }
  20673. if 0 != 0 {
  20674. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20675. return m_XML_TOK_INVALID
  20676. }
  20677. ptr += uintptr(2)
  20678. case int32(_BT_LEAD3):
  20679. if int64(end)-int64(ptr) < int64(3) {
  20680. return -int32(2)
  20681. }
  20682. if 0 != 0 {
  20683. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20684. return m_XML_TOK_INVALID
  20685. }
  20686. ptr += uintptr(3)
  20687. case int32(_BT_LEAD4):
  20688. if int64(end)-int64(ptr) < int64(4) {
  20689. return -int32(2)
  20690. }
  20691. if 0 != 0 {
  20692. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20693. return m_XML_TOK_INVALID
  20694. }
  20695. ptr += uintptr(4)
  20696. case int32(_BT_NONXML):
  20697. fallthrough
  20698. case int32(_BT_MALFORM):
  20699. fallthrough
  20700. case int32(_BT_TRAIL):
  20701. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20702. return m_XML_TOK_INVALID
  20703. default:
  20704. ptr += uintptr(2)
  20705. break
  20706. }
  20707. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20708. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20709. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20710. } else {
  20711. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20712. }
  20713. switch v3 {
  20714. case int32(_BT_LEAD2):
  20715. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  20716. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20717. return int32(m_XML_TOK_DATA_CHARS)
  20718. }
  20719. ptr += uintptr(2)
  20720. case int32(_BT_LEAD3):
  20721. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  20722. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20723. return int32(m_XML_TOK_DATA_CHARS)
  20724. }
  20725. ptr += uintptr(3)
  20726. case int32(_BT_LEAD4):
  20727. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  20728. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20729. return int32(m_XML_TOK_DATA_CHARS)
  20730. }
  20731. ptr += uintptr(4)
  20732. case int32(_BT_NONXML):
  20733. fallthrough
  20734. case int32(_BT_MALFORM):
  20735. fallthrough
  20736. case int32(_BT_TRAIL):
  20737. fallthrough
  20738. case int32(_BT_CR):
  20739. fallthrough
  20740. case int32(_BT_LF):
  20741. fallthrough
  20742. case int32(_BT_RSQB):
  20743. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20744. return int32(m_XML_TOK_DATA_CHARS)
  20745. default:
  20746. ptr += uintptr(2)
  20747. break
  20748. }
  20749. }
  20750. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20751. return int32(m_XML_TOK_DATA_CHARS)
  20752. }
  20753. /* ptr points to character following "</" */
  20754. func _big2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20755. var v1, v2, v22 int32
  20756. _, _, _ = v1, v2, v22
  20757. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20758. return -int32(1)
  20759. }
  20760. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20761. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20762. } else {
  20763. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20764. }
  20765. switch v1 {
  20766. case int32(_BT_NONASCII):
  20767. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  20768. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20769. return m_XML_TOK_INVALID
  20770. } /* fall through */
  20771. fallthrough
  20772. case int32(_BT_NMSTRT):
  20773. fallthrough
  20774. case int32(_BT_HEX):
  20775. ptr += uintptr(2)
  20776. case int32(_BT_LEAD2):
  20777. if int64(end)-int64(ptr) < int64(2) {
  20778. return -int32(2)
  20779. }
  20780. if !(libc.Int32FromInt32(0) != 0) {
  20781. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20782. return m_XML_TOK_INVALID
  20783. }
  20784. ptr += uintptr(2)
  20785. case int32(_BT_LEAD3):
  20786. if int64(end)-int64(ptr) < int64(3) {
  20787. return -int32(2)
  20788. }
  20789. if !(libc.Int32FromInt32(0) != 0) {
  20790. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20791. return m_XML_TOK_INVALID
  20792. }
  20793. ptr += uintptr(3)
  20794. case int32(_BT_LEAD4):
  20795. if int64(end)-int64(ptr) < int64(4) {
  20796. return -int32(2)
  20797. }
  20798. if !(libc.Int32FromInt32(0) != 0) {
  20799. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20800. return m_XML_TOK_INVALID
  20801. }
  20802. ptr += uintptr(4)
  20803. default:
  20804. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20805. return m_XML_TOK_INVALID
  20806. }
  20807. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20808. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20809. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20810. } else {
  20811. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20812. }
  20813. switch v2 {
  20814. case int32(_BT_NONASCII):
  20815. goto _3
  20816. case int32(_BT_MINUS):
  20817. goto _4
  20818. case int32(_BT_NAME):
  20819. goto _5
  20820. case int32(_BT_DIGIT):
  20821. goto _6
  20822. case int32(_BT_HEX):
  20823. goto _7
  20824. case int32(_BT_NMSTRT):
  20825. goto _8
  20826. case int32(_BT_LEAD2):
  20827. goto _9
  20828. case int32(_BT_LEAD3):
  20829. goto _10
  20830. case int32(_BT_LEAD4):
  20831. goto _11
  20832. case int32(_BT_LF):
  20833. goto _12
  20834. case int32(_BT_CR):
  20835. goto _13
  20836. case int32(_BT_S):
  20837. goto _14
  20838. case int32(_BT_COLON):
  20839. goto _15
  20840. case int32(_BT_GT):
  20841. goto _16
  20842. default:
  20843. goto _17
  20844. }
  20845. goto _18
  20846. _3:
  20847. ;
  20848. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  20849. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20850. return m_XML_TOK_INVALID
  20851. } /* fall through */
  20852. _8:
  20853. ;
  20854. _7:
  20855. ;
  20856. _6:
  20857. ;
  20858. _5:
  20859. ;
  20860. _4:
  20861. ;
  20862. ptr += uintptr(2)
  20863. goto _18
  20864. _9:
  20865. ;
  20866. if int64(end)-int64(ptr) < int64(2) {
  20867. return -int32(2)
  20868. }
  20869. if !(libc.Int32FromInt32(0) != 0) {
  20870. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20871. return m_XML_TOK_INVALID
  20872. }
  20873. ptr += uintptr(2)
  20874. goto _18
  20875. _10:
  20876. ;
  20877. if int64(end)-int64(ptr) < int64(3) {
  20878. return -int32(2)
  20879. }
  20880. if !(libc.Int32FromInt32(0) != 0) {
  20881. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20882. return m_XML_TOK_INVALID
  20883. }
  20884. ptr += uintptr(3)
  20885. goto _18
  20886. _11:
  20887. ;
  20888. if int64(end)-int64(ptr) < int64(4) {
  20889. return -int32(2)
  20890. }
  20891. if !(libc.Int32FromInt32(0) != 0) {
  20892. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20893. return m_XML_TOK_INVALID
  20894. }
  20895. ptr += uintptr(4)
  20896. goto _18
  20897. _14:
  20898. ;
  20899. _13:
  20900. ;
  20901. _12:
  20902. ;
  20903. ptr += uintptr(2)
  20904. _21:
  20905. ;
  20906. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20907. goto _19
  20908. }
  20909. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20910. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20911. } else {
  20912. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20913. }
  20914. switch v22 {
  20915. case int32(_BT_S):
  20916. fallthrough
  20917. case int32(_BT_CR):
  20918. fallthrough
  20919. case int32(_BT_LF):
  20920. case int32(_BT_GT):
  20921. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20922. return int32(m_XML_TOK_END_TAG)
  20923. default:
  20924. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20925. return m_XML_TOK_INVALID
  20926. }
  20927. goto _20
  20928. _20:
  20929. ;
  20930. ptr += uintptr(2)
  20931. goto _21
  20932. goto _19
  20933. _19:
  20934. ;
  20935. return -int32(1)
  20936. _15:
  20937. ;
  20938. /* no need to check qname syntax here,
  20939. since end-tag must match exactly */
  20940. ptr += uintptr(2)
  20941. goto _18
  20942. _16:
  20943. ;
  20944. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20945. return int32(m_XML_TOK_END_TAG)
  20946. _17:
  20947. ;
  20948. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20949. return m_XML_TOK_INVALID
  20950. _18:
  20951. }
  20952. return -int32(1)
  20953. }
  20954. /* ptr points to character following "&#X" */
  20955. func _big2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20956. var v1, v3 int32
  20957. _, _ = v1, v3
  20958. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20959. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20960. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20961. } else {
  20962. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20963. }
  20964. switch v1 {
  20965. case int32(_BT_DIGIT):
  20966. fallthrough
  20967. case int32(_BT_HEX):
  20968. default:
  20969. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20970. return m_XML_TOK_INVALID
  20971. }
  20972. ptr += uintptr(2)
  20973. for {
  20974. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20975. break
  20976. }
  20977. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20978. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20979. } else {
  20980. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20981. }
  20982. switch v3 {
  20983. case int32(_BT_DIGIT):
  20984. fallthrough
  20985. case int32(_BT_HEX):
  20986. case int32(_BT_SEMI):
  20987. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20988. return int32(m_XML_TOK_CHAR_REF)
  20989. default:
  20990. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20991. return m_XML_TOK_INVALID
  20992. }
  20993. goto _2
  20994. _2:
  20995. ;
  20996. ptr += uintptr(2)
  20997. }
  20998. }
  20999. return -int32(1)
  21000. }
  21001. /* ptr points to character following "&#" */
  21002. func _big2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21003. var v1, v3 int32
  21004. _, _ = v1, v3
  21005. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21006. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x) {
  21007. return _big2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21008. }
  21009. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21010. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21011. } else {
  21012. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21013. }
  21014. switch v1 {
  21015. case int32(_BT_DIGIT):
  21016. default:
  21017. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21018. return m_XML_TOK_INVALID
  21019. }
  21020. ptr += uintptr(2)
  21021. for {
  21022. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21023. break
  21024. }
  21025. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21026. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21027. } else {
  21028. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21029. }
  21030. switch v3 {
  21031. case int32(_BT_DIGIT):
  21032. case int32(_BT_SEMI):
  21033. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21034. return int32(m_XML_TOK_CHAR_REF)
  21035. default:
  21036. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21037. return m_XML_TOK_INVALID
  21038. }
  21039. goto _2
  21040. _2:
  21041. ;
  21042. ptr += uintptr(2)
  21043. }
  21044. }
  21045. return -int32(1)
  21046. }
  21047. /* ptr points to character following "&" */
  21048. func _big2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21049. var v1, v2 int32
  21050. _, _ = v1, v2
  21051. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21052. return -int32(1)
  21053. }
  21054. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21055. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21056. } else {
  21057. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21058. }
  21059. switch v1 {
  21060. case int32(_BT_NONASCII):
  21061. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21062. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21063. return m_XML_TOK_INVALID
  21064. } /* fall through */
  21065. fallthrough
  21066. case int32(_BT_NMSTRT):
  21067. fallthrough
  21068. case int32(_BT_HEX):
  21069. ptr += uintptr(2)
  21070. case int32(_BT_LEAD2):
  21071. if int64(end)-int64(ptr) < int64(2) {
  21072. return -int32(2)
  21073. }
  21074. if !(libc.Int32FromInt32(0) != 0) {
  21075. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21076. return m_XML_TOK_INVALID
  21077. }
  21078. ptr += uintptr(2)
  21079. case int32(_BT_LEAD3):
  21080. if int64(end)-int64(ptr) < int64(3) {
  21081. return -int32(2)
  21082. }
  21083. if !(libc.Int32FromInt32(0) != 0) {
  21084. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21085. return m_XML_TOK_INVALID
  21086. }
  21087. ptr += uintptr(3)
  21088. case int32(_BT_LEAD4):
  21089. if int64(end)-int64(ptr) < int64(4) {
  21090. return -int32(2)
  21091. }
  21092. if !(libc.Int32FromInt32(0) != 0) {
  21093. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21094. return m_XML_TOK_INVALID
  21095. }
  21096. ptr += uintptr(4)
  21097. case int32(_BT_NUM):
  21098. return _big2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21099. default:
  21100. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21101. return m_XML_TOK_INVALID
  21102. }
  21103. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21104. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21105. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21106. } else {
  21107. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21108. }
  21109. switch v2 {
  21110. case int32(_BT_NONASCII):
  21111. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21112. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21113. return m_XML_TOK_INVALID
  21114. } /* fall through */
  21115. fallthrough
  21116. case int32(_BT_NMSTRT):
  21117. fallthrough
  21118. case int32(_BT_HEX):
  21119. fallthrough
  21120. case int32(_BT_DIGIT):
  21121. fallthrough
  21122. case int32(_BT_NAME):
  21123. fallthrough
  21124. case int32(_BT_MINUS):
  21125. ptr += uintptr(2)
  21126. case int32(_BT_LEAD2):
  21127. if int64(end)-int64(ptr) < int64(2) {
  21128. return -int32(2)
  21129. }
  21130. if !(libc.Int32FromInt32(0) != 0) {
  21131. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21132. return m_XML_TOK_INVALID
  21133. }
  21134. ptr += uintptr(2)
  21135. case int32(_BT_LEAD3):
  21136. if int64(end)-int64(ptr) < int64(3) {
  21137. return -int32(2)
  21138. }
  21139. if !(libc.Int32FromInt32(0) != 0) {
  21140. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21141. return m_XML_TOK_INVALID
  21142. }
  21143. ptr += uintptr(3)
  21144. case int32(_BT_LEAD4):
  21145. if int64(end)-int64(ptr) < int64(4) {
  21146. return -int32(2)
  21147. }
  21148. if !(libc.Int32FromInt32(0) != 0) {
  21149. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21150. return m_XML_TOK_INVALID
  21151. }
  21152. ptr += uintptr(4)
  21153. case int32(_BT_SEMI):
  21154. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21155. return int32(m_XML_TOK_ENTITY_REF)
  21156. default:
  21157. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21158. return m_XML_TOK_INVALID
  21159. }
  21160. }
  21161. return -int32(1)
  21162. }
  21163. /* ptr points to character following first character of attribute name */
  21164. func _big2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21165. bp := tls.Alloc(16)
  21166. defer tls.Free(16)
  21167. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  21168. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  21169. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  21170. hadColon = 0
  21171. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21172. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  21173. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  21174. } else {
  21175. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  21176. }
  21177. switch v1 {
  21178. case int32(_BT_NONASCII):
  21179. goto _2
  21180. case int32(_BT_MINUS):
  21181. goto _3
  21182. case int32(_BT_NAME):
  21183. goto _4
  21184. case int32(_BT_DIGIT):
  21185. goto _5
  21186. case int32(_BT_HEX):
  21187. goto _6
  21188. case int32(_BT_NMSTRT):
  21189. goto _7
  21190. case int32(_BT_LEAD2):
  21191. goto _8
  21192. case int32(_BT_LEAD3):
  21193. goto _9
  21194. case int32(_BT_LEAD4):
  21195. goto _10
  21196. case int32(_BT_COLON):
  21197. goto _11
  21198. case int32(_BT_LF):
  21199. goto _12
  21200. case int32(_BT_CR):
  21201. goto _13
  21202. case int32(_BT_S):
  21203. goto _14
  21204. case int32(_BT_EQUALS):
  21205. goto _15
  21206. default:
  21207. goto _16
  21208. }
  21209. goto _17
  21210. _2:
  21211. ;
  21212. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21213. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21214. return m_XML_TOK_INVALID
  21215. } /* fall through */
  21216. _7:
  21217. ;
  21218. _6:
  21219. ;
  21220. _5:
  21221. ;
  21222. _4:
  21223. ;
  21224. _3:
  21225. ;
  21226. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21227. goto _17
  21228. _8:
  21229. ;
  21230. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  21231. return -int32(2)
  21232. }
  21233. if !(libc.Int32FromInt32(0) != 0) {
  21234. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21235. return m_XML_TOK_INVALID
  21236. }
  21237. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21238. goto _17
  21239. _9:
  21240. ;
  21241. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  21242. return -int32(2)
  21243. }
  21244. if !(libc.Int32FromInt32(0) != 0) {
  21245. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21246. return m_XML_TOK_INVALID
  21247. }
  21248. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  21249. goto _17
  21250. _10:
  21251. ;
  21252. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  21253. return -int32(2)
  21254. }
  21255. if !(libc.Int32FromInt32(0) != 0) {
  21256. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21257. return m_XML_TOK_INVALID
  21258. }
  21259. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  21260. goto _17
  21261. _11:
  21262. ;
  21263. if hadColon != 0 {
  21264. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21265. return m_XML_TOK_INVALID
  21266. }
  21267. hadColon = int32(1)
  21268. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21269. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21270. return -int32(1)
  21271. }
  21272. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  21273. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  21274. } else {
  21275. v18 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  21276. }
  21277. switch v18 {
  21278. case int32(_BT_NONASCII):
  21279. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21280. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21281. return m_XML_TOK_INVALID
  21282. } /* fall through */
  21283. fallthrough
  21284. case int32(_BT_NMSTRT):
  21285. fallthrough
  21286. case int32(_BT_HEX):
  21287. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21288. case int32(_BT_LEAD2):
  21289. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  21290. return -int32(2)
  21291. }
  21292. if !(libc.Int32FromInt32(0) != 0) {
  21293. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21294. return m_XML_TOK_INVALID
  21295. }
  21296. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21297. case int32(_BT_LEAD3):
  21298. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  21299. return -int32(2)
  21300. }
  21301. if !(libc.Int32FromInt32(0) != 0) {
  21302. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21303. return m_XML_TOK_INVALID
  21304. }
  21305. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  21306. case int32(_BT_LEAD4):
  21307. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  21308. return -int32(2)
  21309. }
  21310. if !(libc.Int32FromInt32(0) != 0) {
  21311. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21312. return m_XML_TOK_INVALID
  21313. }
  21314. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  21315. default:
  21316. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21317. return m_XML_TOK_INVALID
  21318. }
  21319. goto _17
  21320. _14:
  21321. ;
  21322. _13:
  21323. ;
  21324. _12:
  21325. ;
  21326. _21:
  21327. ;
  21328. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21329. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21330. return -int32(1)
  21331. }
  21332. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  21333. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  21334. } else {
  21335. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  21336. }
  21337. t = v22
  21338. if t == int32(_BT_EQUALS) {
  21339. goto _19
  21340. }
  21341. switch t {
  21342. case int32(_BT_S):
  21343. fallthrough
  21344. case int32(_BT_LF):
  21345. fallthrough
  21346. case int32(_BT_CR):
  21347. default:
  21348. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21349. return m_XML_TOK_INVALID
  21350. }
  21351. goto _20
  21352. _20:
  21353. ;
  21354. goto _21
  21355. goto _19
  21356. _19:
  21357. ;
  21358. /* fall through */
  21359. _15:
  21360. ;
  21361. hadColon = 0
  21362. for {
  21363. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21364. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21365. return -int32(1)
  21366. }
  21367. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  21368. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  21369. } else {
  21370. v24 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  21371. }
  21372. open = v24
  21373. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  21374. break
  21375. }
  21376. switch open {
  21377. case int32(_BT_S):
  21378. fallthrough
  21379. case int32(_BT_LF):
  21380. fallthrough
  21381. case int32(_BT_CR):
  21382. default:
  21383. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21384. return m_XML_TOK_INVALID
  21385. }
  21386. goto _23
  21387. _23:
  21388. }
  21389. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21390. /* in attribute value */
  21391. for {
  21392. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21393. return -int32(1)
  21394. }
  21395. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  21396. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  21397. } else {
  21398. v26 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  21399. }
  21400. t1 = v26
  21401. if t1 == open {
  21402. break
  21403. }
  21404. switch t1 {
  21405. case int32(_BT_LEAD2):
  21406. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  21407. return -int32(2)
  21408. }
  21409. if 0 != 0 {
  21410. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21411. return m_XML_TOK_INVALID
  21412. }
  21413. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21414. case int32(_BT_LEAD3):
  21415. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  21416. return -int32(2)
  21417. }
  21418. if 0 != 0 {
  21419. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21420. return m_XML_TOK_INVALID
  21421. }
  21422. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  21423. case int32(_BT_LEAD4):
  21424. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  21425. return -int32(2)
  21426. }
  21427. if 0 != 0 {
  21428. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21429. return m_XML_TOK_INVALID
  21430. }
  21431. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  21432. case int32(_BT_NONXML):
  21433. fallthrough
  21434. case int32(_BT_MALFORM):
  21435. fallthrough
  21436. case int32(_BT_TRAIL):
  21437. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21438. return m_XML_TOK_INVALID
  21439. case int32(_BT_AMP):
  21440. tok = _big2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  21441. if tok <= 0 {
  21442. if tok == m_XML_TOK_INVALID {
  21443. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21444. }
  21445. return tok
  21446. }
  21447. case int32(_BT_LT):
  21448. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21449. return m_XML_TOK_INVALID
  21450. default:
  21451. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21452. break
  21453. }
  21454. goto _25
  21455. _25:
  21456. }
  21457. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21458. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21459. return -int32(1)
  21460. }
  21461. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  21462. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  21463. } else {
  21464. v27 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  21465. }
  21466. switch v27 {
  21467. case int32(_BT_S):
  21468. fallthrough
  21469. case int32(_BT_CR):
  21470. fallthrough
  21471. case int32(_BT_LF):
  21472. case int32(_BT_SOL):
  21473. goto sol
  21474. case int32(_BT_GT):
  21475. goto gt
  21476. default:
  21477. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21478. return m_XML_TOK_INVALID
  21479. }
  21480. /* ptr points to closing quote */
  21481. _30:
  21482. ;
  21483. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21484. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21485. return -int32(1)
  21486. }
  21487. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  21488. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  21489. } else {
  21490. v31 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  21491. }
  21492. switch v31 {
  21493. case int32(_BT_NONASCII):
  21494. goto _32
  21495. case int32(_BT_HEX):
  21496. goto _33
  21497. case int32(_BT_NMSTRT):
  21498. goto _34
  21499. case int32(_BT_LEAD2):
  21500. goto _35
  21501. case int32(_BT_LEAD3):
  21502. goto _36
  21503. case int32(_BT_LEAD4):
  21504. goto _37
  21505. case int32(_BT_LF):
  21506. goto _38
  21507. case int32(_BT_CR):
  21508. goto _39
  21509. case int32(_BT_S):
  21510. goto _40
  21511. case int32(_BT_GT):
  21512. goto _41
  21513. case int32(_BT_SOL):
  21514. goto _42
  21515. default:
  21516. goto _43
  21517. }
  21518. goto _44
  21519. _32:
  21520. ;
  21521. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21522. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21523. return m_XML_TOK_INVALID
  21524. } /* fall through */
  21525. _34:
  21526. ;
  21527. _33:
  21528. ;
  21529. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21530. goto _44
  21531. _35:
  21532. ;
  21533. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  21534. return -int32(2)
  21535. }
  21536. if !(libc.Int32FromInt32(0) != 0) {
  21537. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21538. return m_XML_TOK_INVALID
  21539. }
  21540. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21541. goto _44
  21542. _36:
  21543. ;
  21544. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  21545. return -int32(2)
  21546. }
  21547. if !(libc.Int32FromInt32(0) != 0) {
  21548. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21549. return m_XML_TOK_INVALID
  21550. }
  21551. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  21552. goto _44
  21553. _37:
  21554. ;
  21555. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  21556. return -int32(2)
  21557. }
  21558. if !(libc.Int32FromInt32(0) != 0) {
  21559. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21560. return m_XML_TOK_INVALID
  21561. }
  21562. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  21563. goto _44
  21564. _40:
  21565. ;
  21566. _39:
  21567. ;
  21568. _38:
  21569. ;
  21570. goto _29
  21571. _41:
  21572. ;
  21573. goto gt
  21574. gt:
  21575. ;
  21576. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  21577. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  21578. _42:
  21579. ;
  21580. goto sol
  21581. sol:
  21582. ;
  21583. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21584. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21585. return -int32(1)
  21586. }
  21587. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == int32(m_ASCII_GT1)) {
  21588. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21589. return m_XML_TOK_INVALID
  21590. }
  21591. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  21592. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  21593. _43:
  21594. ;
  21595. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21596. return m_XML_TOK_INVALID
  21597. _44:
  21598. ;
  21599. goto _28
  21600. goto _29
  21601. _29:
  21602. ;
  21603. goto _30
  21604. goto _28
  21605. _28:
  21606. ;
  21607. goto _17
  21608. _16:
  21609. ;
  21610. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21611. return m_XML_TOK_INVALID
  21612. _17:
  21613. }
  21614. return -int32(1)
  21615. }
  21616. /* ptr points to character following "<" */
  21617. func _big2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21618. var hadColon, v1, v2, v21, v22, v3 int32
  21619. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  21620. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21621. return -int32(1)
  21622. }
  21623. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21624. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21625. } else {
  21626. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21627. }
  21628. switch v1 {
  21629. case int32(_BT_NONASCII):
  21630. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21631. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21632. return m_XML_TOK_INVALID
  21633. } /* fall through */
  21634. fallthrough
  21635. case int32(_BT_NMSTRT):
  21636. fallthrough
  21637. case int32(_BT_HEX):
  21638. ptr += uintptr(2)
  21639. case int32(_BT_LEAD2):
  21640. if int64(end)-int64(ptr) < int64(2) {
  21641. return -int32(2)
  21642. }
  21643. if !(libc.Int32FromInt32(0) != 0) {
  21644. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21645. return m_XML_TOK_INVALID
  21646. }
  21647. ptr += uintptr(2)
  21648. case int32(_BT_LEAD3):
  21649. if int64(end)-int64(ptr) < int64(3) {
  21650. return -int32(2)
  21651. }
  21652. if !(libc.Int32FromInt32(0) != 0) {
  21653. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21654. return m_XML_TOK_INVALID
  21655. }
  21656. ptr += uintptr(3)
  21657. case int32(_BT_LEAD4):
  21658. if int64(end)-int64(ptr) < int64(4) {
  21659. return -int32(2)
  21660. }
  21661. if !(libc.Int32FromInt32(0) != 0) {
  21662. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21663. return m_XML_TOK_INVALID
  21664. }
  21665. ptr += uintptr(4)
  21666. case int32(_BT_EXCL):
  21667. ptr += uintptr(2)
  21668. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21669. return -int32(1)
  21670. }
  21671. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21672. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21673. } else {
  21674. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21675. }
  21676. switch v2 {
  21677. case int32(_BT_MINUS):
  21678. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21679. case int32(_BT_LSQB):
  21680. return _big2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21681. }
  21682. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21683. return m_XML_TOK_INVALID
  21684. case int32(_BT_QUEST):
  21685. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21686. case int32(_BT_SOL):
  21687. return _big2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21688. default:
  21689. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21690. return m_XML_TOK_INVALID
  21691. }
  21692. hadColon = 0
  21693. /* we have a start-tag */
  21694. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21695. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21696. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21697. } else {
  21698. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21699. }
  21700. switch v3 {
  21701. case int32(_BT_NONASCII):
  21702. goto _4
  21703. case int32(_BT_MINUS):
  21704. goto _5
  21705. case int32(_BT_NAME):
  21706. goto _6
  21707. case int32(_BT_DIGIT):
  21708. goto _7
  21709. case int32(_BT_HEX):
  21710. goto _8
  21711. case int32(_BT_NMSTRT):
  21712. goto _9
  21713. case int32(_BT_LEAD2):
  21714. goto _10
  21715. case int32(_BT_LEAD3):
  21716. goto _11
  21717. case int32(_BT_LEAD4):
  21718. goto _12
  21719. case int32(_BT_COLON):
  21720. goto _13
  21721. case int32(_BT_LF):
  21722. goto _14
  21723. case int32(_BT_CR):
  21724. goto _15
  21725. case int32(_BT_S):
  21726. goto _16
  21727. case int32(_BT_GT):
  21728. goto _17
  21729. case int32(_BT_SOL):
  21730. goto _18
  21731. default:
  21732. goto _19
  21733. }
  21734. goto _20
  21735. _4:
  21736. ;
  21737. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21738. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21739. return m_XML_TOK_INVALID
  21740. } /* fall through */
  21741. _9:
  21742. ;
  21743. _8:
  21744. ;
  21745. _7:
  21746. ;
  21747. _6:
  21748. ;
  21749. _5:
  21750. ;
  21751. ptr += uintptr(2)
  21752. goto _20
  21753. _10:
  21754. ;
  21755. if int64(end)-int64(ptr) < int64(2) {
  21756. return -int32(2)
  21757. }
  21758. if !(libc.Int32FromInt32(0) != 0) {
  21759. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21760. return m_XML_TOK_INVALID
  21761. }
  21762. ptr += uintptr(2)
  21763. goto _20
  21764. _11:
  21765. ;
  21766. if int64(end)-int64(ptr) < int64(3) {
  21767. return -int32(2)
  21768. }
  21769. if !(libc.Int32FromInt32(0) != 0) {
  21770. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21771. return m_XML_TOK_INVALID
  21772. }
  21773. ptr += uintptr(3)
  21774. goto _20
  21775. _12:
  21776. ;
  21777. if int64(end)-int64(ptr) < int64(4) {
  21778. return -int32(2)
  21779. }
  21780. if !(libc.Int32FromInt32(0) != 0) {
  21781. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21782. return m_XML_TOK_INVALID
  21783. }
  21784. ptr += uintptr(4)
  21785. goto _20
  21786. _13:
  21787. ;
  21788. if hadColon != 0 {
  21789. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21790. return m_XML_TOK_INVALID
  21791. }
  21792. hadColon = int32(1)
  21793. ptr += uintptr(2)
  21794. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21795. return -int32(1)
  21796. }
  21797. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21798. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21799. } else {
  21800. v21 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21801. }
  21802. switch v21 {
  21803. case int32(_BT_NONASCII):
  21804. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21805. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21806. return m_XML_TOK_INVALID
  21807. } /* fall through */
  21808. fallthrough
  21809. case int32(_BT_NMSTRT):
  21810. fallthrough
  21811. case int32(_BT_HEX):
  21812. ptr += uintptr(2)
  21813. case int32(_BT_LEAD2):
  21814. if int64(end)-int64(ptr) < int64(2) {
  21815. return -int32(2)
  21816. }
  21817. if !(libc.Int32FromInt32(0) != 0) {
  21818. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21819. return m_XML_TOK_INVALID
  21820. }
  21821. ptr += uintptr(2)
  21822. case int32(_BT_LEAD3):
  21823. if int64(end)-int64(ptr) < int64(3) {
  21824. return -int32(2)
  21825. }
  21826. if !(libc.Int32FromInt32(0) != 0) {
  21827. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21828. return m_XML_TOK_INVALID
  21829. }
  21830. ptr += uintptr(3)
  21831. case int32(_BT_LEAD4):
  21832. if int64(end)-int64(ptr) < int64(4) {
  21833. return -int32(2)
  21834. }
  21835. if !(libc.Int32FromInt32(0) != 0) {
  21836. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21837. return m_XML_TOK_INVALID
  21838. }
  21839. ptr += uintptr(4)
  21840. default:
  21841. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21842. return m_XML_TOK_INVALID
  21843. }
  21844. goto _20
  21845. _16:
  21846. ;
  21847. _15:
  21848. ;
  21849. _14:
  21850. ;
  21851. ptr += uintptr(2)
  21852. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21853. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21854. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21855. } else {
  21856. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21857. }
  21858. switch v22 {
  21859. case int32(_BT_NONASCII):
  21860. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21861. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21862. return m_XML_TOK_INVALID
  21863. } /* fall through */
  21864. fallthrough
  21865. case int32(_BT_NMSTRT):
  21866. fallthrough
  21867. case int32(_BT_HEX):
  21868. ptr += uintptr(2)
  21869. case int32(_BT_LEAD2):
  21870. if int64(end)-int64(ptr) < int64(2) {
  21871. return -int32(2)
  21872. }
  21873. if !(libc.Int32FromInt32(0) != 0) {
  21874. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21875. return m_XML_TOK_INVALID
  21876. }
  21877. ptr += uintptr(2)
  21878. case int32(_BT_LEAD3):
  21879. if int64(end)-int64(ptr) < int64(3) {
  21880. return -int32(2)
  21881. }
  21882. if !(libc.Int32FromInt32(0) != 0) {
  21883. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21884. return m_XML_TOK_INVALID
  21885. }
  21886. ptr += uintptr(3)
  21887. case int32(_BT_LEAD4):
  21888. if int64(end)-int64(ptr) < int64(4) {
  21889. return -int32(2)
  21890. }
  21891. if !(libc.Int32FromInt32(0) != 0) {
  21892. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21893. return m_XML_TOK_INVALID
  21894. }
  21895. ptr += uintptr(4)
  21896. case int32(_BT_GT):
  21897. goto gt
  21898. case int32(_BT_SOL):
  21899. goto sol
  21900. case int32(_BT_S):
  21901. fallthrough
  21902. case int32(_BT_CR):
  21903. fallthrough
  21904. case int32(_BT_LF):
  21905. ptr += uintptr(2)
  21906. continue
  21907. default:
  21908. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21909. return m_XML_TOK_INVALID
  21910. }
  21911. return _big2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  21912. }
  21913. return -int32(1)
  21914. _17:
  21915. ;
  21916. goto gt
  21917. gt:
  21918. ;
  21919. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21920. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  21921. _18:
  21922. ;
  21923. goto sol
  21924. sol:
  21925. ;
  21926. ptr += uintptr(2)
  21927. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21928. return -int32(1)
  21929. }
  21930. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  21931. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21932. return m_XML_TOK_INVALID
  21933. }
  21934. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21935. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  21936. _19:
  21937. ;
  21938. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21939. return m_XML_TOK_INVALID
  21940. _20:
  21941. }
  21942. return -int32(1)
  21943. }
  21944. func _big2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21945. var n Tsize_t
  21946. var v1, v2, v3 int32
  21947. _, _, _, _ = n, v1, v2, v3
  21948. if ptr >= end {
  21949. return -int32(4)
  21950. }
  21951. if int32(2) > int32(1) {
  21952. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  21953. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  21954. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  21955. if n == uint64(0) {
  21956. return -int32(1)
  21957. }
  21958. end = ptr + uintptr(n)
  21959. }
  21960. }
  21961. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21962. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21963. } else {
  21964. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21965. }
  21966. switch v1 {
  21967. case int32(_BT_LT):
  21968. return _big2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21969. case int32(_BT_AMP):
  21970. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21971. case int32(_BT_CR):
  21972. ptr += uintptr(2)
  21973. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21974. return -int32(3)
  21975. }
  21976. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21977. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21978. } else {
  21979. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21980. }
  21981. if v2 == int32(_BT_LF) {
  21982. ptr += uintptr(2)
  21983. }
  21984. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21985. return int32(m_XML_TOK_DATA_NEWLINE)
  21986. case int32(_BT_LF):
  21987. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21988. return int32(m_XML_TOK_DATA_NEWLINE)
  21989. case int32(_BT_RSQB):
  21990. ptr += uintptr(2)
  21991. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21992. return -int32(5)
  21993. }
  21994. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  21995. break
  21996. }
  21997. ptr += uintptr(2)
  21998. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21999. return -int32(5)
  22000. }
  22001. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  22002. ptr -= uintptr(2)
  22003. break
  22004. }
  22005. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22006. return m_XML_TOK_INVALID
  22007. case int32(_BT_LEAD2):
  22008. if int64(end)-int64(ptr) < int64(2) {
  22009. return -int32(2)
  22010. }
  22011. if 0 != 0 {
  22012. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22013. return m_XML_TOK_INVALID
  22014. }
  22015. ptr += uintptr(2)
  22016. case int32(_BT_LEAD3):
  22017. if int64(end)-int64(ptr) < int64(3) {
  22018. return -int32(2)
  22019. }
  22020. if 0 != 0 {
  22021. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22022. return m_XML_TOK_INVALID
  22023. }
  22024. ptr += uintptr(3)
  22025. case int32(_BT_LEAD4):
  22026. if int64(end)-int64(ptr) < int64(4) {
  22027. return -int32(2)
  22028. }
  22029. if 0 != 0 {
  22030. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22031. return m_XML_TOK_INVALID
  22032. }
  22033. ptr += uintptr(4)
  22034. case int32(_BT_NONXML):
  22035. fallthrough
  22036. case int32(_BT_MALFORM):
  22037. fallthrough
  22038. case int32(_BT_TRAIL):
  22039. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22040. return m_XML_TOK_INVALID
  22041. default:
  22042. ptr += uintptr(2)
  22043. break
  22044. }
  22045. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22046. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22047. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22048. } else {
  22049. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22050. }
  22051. switch v3 {
  22052. case int32(_BT_LEAD2):
  22053. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  22054. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22055. return int32(m_XML_TOK_DATA_CHARS)
  22056. }
  22057. ptr += uintptr(2)
  22058. case int32(_BT_LEAD3):
  22059. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  22060. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22061. return int32(m_XML_TOK_DATA_CHARS)
  22062. }
  22063. ptr += uintptr(3)
  22064. case int32(_BT_LEAD4):
  22065. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  22066. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22067. return int32(m_XML_TOK_DATA_CHARS)
  22068. }
  22069. ptr += uintptr(4)
  22070. case int32(_BT_RSQB):
  22071. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  22072. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_RSQB1)) {
  22073. ptr += uintptr(2)
  22074. break
  22075. }
  22076. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)) {
  22077. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) + 1))) == int32(m_ASCII_GT1)) {
  22078. ptr += uintptr(2)
  22079. break
  22080. }
  22081. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  22082. return m_XML_TOK_INVALID
  22083. }
  22084. }
  22085. /* fall through */
  22086. fallthrough
  22087. case int32(_BT_AMP):
  22088. fallthrough
  22089. case int32(_BT_LT):
  22090. fallthrough
  22091. case int32(_BT_NONXML):
  22092. fallthrough
  22093. case int32(_BT_MALFORM):
  22094. fallthrough
  22095. case int32(_BT_TRAIL):
  22096. fallthrough
  22097. case int32(_BT_CR):
  22098. fallthrough
  22099. case int32(_BT_LF):
  22100. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22101. return int32(m_XML_TOK_DATA_CHARS)
  22102. default:
  22103. ptr += uintptr(2)
  22104. break
  22105. }
  22106. }
  22107. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22108. return int32(m_XML_TOK_DATA_CHARS)
  22109. }
  22110. /* ptr points to character following "%" */
  22111. func _big2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  22112. var v1, v2 int32
  22113. _, _ = v1, v2
  22114. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22115. return -int32(1)
  22116. }
  22117. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22118. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22119. } else {
  22120. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22121. }
  22122. switch v1 {
  22123. case int32(_BT_NONASCII):
  22124. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  22125. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22126. return m_XML_TOK_INVALID
  22127. } /* fall through */
  22128. fallthrough
  22129. case int32(_BT_NMSTRT):
  22130. fallthrough
  22131. case int32(_BT_HEX):
  22132. ptr += uintptr(2)
  22133. case int32(_BT_LEAD2):
  22134. if int64(end)-int64(ptr) < int64(2) {
  22135. return -int32(2)
  22136. }
  22137. if !(libc.Int32FromInt32(0) != 0) {
  22138. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22139. return m_XML_TOK_INVALID
  22140. }
  22141. ptr += uintptr(2)
  22142. case int32(_BT_LEAD3):
  22143. if int64(end)-int64(ptr) < int64(3) {
  22144. return -int32(2)
  22145. }
  22146. if !(libc.Int32FromInt32(0) != 0) {
  22147. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22148. return m_XML_TOK_INVALID
  22149. }
  22150. ptr += uintptr(3)
  22151. case int32(_BT_LEAD4):
  22152. if int64(end)-int64(ptr) < int64(4) {
  22153. return -int32(2)
  22154. }
  22155. if !(libc.Int32FromInt32(0) != 0) {
  22156. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22157. return m_XML_TOK_INVALID
  22158. }
  22159. ptr += uintptr(4)
  22160. case int32(_BT_S):
  22161. fallthrough
  22162. case int32(_BT_LF):
  22163. fallthrough
  22164. case int32(_BT_CR):
  22165. fallthrough
  22166. case int32(_BT_PERCNT):
  22167. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22168. return int32(m_XML_TOK_PERCENT)
  22169. default:
  22170. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22171. return m_XML_TOK_INVALID
  22172. }
  22173. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22174. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22175. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22176. } else {
  22177. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22178. }
  22179. switch v2 {
  22180. case int32(_BT_NONASCII):
  22181. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  22182. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22183. return m_XML_TOK_INVALID
  22184. } /* fall through */
  22185. fallthrough
  22186. case int32(_BT_NMSTRT):
  22187. fallthrough
  22188. case int32(_BT_HEX):
  22189. fallthrough
  22190. case int32(_BT_DIGIT):
  22191. fallthrough
  22192. case int32(_BT_NAME):
  22193. fallthrough
  22194. case int32(_BT_MINUS):
  22195. ptr += uintptr(2)
  22196. case int32(_BT_LEAD2):
  22197. if int64(end)-int64(ptr) < int64(2) {
  22198. return -int32(2)
  22199. }
  22200. if !(libc.Int32FromInt32(0) != 0) {
  22201. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22202. return m_XML_TOK_INVALID
  22203. }
  22204. ptr += uintptr(2)
  22205. case int32(_BT_LEAD3):
  22206. if int64(end)-int64(ptr) < int64(3) {
  22207. return -int32(2)
  22208. }
  22209. if !(libc.Int32FromInt32(0) != 0) {
  22210. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22211. return m_XML_TOK_INVALID
  22212. }
  22213. ptr += uintptr(3)
  22214. case int32(_BT_LEAD4):
  22215. if int64(end)-int64(ptr) < int64(4) {
  22216. return -int32(2)
  22217. }
  22218. if !(libc.Int32FromInt32(0) != 0) {
  22219. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22220. return m_XML_TOK_INVALID
  22221. }
  22222. ptr += uintptr(4)
  22223. case int32(_BT_SEMI):
  22224. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22225. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  22226. default:
  22227. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22228. return m_XML_TOK_INVALID
  22229. }
  22230. }
  22231. return -int32(1)
  22232. }
  22233. func _big2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  22234. var v1, v2 int32
  22235. _, _ = v1, v2
  22236. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22237. return -int32(1)
  22238. }
  22239. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22240. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22241. } else {
  22242. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22243. }
  22244. switch v1 {
  22245. case int32(_BT_NONASCII):
  22246. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  22247. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22248. return m_XML_TOK_INVALID
  22249. } /* fall through */
  22250. fallthrough
  22251. case int32(_BT_NMSTRT):
  22252. fallthrough
  22253. case int32(_BT_HEX):
  22254. ptr += uintptr(2)
  22255. case int32(_BT_LEAD2):
  22256. if int64(end)-int64(ptr) < int64(2) {
  22257. return -int32(2)
  22258. }
  22259. if !(libc.Int32FromInt32(0) != 0) {
  22260. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22261. return m_XML_TOK_INVALID
  22262. }
  22263. ptr += uintptr(2)
  22264. case int32(_BT_LEAD3):
  22265. if int64(end)-int64(ptr) < int64(3) {
  22266. return -int32(2)
  22267. }
  22268. if !(libc.Int32FromInt32(0) != 0) {
  22269. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22270. return m_XML_TOK_INVALID
  22271. }
  22272. ptr += uintptr(3)
  22273. case int32(_BT_LEAD4):
  22274. if int64(end)-int64(ptr) < int64(4) {
  22275. return -int32(2)
  22276. }
  22277. if !(libc.Int32FromInt32(0) != 0) {
  22278. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22279. return m_XML_TOK_INVALID
  22280. }
  22281. ptr += uintptr(4)
  22282. default:
  22283. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22284. return m_XML_TOK_INVALID
  22285. }
  22286. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22287. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22288. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22289. } else {
  22290. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22291. }
  22292. switch v2 {
  22293. case int32(_BT_NONASCII):
  22294. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  22295. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22296. return m_XML_TOK_INVALID
  22297. } /* fall through */
  22298. fallthrough
  22299. case int32(_BT_NMSTRT):
  22300. fallthrough
  22301. case int32(_BT_HEX):
  22302. fallthrough
  22303. case int32(_BT_DIGIT):
  22304. fallthrough
  22305. case int32(_BT_NAME):
  22306. fallthrough
  22307. case int32(_BT_MINUS):
  22308. ptr += uintptr(2)
  22309. case int32(_BT_LEAD2):
  22310. if int64(end)-int64(ptr) < int64(2) {
  22311. return -int32(2)
  22312. }
  22313. if !(libc.Int32FromInt32(0) != 0) {
  22314. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22315. return m_XML_TOK_INVALID
  22316. }
  22317. ptr += uintptr(2)
  22318. case int32(_BT_LEAD3):
  22319. if int64(end)-int64(ptr) < int64(3) {
  22320. return -int32(2)
  22321. }
  22322. if !(libc.Int32FromInt32(0) != 0) {
  22323. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22324. return m_XML_TOK_INVALID
  22325. }
  22326. ptr += uintptr(3)
  22327. case int32(_BT_LEAD4):
  22328. if int64(end)-int64(ptr) < int64(4) {
  22329. return -int32(2)
  22330. }
  22331. if !(libc.Int32FromInt32(0) != 0) {
  22332. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22333. return m_XML_TOK_INVALID
  22334. }
  22335. ptr += uintptr(4)
  22336. case int32(_BT_CR):
  22337. fallthrough
  22338. case int32(_BT_LF):
  22339. fallthrough
  22340. case int32(_BT_S):
  22341. fallthrough
  22342. case int32(_BT_RPAR):
  22343. fallthrough
  22344. case int32(_BT_GT):
  22345. fallthrough
  22346. case int32(_BT_PERCNT):
  22347. fallthrough
  22348. case int32(_BT_VERBAR):
  22349. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22350. return int32(m_XML_TOK_POUND_NAME)
  22351. default:
  22352. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22353. return m_XML_TOK_INVALID
  22354. }
  22355. }
  22356. return -int32(m_XML_TOK_POUND_NAME)
  22357. }
  22358. func _big2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  22359. var t, v1, v2 int32
  22360. _, _, _ = t, v1, v2
  22361. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22362. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22363. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22364. } else {
  22365. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22366. }
  22367. t = v1
  22368. switch t {
  22369. case int32(_BT_LEAD2):
  22370. if int64(end)-int64(ptr) < int64(2) {
  22371. return -int32(2)
  22372. }
  22373. if 0 != 0 {
  22374. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22375. return m_XML_TOK_INVALID
  22376. }
  22377. ptr += uintptr(2)
  22378. case int32(_BT_LEAD3):
  22379. if int64(end)-int64(ptr) < int64(3) {
  22380. return -int32(2)
  22381. }
  22382. if 0 != 0 {
  22383. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22384. return m_XML_TOK_INVALID
  22385. }
  22386. ptr += uintptr(3)
  22387. case int32(_BT_LEAD4):
  22388. if int64(end)-int64(ptr) < int64(4) {
  22389. return -int32(2)
  22390. }
  22391. if 0 != 0 {
  22392. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22393. return m_XML_TOK_INVALID
  22394. }
  22395. ptr += uintptr(4)
  22396. case int32(_BT_NONXML):
  22397. fallthrough
  22398. case int32(_BT_MALFORM):
  22399. fallthrough
  22400. case int32(_BT_TRAIL):
  22401. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22402. return m_XML_TOK_INVALID
  22403. case int32(_BT_QUOT):
  22404. fallthrough
  22405. case int32(_BT_APOS):
  22406. ptr += uintptr(2)
  22407. if t != open {
  22408. break
  22409. }
  22410. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22411. return -int32(m_XML_TOK_LITERAL)
  22412. }
  22413. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22414. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22415. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22416. } else {
  22417. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22418. }
  22419. switch v2 {
  22420. case int32(_BT_S):
  22421. fallthrough
  22422. case int32(_BT_CR):
  22423. fallthrough
  22424. case int32(_BT_LF):
  22425. fallthrough
  22426. case int32(_BT_GT):
  22427. fallthrough
  22428. case int32(_BT_PERCNT):
  22429. fallthrough
  22430. case int32(_BT_LSQB):
  22431. return int32(m_XML_TOK_LITERAL)
  22432. default:
  22433. return m_XML_TOK_INVALID
  22434. }
  22435. fallthrough
  22436. default:
  22437. ptr += uintptr(2)
  22438. break
  22439. }
  22440. }
  22441. return -int32(1)
  22442. }
  22443. func _big2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  22444. var n Tsize_t
  22445. var tok, v1, v29, v33, v34, v35, v36 int32
  22446. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  22447. if ptr >= end {
  22448. return -int32(4)
  22449. }
  22450. if int32(2) > int32(1) {
  22451. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  22452. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  22453. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  22454. if n == uint64(0) {
  22455. return -int32(1)
  22456. }
  22457. end = ptr + uintptr(n)
  22458. }
  22459. }
  22460. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22461. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22462. } else {
  22463. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22464. }
  22465. switch v1 {
  22466. case int32(_BT_QUOT):
  22467. goto _2
  22468. case int32(_BT_APOS):
  22469. goto _3
  22470. case int32(_BT_LT):
  22471. goto _4
  22472. case int32(_BT_CR):
  22473. goto _5
  22474. case int32(_BT_LF):
  22475. goto _6
  22476. case int32(_BT_S):
  22477. goto _7
  22478. case int32(_BT_PERCNT):
  22479. goto _8
  22480. case int32(_BT_COMMA):
  22481. goto _9
  22482. case int32(_BT_LSQB):
  22483. goto _10
  22484. case int32(_BT_RSQB):
  22485. goto _11
  22486. case int32(_BT_LPAR):
  22487. goto _12
  22488. case int32(_BT_RPAR):
  22489. goto _13
  22490. case int32(_BT_VERBAR):
  22491. goto _14
  22492. case int32(_BT_GT):
  22493. goto _15
  22494. case int32(_BT_NUM):
  22495. goto _16
  22496. case int32(_BT_LEAD2):
  22497. goto _17
  22498. case int32(_BT_LEAD3):
  22499. goto _18
  22500. case int32(_BT_LEAD4):
  22501. goto _19
  22502. case int32(_BT_HEX):
  22503. goto _20
  22504. case int32(_BT_NMSTRT):
  22505. goto _21
  22506. case int32(_BT_COLON):
  22507. goto _22
  22508. case int32(_BT_MINUS):
  22509. goto _23
  22510. case int32(_BT_NAME):
  22511. goto _24
  22512. case int32(_BT_DIGIT):
  22513. goto _25
  22514. case int32(_BT_NONASCII):
  22515. goto _26
  22516. default:
  22517. goto _27
  22518. }
  22519. goto _28
  22520. _2:
  22521. ;
  22522. return _big2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  22523. _3:
  22524. ;
  22525. return _big2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  22526. _4:
  22527. ;
  22528. ptr += uintptr(2)
  22529. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22530. return -int32(1)
  22531. }
  22532. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22533. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22534. } else {
  22535. v29 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22536. }
  22537. switch v29 {
  22538. case int32(_BT_EXCL):
  22539. return _big2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22540. case int32(_BT_QUEST):
  22541. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22542. case int32(_BT_NMSTRT):
  22543. fallthrough
  22544. case int32(_BT_HEX):
  22545. fallthrough
  22546. case int32(_BT_NONASCII):
  22547. fallthrough
  22548. case int32(_BT_LEAD2):
  22549. fallthrough
  22550. case int32(_BT_LEAD3):
  22551. fallthrough
  22552. case int32(_BT_LEAD4):
  22553. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  22554. return int32(m_XML_TOK_INSTANCE_START)
  22555. }
  22556. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22557. return m_XML_TOK_INVALID
  22558. _5:
  22559. ;
  22560. if ptr+uintptr(2) == end {
  22561. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  22562. /* indicate that this might be part of a CR/LF pair */
  22563. return -int32(m_XML_TOK_PROLOG_S)
  22564. }
  22565. /* fall through */
  22566. _7:
  22567. ;
  22568. _6:
  22569. ;
  22570. _32:
  22571. ;
  22572. ptr += uintptr(2)
  22573. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22574. goto _30
  22575. }
  22576. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22577. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22578. } else {
  22579. v33 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22580. }
  22581. switch v33 {
  22582. case int32(_BT_S):
  22583. fallthrough
  22584. case int32(_BT_LF):
  22585. case int32(_BT_CR):
  22586. /* don't split CR/LF pair */
  22587. if ptr+uintptr(2) != end {
  22588. break
  22589. }
  22590. /* fall through */
  22591. fallthrough
  22592. default:
  22593. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22594. return int32(m_XML_TOK_PROLOG_S)
  22595. }
  22596. goto _31
  22597. _31:
  22598. ;
  22599. goto _32
  22600. goto _30
  22601. _30:
  22602. ;
  22603. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22604. return int32(m_XML_TOK_PROLOG_S)
  22605. _8:
  22606. ;
  22607. return _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22608. _9:
  22609. ;
  22610. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22611. return int32(m_XML_TOK_COMMA)
  22612. _10:
  22613. ;
  22614. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22615. return int32(m_XML_TOK_OPEN_BRACKET)
  22616. _11:
  22617. ;
  22618. ptr += uintptr(2)
  22619. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22620. return -int32(m_XML_TOK_CLOSE_BRACKET)
  22621. }
  22622. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  22623. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  22624. return -int32(1)
  22625. }
  22626. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_GT1) {
  22627. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  22628. return int32(m_XML_TOK_COND_SECT_CLOSE)
  22629. }
  22630. }
  22631. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22632. return int32(m_XML_TOK_CLOSE_BRACKET)
  22633. _12:
  22634. ;
  22635. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22636. return int32(m_XML_TOK_OPEN_PAREN)
  22637. _13:
  22638. ;
  22639. ptr += uintptr(2)
  22640. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22641. return -int32(m_XML_TOK_CLOSE_PAREN)
  22642. }
  22643. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22644. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22645. } else {
  22646. v34 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22647. }
  22648. switch v34 {
  22649. case int32(_BT_AST):
  22650. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22651. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  22652. case int32(_BT_QUEST):
  22653. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22654. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  22655. case int32(_BT_PLUS):
  22656. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22657. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  22658. case int32(_BT_CR):
  22659. fallthrough
  22660. case int32(_BT_LF):
  22661. fallthrough
  22662. case int32(_BT_S):
  22663. fallthrough
  22664. case int32(_BT_GT):
  22665. fallthrough
  22666. case int32(_BT_COMMA):
  22667. fallthrough
  22668. case int32(_BT_VERBAR):
  22669. fallthrough
  22670. case int32(_BT_RPAR):
  22671. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22672. return int32(m_XML_TOK_CLOSE_PAREN)
  22673. }
  22674. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22675. return m_XML_TOK_INVALID
  22676. _14:
  22677. ;
  22678. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22679. return int32(m_XML_TOK_OR)
  22680. _15:
  22681. ;
  22682. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22683. return int32(m_XML_TOK_DECL_CLOSE)
  22684. _16:
  22685. ;
  22686. return _big2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22687. _17:
  22688. ;
  22689. if int64(end)-int64(ptr) < int64(2) {
  22690. return -int32(2)
  22691. }
  22692. if 0 != 0 {
  22693. ptr += uintptr(2)
  22694. tok = int32(m_XML_TOK_NAME)
  22695. goto _28
  22696. }
  22697. if 0 != 0 {
  22698. ptr += uintptr(2)
  22699. tok = int32(m_XML_TOK_NMTOKEN)
  22700. goto _28
  22701. }
  22702. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22703. return m_XML_TOK_INVALID
  22704. _18:
  22705. ;
  22706. if int64(end)-int64(ptr) < int64(3) {
  22707. return -int32(2)
  22708. }
  22709. if 0 != 0 {
  22710. ptr += uintptr(3)
  22711. tok = int32(m_XML_TOK_NAME)
  22712. goto _28
  22713. }
  22714. if 0 != 0 {
  22715. ptr += uintptr(3)
  22716. tok = int32(m_XML_TOK_NMTOKEN)
  22717. goto _28
  22718. }
  22719. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22720. return m_XML_TOK_INVALID
  22721. _19:
  22722. ;
  22723. if int64(end)-int64(ptr) < int64(4) {
  22724. return -int32(2)
  22725. }
  22726. if 0 != 0 {
  22727. ptr += uintptr(4)
  22728. tok = int32(m_XML_TOK_NAME)
  22729. goto _28
  22730. }
  22731. if 0 != 0 {
  22732. ptr += uintptr(4)
  22733. tok = int32(m_XML_TOK_NMTOKEN)
  22734. goto _28
  22735. }
  22736. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22737. return m_XML_TOK_INVALID
  22738. _21:
  22739. ;
  22740. _20:
  22741. ;
  22742. tok = int32(m_XML_TOK_NAME)
  22743. ptr += uintptr(2)
  22744. goto _28
  22745. _25:
  22746. ;
  22747. _24:
  22748. ;
  22749. _23:
  22750. ;
  22751. _22:
  22752. ;
  22753. tok = int32(m_XML_TOK_NMTOKEN)
  22754. ptr += uintptr(2)
  22755. goto _28
  22756. _26:
  22757. ;
  22758. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&int32(0x1F))) != 0 {
  22759. ptr += uintptr(2)
  22760. tok = int32(m_XML_TOK_NAME)
  22761. goto _28
  22762. }
  22763. if _namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&int32(0x1F))) != 0 {
  22764. ptr += uintptr(2)
  22765. tok = int32(m_XML_TOK_NMTOKEN)
  22766. goto _28
  22767. }
  22768. /* fall through */
  22769. _27:
  22770. ;
  22771. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22772. return m_XML_TOK_INVALID
  22773. _28:
  22774. ;
  22775. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22776. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22777. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22778. } else {
  22779. v35 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22780. }
  22781. switch v35 {
  22782. case int32(_BT_NONASCII):
  22783. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  22784. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22785. return m_XML_TOK_INVALID
  22786. } /* fall through */
  22787. fallthrough
  22788. case int32(_BT_NMSTRT):
  22789. fallthrough
  22790. case int32(_BT_HEX):
  22791. fallthrough
  22792. case int32(_BT_DIGIT):
  22793. fallthrough
  22794. case int32(_BT_NAME):
  22795. fallthrough
  22796. case int32(_BT_MINUS):
  22797. ptr += uintptr(2)
  22798. case int32(_BT_LEAD2):
  22799. if int64(end)-int64(ptr) < int64(2) {
  22800. return -int32(2)
  22801. }
  22802. if !(libc.Int32FromInt32(0) != 0) {
  22803. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22804. return m_XML_TOK_INVALID
  22805. }
  22806. ptr += uintptr(2)
  22807. case int32(_BT_LEAD3):
  22808. if int64(end)-int64(ptr) < int64(3) {
  22809. return -int32(2)
  22810. }
  22811. if !(libc.Int32FromInt32(0) != 0) {
  22812. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22813. return m_XML_TOK_INVALID
  22814. }
  22815. ptr += uintptr(3)
  22816. case int32(_BT_LEAD4):
  22817. if int64(end)-int64(ptr) < int64(4) {
  22818. return -int32(2)
  22819. }
  22820. if !(libc.Int32FromInt32(0) != 0) {
  22821. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22822. return m_XML_TOK_INVALID
  22823. }
  22824. ptr += uintptr(4)
  22825. case int32(_BT_GT):
  22826. fallthrough
  22827. case int32(_BT_RPAR):
  22828. fallthrough
  22829. case int32(_BT_COMMA):
  22830. fallthrough
  22831. case int32(_BT_VERBAR):
  22832. fallthrough
  22833. case int32(_BT_LSQB):
  22834. fallthrough
  22835. case int32(_BT_PERCNT):
  22836. fallthrough
  22837. case int32(_BT_S):
  22838. fallthrough
  22839. case int32(_BT_CR):
  22840. fallthrough
  22841. case int32(_BT_LF):
  22842. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22843. return tok
  22844. case int32(_BT_COLON):
  22845. ptr += uintptr(2)
  22846. switch tok {
  22847. case int32(m_XML_TOK_NAME):
  22848. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22849. return -int32(1)
  22850. }
  22851. tok = int32(m_XML_TOK_PREFIXED_NAME)
  22852. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22853. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22854. } else {
  22855. v36 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22856. }
  22857. switch v36 {
  22858. case int32(_BT_NONASCII):
  22859. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  22860. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22861. return m_XML_TOK_INVALID
  22862. } /* fall through */
  22863. fallthrough
  22864. case int32(_BT_NMSTRT):
  22865. fallthrough
  22866. case int32(_BT_HEX):
  22867. fallthrough
  22868. case int32(_BT_DIGIT):
  22869. fallthrough
  22870. case int32(_BT_NAME):
  22871. fallthrough
  22872. case int32(_BT_MINUS):
  22873. ptr += uintptr(2)
  22874. case int32(_BT_LEAD2):
  22875. if int64(end)-int64(ptr) < int64(2) {
  22876. return -int32(2)
  22877. }
  22878. if !(libc.Int32FromInt32(0) != 0) {
  22879. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22880. return m_XML_TOK_INVALID
  22881. }
  22882. ptr += uintptr(2)
  22883. case int32(_BT_LEAD3):
  22884. if int64(end)-int64(ptr) < int64(3) {
  22885. return -int32(2)
  22886. }
  22887. if !(libc.Int32FromInt32(0) != 0) {
  22888. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22889. return m_XML_TOK_INVALID
  22890. }
  22891. ptr += uintptr(3)
  22892. case int32(_BT_LEAD4):
  22893. if int64(end)-int64(ptr) < int64(4) {
  22894. return -int32(2)
  22895. }
  22896. if !(libc.Int32FromInt32(0) != 0) {
  22897. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22898. return m_XML_TOK_INVALID
  22899. }
  22900. ptr += uintptr(4)
  22901. default:
  22902. tok = int32(m_XML_TOK_NMTOKEN)
  22903. break
  22904. }
  22905. case int32(m_XML_TOK_PREFIXED_NAME):
  22906. tok = int32(m_XML_TOK_NMTOKEN)
  22907. break
  22908. }
  22909. case int32(_BT_PLUS):
  22910. if tok == int32(m_XML_TOK_NMTOKEN) {
  22911. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22912. return m_XML_TOK_INVALID
  22913. }
  22914. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22915. return int32(m_XML_TOK_NAME_PLUS)
  22916. case int32(_BT_AST):
  22917. if tok == int32(m_XML_TOK_NMTOKEN) {
  22918. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22919. return m_XML_TOK_INVALID
  22920. }
  22921. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22922. return int32(m_XML_TOK_NAME_ASTERISK)
  22923. case int32(_BT_QUEST):
  22924. if tok == int32(m_XML_TOK_NMTOKEN) {
  22925. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22926. return m_XML_TOK_INVALID
  22927. }
  22928. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22929. return int32(m_XML_TOK_NAME_QUESTION)
  22930. default:
  22931. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22932. return m_XML_TOK_INVALID
  22933. }
  22934. }
  22935. return -tok
  22936. }
  22937. func _big2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  22938. var start uintptr
  22939. var v1, v2 int32
  22940. _, _, _ = start, v1, v2
  22941. if ptr >= end {
  22942. return -int32(4)
  22943. } else {
  22944. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22945. /* This line cannot be executed. The incoming data has already
  22946. * been tokenized once, so incomplete characters like this have
  22947. * already been eliminated from the input. Retaining the paranoia
  22948. * check is still valuable, however.
  22949. */
  22950. return -int32(1) /* LCOV_EXCL_LINE */
  22951. }
  22952. }
  22953. start = ptr
  22954. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22955. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22956. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22957. } else {
  22958. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22959. }
  22960. switch v1 {
  22961. case int32(_BT_LEAD2):
  22962. ptr += uintptr(2)
  22963. case int32(_BT_LEAD3):
  22964. ptr += uintptr(3)
  22965. case int32(_BT_LEAD4):
  22966. ptr += uintptr(4)
  22967. case int32(_BT_AMP):
  22968. if ptr == start {
  22969. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22970. }
  22971. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22972. return int32(m_XML_TOK_DATA_CHARS)
  22973. case int32(_BT_LT):
  22974. /* this is for inside entity references */
  22975. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22976. return m_XML_TOK_INVALID
  22977. case int32(_BT_LF):
  22978. if ptr == start {
  22979. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22980. return int32(m_XML_TOK_DATA_NEWLINE)
  22981. }
  22982. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22983. return int32(m_XML_TOK_DATA_CHARS)
  22984. case int32(_BT_CR):
  22985. if ptr == start {
  22986. ptr += uintptr(2)
  22987. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22988. return -int32(3)
  22989. }
  22990. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22991. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22992. } else {
  22993. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22994. }
  22995. if v2 == int32(_BT_LF) {
  22996. ptr += uintptr(2)
  22997. }
  22998. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22999. return int32(m_XML_TOK_DATA_NEWLINE)
  23000. }
  23001. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23002. return int32(m_XML_TOK_DATA_CHARS)
  23003. case int32(_BT_S):
  23004. if ptr == start {
  23005. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23006. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  23007. }
  23008. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23009. return int32(m_XML_TOK_DATA_CHARS)
  23010. default:
  23011. ptr += uintptr(2)
  23012. break
  23013. }
  23014. }
  23015. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23016. return int32(m_XML_TOK_DATA_CHARS)
  23017. }
  23018. func _big2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23019. var start uintptr
  23020. var tok, v1, v2, v3 int32
  23021. _, _, _, _, _ = start, tok, v1, v2, v3
  23022. if ptr >= end {
  23023. return -int32(4)
  23024. } else {
  23025. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23026. /* This line cannot be executed. The incoming data has already
  23027. * been tokenized once, so incomplete characters like this have
  23028. * already been eliminated from the input. Retaining the paranoia
  23029. * check is still valuable, however.
  23030. */
  23031. return -int32(1) /* LCOV_EXCL_LINE */
  23032. }
  23033. }
  23034. start = ptr
  23035. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23036. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23037. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23038. } else {
  23039. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23040. }
  23041. switch v1 {
  23042. case int32(_BT_LEAD2):
  23043. ptr += uintptr(2)
  23044. case int32(_BT_LEAD3):
  23045. ptr += uintptr(3)
  23046. case int32(_BT_LEAD4):
  23047. ptr += uintptr(4)
  23048. case int32(_BT_AMP):
  23049. if ptr == start {
  23050. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23051. }
  23052. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23053. return int32(m_XML_TOK_DATA_CHARS)
  23054. case int32(_BT_PERCNT):
  23055. if ptr == start {
  23056. tok = _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23057. if tok == int32(m_XML_TOK_PERCENT) {
  23058. v2 = m_XML_TOK_INVALID
  23059. } else {
  23060. v2 = tok
  23061. }
  23062. return v2
  23063. }
  23064. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23065. return int32(m_XML_TOK_DATA_CHARS)
  23066. case int32(_BT_LF):
  23067. if ptr == start {
  23068. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23069. return int32(m_XML_TOK_DATA_NEWLINE)
  23070. }
  23071. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23072. return int32(m_XML_TOK_DATA_CHARS)
  23073. case int32(_BT_CR):
  23074. if ptr == start {
  23075. ptr += uintptr(2)
  23076. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23077. return -int32(3)
  23078. }
  23079. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23080. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23081. } else {
  23082. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23083. }
  23084. if v3 == int32(_BT_LF) {
  23085. ptr += uintptr(2)
  23086. }
  23087. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23088. return int32(m_XML_TOK_DATA_NEWLINE)
  23089. }
  23090. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23091. return int32(m_XML_TOK_DATA_CHARS)
  23092. default:
  23093. ptr += uintptr(2)
  23094. break
  23095. }
  23096. }
  23097. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23098. return int32(m_XML_TOK_DATA_CHARS)
  23099. }
  23100. func _big2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23101. var level, v1 int32
  23102. var n Tsize_t
  23103. _, _, _ = level, n, v1
  23104. level = 0
  23105. if int32(2) > int32(1) {
  23106. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  23107. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  23108. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  23109. end = ptr + uintptr(n)
  23110. }
  23111. }
  23112. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23113. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23114. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23115. } else {
  23116. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23117. }
  23118. switch v1 {
  23119. case int32(_BT_LEAD2):
  23120. if int64(end)-int64(ptr) < int64(2) {
  23121. return -int32(2)
  23122. }
  23123. if 0 != 0 {
  23124. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23125. return m_XML_TOK_INVALID
  23126. }
  23127. ptr += uintptr(2)
  23128. case int32(_BT_LEAD3):
  23129. if int64(end)-int64(ptr) < int64(3) {
  23130. return -int32(2)
  23131. }
  23132. if 0 != 0 {
  23133. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23134. return m_XML_TOK_INVALID
  23135. }
  23136. ptr += uintptr(3)
  23137. case int32(_BT_LEAD4):
  23138. if int64(end)-int64(ptr) < int64(4) {
  23139. return -int32(2)
  23140. }
  23141. if 0 != 0 {
  23142. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23143. return m_XML_TOK_INVALID
  23144. }
  23145. ptr += uintptr(4)
  23146. case int32(_BT_NONXML):
  23147. fallthrough
  23148. case int32(_BT_MALFORM):
  23149. fallthrough
  23150. case int32(_BT_TRAIL):
  23151. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23152. return m_XML_TOK_INVALID
  23153. case int32(_BT_LT):
  23154. ptr += uintptr(2)
  23155. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23156. return -int32(1)
  23157. }
  23158. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_EXCL) {
  23159. ptr += uintptr(2)
  23160. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23161. return -int32(1)
  23162. }
  23163. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_LSQB1) {
  23164. level++
  23165. ptr += uintptr(2)
  23166. }
  23167. }
  23168. case int32(_BT_RSQB):
  23169. ptr += uintptr(2)
  23170. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23171. return -int32(1)
  23172. }
  23173. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  23174. ptr += uintptr(2)
  23175. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23176. return -int32(1)
  23177. }
  23178. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  23179. ptr += uintptr(2)
  23180. if level == 0 {
  23181. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23182. return int32(m_XML_TOK_IGNORE_SECT)
  23183. }
  23184. level--
  23185. }
  23186. }
  23187. default:
  23188. ptr += uintptr(2)
  23189. break
  23190. }
  23191. }
  23192. return -int32(1)
  23193. }
  23194. func _big2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  23195. var v2, v3, v4 int32
  23196. _, _, _ = v2, v3, v4
  23197. ptr += uintptr(2)
  23198. end -= uintptr(2)
  23199. for {
  23200. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23201. break
  23202. }
  23203. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23204. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23205. } else {
  23206. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23207. }
  23208. switch v2 {
  23209. case int32(_BT_DIGIT):
  23210. fallthrough
  23211. case int32(_BT_HEX):
  23212. fallthrough
  23213. case int32(_BT_MINUS):
  23214. fallthrough
  23215. case int32(_BT_APOS):
  23216. fallthrough
  23217. case int32(_BT_LPAR):
  23218. fallthrough
  23219. case int32(_BT_RPAR):
  23220. fallthrough
  23221. case int32(_BT_PLUS):
  23222. fallthrough
  23223. case int32(_BT_COMMA):
  23224. fallthrough
  23225. case int32(_BT_SOL):
  23226. fallthrough
  23227. case int32(_BT_EQUALS):
  23228. fallthrough
  23229. case int32(_BT_QUEST):
  23230. fallthrough
  23231. case int32(_BT_CR):
  23232. fallthrough
  23233. case int32(_BT_LF):
  23234. fallthrough
  23235. case int32(_BT_SEMI):
  23236. fallthrough
  23237. case int32(_BT_EXCL):
  23238. fallthrough
  23239. case int32(_BT_AST):
  23240. fallthrough
  23241. case int32(_BT_PERCNT):
  23242. fallthrough
  23243. case int32(_BT_NUM):
  23244. fallthrough
  23245. case int32(_BT_COLON):
  23246. case int32(_BT_S):
  23247. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_TAB1) {
  23248. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  23249. return 0
  23250. }
  23251. case int32(_BT_NAME):
  23252. fallthrough
  23253. case int32(_BT_NMSTRT):
  23254. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23255. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23256. } else {
  23257. v3 = -int32(1)
  23258. }
  23259. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  23260. break
  23261. }
  23262. /* fall through */
  23263. fallthrough
  23264. default:
  23265. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23266. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23267. } else {
  23268. v4 = -int32(1)
  23269. }
  23270. switch v4 {
  23271. case int32(0x24): /* $ */
  23272. fallthrough
  23273. case int32(0x40): /* @ */
  23274. default:
  23275. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  23276. return 0
  23277. }
  23278. break
  23279. }
  23280. goto _1
  23281. _1:
  23282. ;
  23283. ptr += uintptr(2)
  23284. }
  23285. return int32(1)
  23286. }
  23287. /* This must only be called for a well-formed start-tag or empty
  23288. element tag. Returns the number of attributes. Pointers to the
  23289. first attsMax attributes are stored in atts.
  23290. */
  23291. func _big2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  23292. var nAtts, open, state, v2, v3, v5, v7 int32
  23293. var v4, v6, v8, v9 bool
  23294. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  23295. state = 1
  23296. nAtts = 0
  23297. open = 0 /* defined when state == inValue;
  23298. initialization just to shut up compilers */
  23299. ptr += uintptr(2)
  23300. for {
  23301. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23302. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23303. } else {
  23304. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23305. }
  23306. switch v2 {
  23307. case int32(_BT_LEAD2):
  23308. if state == 0 {
  23309. if nAtts < attsMax {
  23310. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  23311. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  23312. }
  23313. state = 1
  23314. }
  23315. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  23316. case int32(_BT_LEAD3):
  23317. if state == 0 {
  23318. if nAtts < attsMax {
  23319. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  23320. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  23321. }
  23322. state = 1
  23323. }
  23324. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  23325. case int32(_BT_LEAD4):
  23326. if state == 0 {
  23327. if nAtts < attsMax {
  23328. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  23329. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  23330. }
  23331. state = 1
  23332. }
  23333. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  23334. case int32(_BT_NONASCII):
  23335. fallthrough
  23336. case int32(_BT_NMSTRT):
  23337. fallthrough
  23338. case int32(_BT_HEX):
  23339. if state == 0 {
  23340. if nAtts < attsMax {
  23341. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  23342. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  23343. }
  23344. state = 1
  23345. }
  23346. case int32(_BT_QUOT):
  23347. if state != 2 {
  23348. if nAtts < attsMax {
  23349. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  23350. }
  23351. state = 2
  23352. open = int32(_BT_QUOT)
  23353. } else {
  23354. if open == int32(_BT_QUOT) {
  23355. state = 0
  23356. if nAtts < attsMax {
  23357. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  23358. }
  23359. nAtts++
  23360. }
  23361. }
  23362. case int32(_BT_APOS):
  23363. if state != 2 {
  23364. if nAtts < attsMax {
  23365. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  23366. }
  23367. state = 2
  23368. open = int32(_BT_APOS)
  23369. } else {
  23370. if open == int32(_BT_APOS) {
  23371. state = 0
  23372. if nAtts < attsMax {
  23373. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  23374. }
  23375. nAtts++
  23376. }
  23377. }
  23378. case int32(_BT_AMP):
  23379. if nAtts < attsMax {
  23380. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  23381. }
  23382. case int32(_BT_S):
  23383. if state == 1 {
  23384. state = 0
  23385. } else {
  23386. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0; v9 {
  23387. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr; !v4 {
  23388. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23389. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23390. } else {
  23391. v3 = -int32(1)
  23392. }
  23393. }
  23394. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  23395. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  23396. v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  23397. } else {
  23398. v5 = -int32(1)
  23399. }
  23400. }
  23401. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  23402. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  23403. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))))))
  23404. } else {
  23405. v7 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  23406. }
  23407. }
  23408. }
  23409. if v9 && (v8 || v7 == open) {
  23410. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  23411. }
  23412. }
  23413. case int32(_BT_CR):
  23414. fallthrough
  23415. case int32(_BT_LF):
  23416. /* This case ensures that the first attribute name is counted
  23417. Apart from that we could just change state on the quote. */
  23418. if state == 1 {
  23419. state = 0
  23420. } else {
  23421. if state == 2 && nAtts < attsMax {
  23422. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  23423. }
  23424. }
  23425. case int32(_BT_GT):
  23426. fallthrough
  23427. case int32(_BT_SOL):
  23428. if state != 2 {
  23429. return nAtts
  23430. }
  23431. default:
  23432. break
  23433. }
  23434. goto _1
  23435. _1:
  23436. ;
  23437. ptr += uintptr(2)
  23438. }
  23439. /* not reached */
  23440. return r
  23441. }
  23442. func _big2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  23443. var c, c1, result, v2, v4 int32
  23444. _, _, _, _, _ = c, c1, result, v2, v4
  23445. result = 0
  23446. /* skip &# */
  23447. _ = enc
  23448. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  23449. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x) {
  23450. ptr += uintptr(2)
  23451. for {
  23452. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  23453. break
  23454. }
  23455. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23456. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23457. } else {
  23458. v2 = -int32(1)
  23459. }
  23460. c = v2
  23461. switch c {
  23462. case int32(m_ASCII_0):
  23463. fallthrough
  23464. case int32(m_ASCII_1):
  23465. fallthrough
  23466. case int32(m_ASCII_2):
  23467. fallthrough
  23468. case int32(m_ASCII_3):
  23469. fallthrough
  23470. case int32(m_ASCII_41):
  23471. fallthrough
  23472. case int32(m_ASCII_51):
  23473. fallthrough
  23474. case int32(m_ASCII_61):
  23475. fallthrough
  23476. case int32(m_ASCII_71):
  23477. fallthrough
  23478. case int32(m_ASCII_8):
  23479. fallthrough
  23480. case int32(m_ASCII_9):
  23481. result <<= int32(4)
  23482. result |= c - int32(m_ASCII_0)
  23483. case int32(m_ASCII_A):
  23484. fallthrough
  23485. case int32(m_ASCII_B1):
  23486. fallthrough
  23487. case int32(m_ASCII_C):
  23488. fallthrough
  23489. case int32(m_ASCII_D):
  23490. fallthrough
  23491. case int32(m_ASCII_E):
  23492. fallthrough
  23493. case int32(m_ASCII_F):
  23494. result <<= int32(4)
  23495. result += int32(10) + (c - int32(m_ASCII_A))
  23496. case int32(m_ASCII_a):
  23497. fallthrough
  23498. case int32(m_ASCII_b1):
  23499. fallthrough
  23500. case int32(m_ASCII_c):
  23501. fallthrough
  23502. case int32(m_ASCII_d1):
  23503. fallthrough
  23504. case int32(m_ASCII_e):
  23505. fallthrough
  23506. case int32(m_ASCII_f1):
  23507. result <<= int32(4)
  23508. result += int32(10) + (c - int32(m_ASCII_a))
  23509. break
  23510. }
  23511. if result >= int32(0x110000) {
  23512. return -int32(1)
  23513. }
  23514. goto _1
  23515. _1:
  23516. ;
  23517. ptr += uintptr(2)
  23518. }
  23519. } else {
  23520. for {
  23521. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  23522. break
  23523. }
  23524. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23525. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23526. } else {
  23527. v4 = -int32(1)
  23528. }
  23529. c1 = v4
  23530. result *= int32(10)
  23531. result += c1 - int32(m_ASCII_0)
  23532. if result >= int32(0x110000) {
  23533. return -int32(1)
  23534. }
  23535. goto _3
  23536. _3:
  23537. ;
  23538. ptr += uintptr(2)
  23539. }
  23540. }
  23541. return _checkCharRefNumber(tls, result)
  23542. }
  23543. func _big2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  23544. var v1, v2 int32
  23545. _, _ = v1, v2
  23546. _ = enc
  23547. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(2) {
  23548. case int64(2):
  23549. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_t) {
  23550. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23551. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23552. } else {
  23553. v1 = -int32(1)
  23554. }
  23555. switch v1 {
  23556. case int32(m_ASCII_l):
  23557. return int32(m_ASCII_LT1)
  23558. case int32(m_ASCII_g):
  23559. return int32(m_ASCII_GT1)
  23560. }
  23561. }
  23562. case int64(3):
  23563. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_a) {
  23564. ptr += uintptr(2)
  23565. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_m) {
  23566. ptr += uintptr(2)
  23567. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p) {
  23568. return int32(m_ASCII_AMP1)
  23569. }
  23570. }
  23571. }
  23572. case int64(4):
  23573. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23574. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23575. } else {
  23576. v2 = -int32(1)
  23577. }
  23578. switch v2 {
  23579. case int32(m_ASCII_q1):
  23580. ptr += uintptr(2)
  23581. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_u1) {
  23582. ptr += uintptr(2)
  23583. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o) {
  23584. ptr += uintptr(2)
  23585. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_t) {
  23586. return int32(m_ASCII_QUOT1)
  23587. }
  23588. }
  23589. }
  23590. case int32(m_ASCII_a):
  23591. ptr += uintptr(2)
  23592. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p) {
  23593. ptr += uintptr(2)
  23594. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o) {
  23595. ptr += uintptr(2)
  23596. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_s) {
  23597. return int32(m_ASCII_APOS1)
  23598. }
  23599. }
  23600. }
  23601. break
  23602. }
  23603. }
  23604. return 0
  23605. }
  23606. func _big2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  23607. _ = enc
  23608. for {
  23609. if !(*(*uint8)(unsafe.Pointer(ptr2)) != 0) {
  23610. break
  23611. }
  23612. if int64(end1)-int64(ptr1) < int64(2) {
  23613. /* This line cannot be executed. The incoming data has already
  23614. * been tokenized once, so incomplete characters like this have
  23615. * already been eliminated from the input. Retaining the
  23616. * paranoia check is still valuable, however.
  23617. */
  23618. return 0 /* LCOV_EXCL_LINE */
  23619. }
  23620. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1 + 1))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr2)))) {
  23621. return 0
  23622. }
  23623. goto _1
  23624. _1:
  23625. ;
  23626. ptr1 += uintptr(2)
  23627. ptr2++
  23628. }
  23629. return libc.BoolInt32(ptr1 == end1)
  23630. }
  23631. func _big2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  23632. var start uintptr
  23633. var v2 int32
  23634. _, _ = start, v2
  23635. start = ptr
  23636. for {
  23637. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23638. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23639. } else {
  23640. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23641. }
  23642. switch v2 {
  23643. case int32(_BT_LEAD2):
  23644. ptr += uintptr(2)
  23645. case int32(_BT_LEAD3):
  23646. ptr += uintptr(3)
  23647. case int32(_BT_LEAD4):
  23648. ptr += uintptr(4)
  23649. case int32(_BT_NONASCII):
  23650. fallthrough
  23651. case int32(_BT_NMSTRT):
  23652. fallthrough
  23653. case int32(_BT_COLON):
  23654. fallthrough
  23655. case int32(_BT_HEX):
  23656. fallthrough
  23657. case int32(_BT_DIGIT):
  23658. fallthrough
  23659. case int32(_BT_NAME):
  23660. fallthrough
  23661. case int32(_BT_MINUS):
  23662. ptr += uintptr(2)
  23663. default:
  23664. return int32(int64(ptr) - int64(start))
  23665. }
  23666. goto _1
  23667. _1:
  23668. }
  23669. return r
  23670. }
  23671. func _big2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  23672. var v2 int32
  23673. _ = v2
  23674. for {
  23675. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23676. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23677. } else {
  23678. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23679. }
  23680. switch v2 {
  23681. case int32(_BT_LF):
  23682. fallthrough
  23683. case int32(_BT_CR):
  23684. fallthrough
  23685. case int32(_BT_S):
  23686. ptr += uintptr(2)
  23687. default:
  23688. return ptr
  23689. }
  23690. goto _1
  23691. _1:
  23692. }
  23693. return r
  23694. }
  23695. func _big2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  23696. var v1, v2 int32
  23697. var v3 bool
  23698. _, _, _ = v1, v2, v3
  23699. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23700. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23701. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23702. } else {
  23703. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23704. }
  23705. switch v1 {
  23706. case int32(_BT_LEAD2):
  23707. ptr += uintptr(2)
  23708. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  23709. case int32(_BT_LEAD3):
  23710. ptr += uintptr(3)
  23711. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  23712. case int32(_BT_LEAD4):
  23713. ptr += uintptr(4)
  23714. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  23715. case int32(_BT_LF):
  23716. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  23717. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  23718. ptr += uintptr(2)
  23719. case int32(_BT_CR):
  23720. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  23721. ptr += uintptr(2)
  23722. if v3 = int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)); v3 {
  23723. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23724. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23725. } else {
  23726. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23727. }
  23728. }
  23729. if v3 && v2 == int32(_BT_LF) {
  23730. ptr += uintptr(2)
  23731. }
  23732. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  23733. default:
  23734. ptr += uintptr(2)
  23735. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  23736. break
  23737. }
  23738. }
  23739. }
  23740. var _big2_encoding_ns = Tnormal_encoding{
  23741. Fenc: TENCODING{
  23742. Fscanners: [4]TSCANNER{},
  23743. FliteralScanners: [2]TSCANNER{},
  23744. FminBytesPerChar: int32(2),
  23745. FisUtf16: uint8(1),
  23746. },
  23747. Ftype1: [256]uint8{
  23748. 9: uint8(_BT_S),
  23749. 10: uint8(_BT_LF),
  23750. 13: uint8(_BT_CR),
  23751. 32: uint8(_BT_S),
  23752. 33: uint8(_BT_EXCL),
  23753. 34: uint8(_BT_QUOT),
  23754. 35: uint8(_BT_NUM),
  23755. 36: uint8(_BT_OTHER),
  23756. 37: uint8(_BT_PERCNT),
  23757. 38: uint8(_BT_AMP),
  23758. 39: uint8(_BT_APOS),
  23759. 40: uint8(_BT_LPAR),
  23760. 41: uint8(_BT_RPAR),
  23761. 42: uint8(_BT_AST),
  23762. 43: uint8(_BT_PLUS),
  23763. 44: uint8(_BT_COMMA),
  23764. 45: uint8(_BT_MINUS),
  23765. 46: uint8(_BT_NAME),
  23766. 47: uint8(_BT_SOL),
  23767. 48: uint8(_BT_DIGIT),
  23768. 49: uint8(_BT_DIGIT),
  23769. 50: uint8(_BT_DIGIT),
  23770. 51: uint8(_BT_DIGIT),
  23771. 52: uint8(_BT_DIGIT),
  23772. 53: uint8(_BT_DIGIT),
  23773. 54: uint8(_BT_DIGIT),
  23774. 55: uint8(_BT_DIGIT),
  23775. 56: uint8(_BT_DIGIT),
  23776. 57: uint8(_BT_DIGIT),
  23777. 58: uint8(_BT_COLON),
  23778. 59: uint8(_BT_SEMI),
  23779. 60: uint8(_BT_LT),
  23780. 61: uint8(_BT_EQUALS),
  23781. 62: uint8(_BT_GT),
  23782. 63: uint8(_BT_QUEST),
  23783. 64: uint8(_BT_OTHER),
  23784. 65: uint8(_BT_HEX),
  23785. 66: uint8(_BT_HEX),
  23786. 67: uint8(_BT_HEX),
  23787. 68: uint8(_BT_HEX),
  23788. 69: uint8(_BT_HEX),
  23789. 70: uint8(_BT_HEX),
  23790. 71: uint8(_BT_NMSTRT),
  23791. 72: uint8(_BT_NMSTRT),
  23792. 73: uint8(_BT_NMSTRT),
  23793. 74: uint8(_BT_NMSTRT),
  23794. 75: uint8(_BT_NMSTRT),
  23795. 76: uint8(_BT_NMSTRT),
  23796. 77: uint8(_BT_NMSTRT),
  23797. 78: uint8(_BT_NMSTRT),
  23798. 79: uint8(_BT_NMSTRT),
  23799. 80: uint8(_BT_NMSTRT),
  23800. 81: uint8(_BT_NMSTRT),
  23801. 82: uint8(_BT_NMSTRT),
  23802. 83: uint8(_BT_NMSTRT),
  23803. 84: uint8(_BT_NMSTRT),
  23804. 85: uint8(_BT_NMSTRT),
  23805. 86: uint8(_BT_NMSTRT),
  23806. 87: uint8(_BT_NMSTRT),
  23807. 88: uint8(_BT_NMSTRT),
  23808. 89: uint8(_BT_NMSTRT),
  23809. 90: uint8(_BT_NMSTRT),
  23810. 91: uint8(_BT_LSQB),
  23811. 92: uint8(_BT_OTHER),
  23812. 93: uint8(_BT_RSQB),
  23813. 94: uint8(_BT_OTHER),
  23814. 95: uint8(_BT_NMSTRT),
  23815. 96: uint8(_BT_OTHER),
  23816. 97: uint8(_BT_HEX),
  23817. 98: uint8(_BT_HEX),
  23818. 99: uint8(_BT_HEX),
  23819. 100: uint8(_BT_HEX),
  23820. 101: uint8(_BT_HEX),
  23821. 102: uint8(_BT_HEX),
  23822. 103: uint8(_BT_NMSTRT),
  23823. 104: uint8(_BT_NMSTRT),
  23824. 105: uint8(_BT_NMSTRT),
  23825. 106: uint8(_BT_NMSTRT),
  23826. 107: uint8(_BT_NMSTRT),
  23827. 108: uint8(_BT_NMSTRT),
  23828. 109: uint8(_BT_NMSTRT),
  23829. 110: uint8(_BT_NMSTRT),
  23830. 111: uint8(_BT_NMSTRT),
  23831. 112: uint8(_BT_NMSTRT),
  23832. 113: uint8(_BT_NMSTRT),
  23833. 114: uint8(_BT_NMSTRT),
  23834. 115: uint8(_BT_NMSTRT),
  23835. 116: uint8(_BT_NMSTRT),
  23836. 117: uint8(_BT_NMSTRT),
  23837. 118: uint8(_BT_NMSTRT),
  23838. 119: uint8(_BT_NMSTRT),
  23839. 120: uint8(_BT_NMSTRT),
  23840. 121: uint8(_BT_NMSTRT),
  23841. 122: uint8(_BT_NMSTRT),
  23842. 123: uint8(_BT_OTHER),
  23843. 124: uint8(_BT_VERBAR),
  23844. 125: uint8(_BT_OTHER),
  23845. 126: uint8(_BT_OTHER),
  23846. 127: uint8(_BT_OTHER),
  23847. 128: uint8(_BT_OTHER),
  23848. 129: uint8(_BT_OTHER),
  23849. 130: uint8(_BT_OTHER),
  23850. 131: uint8(_BT_OTHER),
  23851. 132: uint8(_BT_OTHER),
  23852. 133: uint8(_BT_OTHER),
  23853. 134: uint8(_BT_OTHER),
  23854. 135: uint8(_BT_OTHER),
  23855. 136: uint8(_BT_OTHER),
  23856. 137: uint8(_BT_OTHER),
  23857. 138: uint8(_BT_OTHER),
  23858. 139: uint8(_BT_OTHER),
  23859. 140: uint8(_BT_OTHER),
  23860. 141: uint8(_BT_OTHER),
  23861. 142: uint8(_BT_OTHER),
  23862. 143: uint8(_BT_OTHER),
  23863. 144: uint8(_BT_OTHER),
  23864. 145: uint8(_BT_OTHER),
  23865. 146: uint8(_BT_OTHER),
  23866. 147: uint8(_BT_OTHER),
  23867. 148: uint8(_BT_OTHER),
  23868. 149: uint8(_BT_OTHER),
  23869. 150: uint8(_BT_OTHER),
  23870. 151: uint8(_BT_OTHER),
  23871. 152: uint8(_BT_OTHER),
  23872. 153: uint8(_BT_OTHER),
  23873. 154: uint8(_BT_OTHER),
  23874. 155: uint8(_BT_OTHER),
  23875. 156: uint8(_BT_OTHER),
  23876. 157: uint8(_BT_OTHER),
  23877. 158: uint8(_BT_OTHER),
  23878. 159: uint8(_BT_OTHER),
  23879. 160: uint8(_BT_OTHER),
  23880. 161: uint8(_BT_OTHER),
  23881. 162: uint8(_BT_OTHER),
  23882. 163: uint8(_BT_OTHER),
  23883. 164: uint8(_BT_OTHER),
  23884. 165: uint8(_BT_OTHER),
  23885. 166: uint8(_BT_OTHER),
  23886. 167: uint8(_BT_OTHER),
  23887. 168: uint8(_BT_OTHER),
  23888. 169: uint8(_BT_OTHER),
  23889. 170: uint8(_BT_NMSTRT),
  23890. 171: uint8(_BT_OTHER),
  23891. 172: uint8(_BT_OTHER),
  23892. 173: uint8(_BT_OTHER),
  23893. 174: uint8(_BT_OTHER),
  23894. 175: uint8(_BT_OTHER),
  23895. 176: uint8(_BT_OTHER),
  23896. 177: uint8(_BT_OTHER),
  23897. 178: uint8(_BT_OTHER),
  23898. 179: uint8(_BT_OTHER),
  23899. 180: uint8(_BT_OTHER),
  23900. 181: uint8(_BT_NMSTRT),
  23901. 182: uint8(_BT_OTHER),
  23902. 183: uint8(_BT_NAME),
  23903. 184: uint8(_BT_OTHER),
  23904. 185: uint8(_BT_OTHER),
  23905. 186: uint8(_BT_NMSTRT),
  23906. 187: uint8(_BT_OTHER),
  23907. 188: uint8(_BT_OTHER),
  23908. 189: uint8(_BT_OTHER),
  23909. 190: uint8(_BT_OTHER),
  23910. 191: uint8(_BT_OTHER),
  23911. 192: uint8(_BT_NMSTRT),
  23912. 193: uint8(_BT_NMSTRT),
  23913. 194: uint8(_BT_NMSTRT),
  23914. 195: uint8(_BT_NMSTRT),
  23915. 196: uint8(_BT_NMSTRT),
  23916. 197: uint8(_BT_NMSTRT),
  23917. 198: uint8(_BT_NMSTRT),
  23918. 199: uint8(_BT_NMSTRT),
  23919. 200: uint8(_BT_NMSTRT),
  23920. 201: uint8(_BT_NMSTRT),
  23921. 202: uint8(_BT_NMSTRT),
  23922. 203: uint8(_BT_NMSTRT),
  23923. 204: uint8(_BT_NMSTRT),
  23924. 205: uint8(_BT_NMSTRT),
  23925. 206: uint8(_BT_NMSTRT),
  23926. 207: uint8(_BT_NMSTRT),
  23927. 208: uint8(_BT_NMSTRT),
  23928. 209: uint8(_BT_NMSTRT),
  23929. 210: uint8(_BT_NMSTRT),
  23930. 211: uint8(_BT_NMSTRT),
  23931. 212: uint8(_BT_NMSTRT),
  23932. 213: uint8(_BT_NMSTRT),
  23933. 214: uint8(_BT_NMSTRT),
  23934. 215: uint8(_BT_OTHER),
  23935. 216: uint8(_BT_NMSTRT),
  23936. 217: uint8(_BT_NMSTRT),
  23937. 218: uint8(_BT_NMSTRT),
  23938. 219: uint8(_BT_NMSTRT),
  23939. 220: uint8(_BT_NMSTRT),
  23940. 221: uint8(_BT_NMSTRT),
  23941. 222: uint8(_BT_NMSTRT),
  23942. 223: uint8(_BT_NMSTRT),
  23943. 224: uint8(_BT_NMSTRT),
  23944. 225: uint8(_BT_NMSTRT),
  23945. 226: uint8(_BT_NMSTRT),
  23946. 227: uint8(_BT_NMSTRT),
  23947. 228: uint8(_BT_NMSTRT),
  23948. 229: uint8(_BT_NMSTRT),
  23949. 230: uint8(_BT_NMSTRT),
  23950. 231: uint8(_BT_NMSTRT),
  23951. 232: uint8(_BT_NMSTRT),
  23952. 233: uint8(_BT_NMSTRT),
  23953. 234: uint8(_BT_NMSTRT),
  23954. 235: uint8(_BT_NMSTRT),
  23955. 236: uint8(_BT_NMSTRT),
  23956. 237: uint8(_BT_NMSTRT),
  23957. 238: uint8(_BT_NMSTRT),
  23958. 239: uint8(_BT_NMSTRT),
  23959. 240: uint8(_BT_NMSTRT),
  23960. 241: uint8(_BT_NMSTRT),
  23961. 242: uint8(_BT_NMSTRT),
  23962. 243: uint8(_BT_NMSTRT),
  23963. 244: uint8(_BT_NMSTRT),
  23964. 245: uint8(_BT_NMSTRT),
  23965. 246: uint8(_BT_NMSTRT),
  23966. 247: uint8(_BT_OTHER),
  23967. 248: uint8(_BT_NMSTRT),
  23968. 249: uint8(_BT_NMSTRT),
  23969. 250: uint8(_BT_NMSTRT),
  23970. 251: uint8(_BT_NMSTRT),
  23971. 252: uint8(_BT_NMSTRT),
  23972. 253: uint8(_BT_NMSTRT),
  23973. 254: uint8(_BT_NMSTRT),
  23974. 255: uint8(_BT_NMSTRT),
  23975. },
  23976. }
  23977. func init() {
  23978. p := unsafe.Pointer(&_big2_encoding_ns)
  23979. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  23980. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  23981. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  23982. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  23983. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  23984. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  23985. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  23986. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  23987. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  23988. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  23989. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  23990. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  23991. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  23992. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  23993. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  23994. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  23995. }
  23996. var _big2_encoding = Tnormal_encoding{
  23997. Fenc: TENCODING{
  23998. Fscanners: [4]TSCANNER{},
  23999. FliteralScanners: [2]TSCANNER{},
  24000. FminBytesPerChar: int32(2),
  24001. FisUtf16: uint8(1),
  24002. },
  24003. Ftype1: [256]uint8{
  24004. 9: uint8(_BT_S),
  24005. 10: uint8(_BT_LF),
  24006. 13: uint8(_BT_CR),
  24007. 32: uint8(_BT_S),
  24008. 33: uint8(_BT_EXCL),
  24009. 34: uint8(_BT_QUOT),
  24010. 35: uint8(_BT_NUM),
  24011. 36: uint8(_BT_OTHER),
  24012. 37: uint8(_BT_PERCNT),
  24013. 38: uint8(_BT_AMP),
  24014. 39: uint8(_BT_APOS),
  24015. 40: uint8(_BT_LPAR),
  24016. 41: uint8(_BT_RPAR),
  24017. 42: uint8(_BT_AST),
  24018. 43: uint8(_BT_PLUS),
  24019. 44: uint8(_BT_COMMA),
  24020. 45: uint8(_BT_MINUS),
  24021. 46: uint8(_BT_NAME),
  24022. 47: uint8(_BT_SOL),
  24023. 48: uint8(_BT_DIGIT),
  24024. 49: uint8(_BT_DIGIT),
  24025. 50: uint8(_BT_DIGIT),
  24026. 51: uint8(_BT_DIGIT),
  24027. 52: uint8(_BT_DIGIT),
  24028. 53: uint8(_BT_DIGIT),
  24029. 54: uint8(_BT_DIGIT),
  24030. 55: uint8(_BT_DIGIT),
  24031. 56: uint8(_BT_DIGIT),
  24032. 57: uint8(_BT_DIGIT),
  24033. 58: uint8(_BT_NMSTRT),
  24034. 59: uint8(_BT_SEMI),
  24035. 60: uint8(_BT_LT),
  24036. 61: uint8(_BT_EQUALS),
  24037. 62: uint8(_BT_GT),
  24038. 63: uint8(_BT_QUEST),
  24039. 64: uint8(_BT_OTHER),
  24040. 65: uint8(_BT_HEX),
  24041. 66: uint8(_BT_HEX),
  24042. 67: uint8(_BT_HEX),
  24043. 68: uint8(_BT_HEX),
  24044. 69: uint8(_BT_HEX),
  24045. 70: uint8(_BT_HEX),
  24046. 71: uint8(_BT_NMSTRT),
  24047. 72: uint8(_BT_NMSTRT),
  24048. 73: uint8(_BT_NMSTRT),
  24049. 74: uint8(_BT_NMSTRT),
  24050. 75: uint8(_BT_NMSTRT),
  24051. 76: uint8(_BT_NMSTRT),
  24052. 77: uint8(_BT_NMSTRT),
  24053. 78: uint8(_BT_NMSTRT),
  24054. 79: uint8(_BT_NMSTRT),
  24055. 80: uint8(_BT_NMSTRT),
  24056. 81: uint8(_BT_NMSTRT),
  24057. 82: uint8(_BT_NMSTRT),
  24058. 83: uint8(_BT_NMSTRT),
  24059. 84: uint8(_BT_NMSTRT),
  24060. 85: uint8(_BT_NMSTRT),
  24061. 86: uint8(_BT_NMSTRT),
  24062. 87: uint8(_BT_NMSTRT),
  24063. 88: uint8(_BT_NMSTRT),
  24064. 89: uint8(_BT_NMSTRT),
  24065. 90: uint8(_BT_NMSTRT),
  24066. 91: uint8(_BT_LSQB),
  24067. 92: uint8(_BT_OTHER),
  24068. 93: uint8(_BT_RSQB),
  24069. 94: uint8(_BT_OTHER),
  24070. 95: uint8(_BT_NMSTRT),
  24071. 96: uint8(_BT_OTHER),
  24072. 97: uint8(_BT_HEX),
  24073. 98: uint8(_BT_HEX),
  24074. 99: uint8(_BT_HEX),
  24075. 100: uint8(_BT_HEX),
  24076. 101: uint8(_BT_HEX),
  24077. 102: uint8(_BT_HEX),
  24078. 103: uint8(_BT_NMSTRT),
  24079. 104: uint8(_BT_NMSTRT),
  24080. 105: uint8(_BT_NMSTRT),
  24081. 106: uint8(_BT_NMSTRT),
  24082. 107: uint8(_BT_NMSTRT),
  24083. 108: uint8(_BT_NMSTRT),
  24084. 109: uint8(_BT_NMSTRT),
  24085. 110: uint8(_BT_NMSTRT),
  24086. 111: uint8(_BT_NMSTRT),
  24087. 112: uint8(_BT_NMSTRT),
  24088. 113: uint8(_BT_NMSTRT),
  24089. 114: uint8(_BT_NMSTRT),
  24090. 115: uint8(_BT_NMSTRT),
  24091. 116: uint8(_BT_NMSTRT),
  24092. 117: uint8(_BT_NMSTRT),
  24093. 118: uint8(_BT_NMSTRT),
  24094. 119: uint8(_BT_NMSTRT),
  24095. 120: uint8(_BT_NMSTRT),
  24096. 121: uint8(_BT_NMSTRT),
  24097. 122: uint8(_BT_NMSTRT),
  24098. 123: uint8(_BT_OTHER),
  24099. 124: uint8(_BT_VERBAR),
  24100. 125: uint8(_BT_OTHER),
  24101. 126: uint8(_BT_OTHER),
  24102. 127: uint8(_BT_OTHER),
  24103. 128: uint8(_BT_OTHER),
  24104. 129: uint8(_BT_OTHER),
  24105. 130: uint8(_BT_OTHER),
  24106. 131: uint8(_BT_OTHER),
  24107. 132: uint8(_BT_OTHER),
  24108. 133: uint8(_BT_OTHER),
  24109. 134: uint8(_BT_OTHER),
  24110. 135: uint8(_BT_OTHER),
  24111. 136: uint8(_BT_OTHER),
  24112. 137: uint8(_BT_OTHER),
  24113. 138: uint8(_BT_OTHER),
  24114. 139: uint8(_BT_OTHER),
  24115. 140: uint8(_BT_OTHER),
  24116. 141: uint8(_BT_OTHER),
  24117. 142: uint8(_BT_OTHER),
  24118. 143: uint8(_BT_OTHER),
  24119. 144: uint8(_BT_OTHER),
  24120. 145: uint8(_BT_OTHER),
  24121. 146: uint8(_BT_OTHER),
  24122. 147: uint8(_BT_OTHER),
  24123. 148: uint8(_BT_OTHER),
  24124. 149: uint8(_BT_OTHER),
  24125. 150: uint8(_BT_OTHER),
  24126. 151: uint8(_BT_OTHER),
  24127. 152: uint8(_BT_OTHER),
  24128. 153: uint8(_BT_OTHER),
  24129. 154: uint8(_BT_OTHER),
  24130. 155: uint8(_BT_OTHER),
  24131. 156: uint8(_BT_OTHER),
  24132. 157: uint8(_BT_OTHER),
  24133. 158: uint8(_BT_OTHER),
  24134. 159: uint8(_BT_OTHER),
  24135. 160: uint8(_BT_OTHER),
  24136. 161: uint8(_BT_OTHER),
  24137. 162: uint8(_BT_OTHER),
  24138. 163: uint8(_BT_OTHER),
  24139. 164: uint8(_BT_OTHER),
  24140. 165: uint8(_BT_OTHER),
  24141. 166: uint8(_BT_OTHER),
  24142. 167: uint8(_BT_OTHER),
  24143. 168: uint8(_BT_OTHER),
  24144. 169: uint8(_BT_OTHER),
  24145. 170: uint8(_BT_NMSTRT),
  24146. 171: uint8(_BT_OTHER),
  24147. 172: uint8(_BT_OTHER),
  24148. 173: uint8(_BT_OTHER),
  24149. 174: uint8(_BT_OTHER),
  24150. 175: uint8(_BT_OTHER),
  24151. 176: uint8(_BT_OTHER),
  24152. 177: uint8(_BT_OTHER),
  24153. 178: uint8(_BT_OTHER),
  24154. 179: uint8(_BT_OTHER),
  24155. 180: uint8(_BT_OTHER),
  24156. 181: uint8(_BT_NMSTRT),
  24157. 182: uint8(_BT_OTHER),
  24158. 183: uint8(_BT_NAME),
  24159. 184: uint8(_BT_OTHER),
  24160. 185: uint8(_BT_OTHER),
  24161. 186: uint8(_BT_NMSTRT),
  24162. 187: uint8(_BT_OTHER),
  24163. 188: uint8(_BT_OTHER),
  24164. 189: uint8(_BT_OTHER),
  24165. 190: uint8(_BT_OTHER),
  24166. 191: uint8(_BT_OTHER),
  24167. 192: uint8(_BT_NMSTRT),
  24168. 193: uint8(_BT_NMSTRT),
  24169. 194: uint8(_BT_NMSTRT),
  24170. 195: uint8(_BT_NMSTRT),
  24171. 196: uint8(_BT_NMSTRT),
  24172. 197: uint8(_BT_NMSTRT),
  24173. 198: uint8(_BT_NMSTRT),
  24174. 199: uint8(_BT_NMSTRT),
  24175. 200: uint8(_BT_NMSTRT),
  24176. 201: uint8(_BT_NMSTRT),
  24177. 202: uint8(_BT_NMSTRT),
  24178. 203: uint8(_BT_NMSTRT),
  24179. 204: uint8(_BT_NMSTRT),
  24180. 205: uint8(_BT_NMSTRT),
  24181. 206: uint8(_BT_NMSTRT),
  24182. 207: uint8(_BT_NMSTRT),
  24183. 208: uint8(_BT_NMSTRT),
  24184. 209: uint8(_BT_NMSTRT),
  24185. 210: uint8(_BT_NMSTRT),
  24186. 211: uint8(_BT_NMSTRT),
  24187. 212: uint8(_BT_NMSTRT),
  24188. 213: uint8(_BT_NMSTRT),
  24189. 214: uint8(_BT_NMSTRT),
  24190. 215: uint8(_BT_OTHER),
  24191. 216: uint8(_BT_NMSTRT),
  24192. 217: uint8(_BT_NMSTRT),
  24193. 218: uint8(_BT_NMSTRT),
  24194. 219: uint8(_BT_NMSTRT),
  24195. 220: uint8(_BT_NMSTRT),
  24196. 221: uint8(_BT_NMSTRT),
  24197. 222: uint8(_BT_NMSTRT),
  24198. 223: uint8(_BT_NMSTRT),
  24199. 224: uint8(_BT_NMSTRT),
  24200. 225: uint8(_BT_NMSTRT),
  24201. 226: uint8(_BT_NMSTRT),
  24202. 227: uint8(_BT_NMSTRT),
  24203. 228: uint8(_BT_NMSTRT),
  24204. 229: uint8(_BT_NMSTRT),
  24205. 230: uint8(_BT_NMSTRT),
  24206. 231: uint8(_BT_NMSTRT),
  24207. 232: uint8(_BT_NMSTRT),
  24208. 233: uint8(_BT_NMSTRT),
  24209. 234: uint8(_BT_NMSTRT),
  24210. 235: uint8(_BT_NMSTRT),
  24211. 236: uint8(_BT_NMSTRT),
  24212. 237: uint8(_BT_NMSTRT),
  24213. 238: uint8(_BT_NMSTRT),
  24214. 239: uint8(_BT_NMSTRT),
  24215. 240: uint8(_BT_NMSTRT),
  24216. 241: uint8(_BT_NMSTRT),
  24217. 242: uint8(_BT_NMSTRT),
  24218. 243: uint8(_BT_NMSTRT),
  24219. 244: uint8(_BT_NMSTRT),
  24220. 245: uint8(_BT_NMSTRT),
  24221. 246: uint8(_BT_NMSTRT),
  24222. 247: uint8(_BT_OTHER),
  24223. 248: uint8(_BT_NMSTRT),
  24224. 249: uint8(_BT_NMSTRT),
  24225. 250: uint8(_BT_NMSTRT),
  24226. 251: uint8(_BT_NMSTRT),
  24227. 252: uint8(_BT_NMSTRT),
  24228. 253: uint8(_BT_NMSTRT),
  24229. 254: uint8(_BT_NMSTRT),
  24230. 255: uint8(_BT_NMSTRT),
  24231. },
  24232. }
  24233. func init() {
  24234. p := unsafe.Pointer(&_big2_encoding)
  24235. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  24236. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  24237. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  24238. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  24239. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  24240. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  24241. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  24242. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  24243. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  24244. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  24245. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  24246. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  24247. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  24248. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  24249. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  24250. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  24251. }
  24252. var _internal_big2_encoding_ns = Tnormal_encoding{
  24253. Fenc: TENCODING{
  24254. Fscanners: [4]TSCANNER{},
  24255. FliteralScanners: [2]TSCANNER{},
  24256. FminBytesPerChar: int32(2),
  24257. FisUtf16: uint8(1),
  24258. },
  24259. Ftype1: [256]uint8{
  24260. 9: uint8(_BT_S),
  24261. 10: uint8(_BT_LF),
  24262. 13: uint8(_BT_S),
  24263. 32: uint8(_BT_S),
  24264. 33: uint8(_BT_EXCL),
  24265. 34: uint8(_BT_QUOT),
  24266. 35: uint8(_BT_NUM),
  24267. 36: uint8(_BT_OTHER),
  24268. 37: uint8(_BT_PERCNT),
  24269. 38: uint8(_BT_AMP),
  24270. 39: uint8(_BT_APOS),
  24271. 40: uint8(_BT_LPAR),
  24272. 41: uint8(_BT_RPAR),
  24273. 42: uint8(_BT_AST),
  24274. 43: uint8(_BT_PLUS),
  24275. 44: uint8(_BT_COMMA),
  24276. 45: uint8(_BT_MINUS),
  24277. 46: uint8(_BT_NAME),
  24278. 47: uint8(_BT_SOL),
  24279. 48: uint8(_BT_DIGIT),
  24280. 49: uint8(_BT_DIGIT),
  24281. 50: uint8(_BT_DIGIT),
  24282. 51: uint8(_BT_DIGIT),
  24283. 52: uint8(_BT_DIGIT),
  24284. 53: uint8(_BT_DIGIT),
  24285. 54: uint8(_BT_DIGIT),
  24286. 55: uint8(_BT_DIGIT),
  24287. 56: uint8(_BT_DIGIT),
  24288. 57: uint8(_BT_DIGIT),
  24289. 58: uint8(_BT_COLON),
  24290. 59: uint8(_BT_SEMI),
  24291. 60: uint8(_BT_LT),
  24292. 61: uint8(_BT_EQUALS),
  24293. 62: uint8(_BT_GT),
  24294. 63: uint8(_BT_QUEST),
  24295. 64: uint8(_BT_OTHER),
  24296. 65: uint8(_BT_HEX),
  24297. 66: uint8(_BT_HEX),
  24298. 67: uint8(_BT_HEX),
  24299. 68: uint8(_BT_HEX),
  24300. 69: uint8(_BT_HEX),
  24301. 70: uint8(_BT_HEX),
  24302. 71: uint8(_BT_NMSTRT),
  24303. 72: uint8(_BT_NMSTRT),
  24304. 73: uint8(_BT_NMSTRT),
  24305. 74: uint8(_BT_NMSTRT),
  24306. 75: uint8(_BT_NMSTRT),
  24307. 76: uint8(_BT_NMSTRT),
  24308. 77: uint8(_BT_NMSTRT),
  24309. 78: uint8(_BT_NMSTRT),
  24310. 79: uint8(_BT_NMSTRT),
  24311. 80: uint8(_BT_NMSTRT),
  24312. 81: uint8(_BT_NMSTRT),
  24313. 82: uint8(_BT_NMSTRT),
  24314. 83: uint8(_BT_NMSTRT),
  24315. 84: uint8(_BT_NMSTRT),
  24316. 85: uint8(_BT_NMSTRT),
  24317. 86: uint8(_BT_NMSTRT),
  24318. 87: uint8(_BT_NMSTRT),
  24319. 88: uint8(_BT_NMSTRT),
  24320. 89: uint8(_BT_NMSTRT),
  24321. 90: uint8(_BT_NMSTRT),
  24322. 91: uint8(_BT_LSQB),
  24323. 92: uint8(_BT_OTHER),
  24324. 93: uint8(_BT_RSQB),
  24325. 94: uint8(_BT_OTHER),
  24326. 95: uint8(_BT_NMSTRT),
  24327. 96: uint8(_BT_OTHER),
  24328. 97: uint8(_BT_HEX),
  24329. 98: uint8(_BT_HEX),
  24330. 99: uint8(_BT_HEX),
  24331. 100: uint8(_BT_HEX),
  24332. 101: uint8(_BT_HEX),
  24333. 102: uint8(_BT_HEX),
  24334. 103: uint8(_BT_NMSTRT),
  24335. 104: uint8(_BT_NMSTRT),
  24336. 105: uint8(_BT_NMSTRT),
  24337. 106: uint8(_BT_NMSTRT),
  24338. 107: uint8(_BT_NMSTRT),
  24339. 108: uint8(_BT_NMSTRT),
  24340. 109: uint8(_BT_NMSTRT),
  24341. 110: uint8(_BT_NMSTRT),
  24342. 111: uint8(_BT_NMSTRT),
  24343. 112: uint8(_BT_NMSTRT),
  24344. 113: uint8(_BT_NMSTRT),
  24345. 114: uint8(_BT_NMSTRT),
  24346. 115: uint8(_BT_NMSTRT),
  24347. 116: uint8(_BT_NMSTRT),
  24348. 117: uint8(_BT_NMSTRT),
  24349. 118: uint8(_BT_NMSTRT),
  24350. 119: uint8(_BT_NMSTRT),
  24351. 120: uint8(_BT_NMSTRT),
  24352. 121: uint8(_BT_NMSTRT),
  24353. 122: uint8(_BT_NMSTRT),
  24354. 123: uint8(_BT_OTHER),
  24355. 124: uint8(_BT_VERBAR),
  24356. 125: uint8(_BT_OTHER),
  24357. 126: uint8(_BT_OTHER),
  24358. 127: uint8(_BT_OTHER),
  24359. 128: uint8(_BT_OTHER),
  24360. 129: uint8(_BT_OTHER),
  24361. 130: uint8(_BT_OTHER),
  24362. 131: uint8(_BT_OTHER),
  24363. 132: uint8(_BT_OTHER),
  24364. 133: uint8(_BT_OTHER),
  24365. 134: uint8(_BT_OTHER),
  24366. 135: uint8(_BT_OTHER),
  24367. 136: uint8(_BT_OTHER),
  24368. 137: uint8(_BT_OTHER),
  24369. 138: uint8(_BT_OTHER),
  24370. 139: uint8(_BT_OTHER),
  24371. 140: uint8(_BT_OTHER),
  24372. 141: uint8(_BT_OTHER),
  24373. 142: uint8(_BT_OTHER),
  24374. 143: uint8(_BT_OTHER),
  24375. 144: uint8(_BT_OTHER),
  24376. 145: uint8(_BT_OTHER),
  24377. 146: uint8(_BT_OTHER),
  24378. 147: uint8(_BT_OTHER),
  24379. 148: uint8(_BT_OTHER),
  24380. 149: uint8(_BT_OTHER),
  24381. 150: uint8(_BT_OTHER),
  24382. 151: uint8(_BT_OTHER),
  24383. 152: uint8(_BT_OTHER),
  24384. 153: uint8(_BT_OTHER),
  24385. 154: uint8(_BT_OTHER),
  24386. 155: uint8(_BT_OTHER),
  24387. 156: uint8(_BT_OTHER),
  24388. 157: uint8(_BT_OTHER),
  24389. 158: uint8(_BT_OTHER),
  24390. 159: uint8(_BT_OTHER),
  24391. 160: uint8(_BT_OTHER),
  24392. 161: uint8(_BT_OTHER),
  24393. 162: uint8(_BT_OTHER),
  24394. 163: uint8(_BT_OTHER),
  24395. 164: uint8(_BT_OTHER),
  24396. 165: uint8(_BT_OTHER),
  24397. 166: uint8(_BT_OTHER),
  24398. 167: uint8(_BT_OTHER),
  24399. 168: uint8(_BT_OTHER),
  24400. 169: uint8(_BT_OTHER),
  24401. 170: uint8(_BT_NMSTRT),
  24402. 171: uint8(_BT_OTHER),
  24403. 172: uint8(_BT_OTHER),
  24404. 173: uint8(_BT_OTHER),
  24405. 174: uint8(_BT_OTHER),
  24406. 175: uint8(_BT_OTHER),
  24407. 176: uint8(_BT_OTHER),
  24408. 177: uint8(_BT_OTHER),
  24409. 178: uint8(_BT_OTHER),
  24410. 179: uint8(_BT_OTHER),
  24411. 180: uint8(_BT_OTHER),
  24412. 181: uint8(_BT_NMSTRT),
  24413. 182: uint8(_BT_OTHER),
  24414. 183: uint8(_BT_NAME),
  24415. 184: uint8(_BT_OTHER),
  24416. 185: uint8(_BT_OTHER),
  24417. 186: uint8(_BT_NMSTRT),
  24418. 187: uint8(_BT_OTHER),
  24419. 188: uint8(_BT_OTHER),
  24420. 189: uint8(_BT_OTHER),
  24421. 190: uint8(_BT_OTHER),
  24422. 191: uint8(_BT_OTHER),
  24423. 192: uint8(_BT_NMSTRT),
  24424. 193: uint8(_BT_NMSTRT),
  24425. 194: uint8(_BT_NMSTRT),
  24426. 195: uint8(_BT_NMSTRT),
  24427. 196: uint8(_BT_NMSTRT),
  24428. 197: uint8(_BT_NMSTRT),
  24429. 198: uint8(_BT_NMSTRT),
  24430. 199: uint8(_BT_NMSTRT),
  24431. 200: uint8(_BT_NMSTRT),
  24432. 201: uint8(_BT_NMSTRT),
  24433. 202: uint8(_BT_NMSTRT),
  24434. 203: uint8(_BT_NMSTRT),
  24435. 204: uint8(_BT_NMSTRT),
  24436. 205: uint8(_BT_NMSTRT),
  24437. 206: uint8(_BT_NMSTRT),
  24438. 207: uint8(_BT_NMSTRT),
  24439. 208: uint8(_BT_NMSTRT),
  24440. 209: uint8(_BT_NMSTRT),
  24441. 210: uint8(_BT_NMSTRT),
  24442. 211: uint8(_BT_NMSTRT),
  24443. 212: uint8(_BT_NMSTRT),
  24444. 213: uint8(_BT_NMSTRT),
  24445. 214: uint8(_BT_NMSTRT),
  24446. 215: uint8(_BT_OTHER),
  24447. 216: uint8(_BT_NMSTRT),
  24448. 217: uint8(_BT_NMSTRT),
  24449. 218: uint8(_BT_NMSTRT),
  24450. 219: uint8(_BT_NMSTRT),
  24451. 220: uint8(_BT_NMSTRT),
  24452. 221: uint8(_BT_NMSTRT),
  24453. 222: uint8(_BT_NMSTRT),
  24454. 223: uint8(_BT_NMSTRT),
  24455. 224: uint8(_BT_NMSTRT),
  24456. 225: uint8(_BT_NMSTRT),
  24457. 226: uint8(_BT_NMSTRT),
  24458. 227: uint8(_BT_NMSTRT),
  24459. 228: uint8(_BT_NMSTRT),
  24460. 229: uint8(_BT_NMSTRT),
  24461. 230: uint8(_BT_NMSTRT),
  24462. 231: uint8(_BT_NMSTRT),
  24463. 232: uint8(_BT_NMSTRT),
  24464. 233: uint8(_BT_NMSTRT),
  24465. 234: uint8(_BT_NMSTRT),
  24466. 235: uint8(_BT_NMSTRT),
  24467. 236: uint8(_BT_NMSTRT),
  24468. 237: uint8(_BT_NMSTRT),
  24469. 238: uint8(_BT_NMSTRT),
  24470. 239: uint8(_BT_NMSTRT),
  24471. 240: uint8(_BT_NMSTRT),
  24472. 241: uint8(_BT_NMSTRT),
  24473. 242: uint8(_BT_NMSTRT),
  24474. 243: uint8(_BT_NMSTRT),
  24475. 244: uint8(_BT_NMSTRT),
  24476. 245: uint8(_BT_NMSTRT),
  24477. 246: uint8(_BT_NMSTRT),
  24478. 247: uint8(_BT_OTHER),
  24479. 248: uint8(_BT_NMSTRT),
  24480. 249: uint8(_BT_NMSTRT),
  24481. 250: uint8(_BT_NMSTRT),
  24482. 251: uint8(_BT_NMSTRT),
  24483. 252: uint8(_BT_NMSTRT),
  24484. 253: uint8(_BT_NMSTRT),
  24485. 254: uint8(_BT_NMSTRT),
  24486. 255: uint8(_BT_NMSTRT),
  24487. },
  24488. }
  24489. func init() {
  24490. p := unsafe.Pointer(&_internal_big2_encoding_ns)
  24491. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  24492. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  24493. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  24494. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  24495. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  24496. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  24497. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  24498. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  24499. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  24500. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  24501. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  24502. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  24503. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  24504. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  24505. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  24506. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  24507. }
  24508. var _internal_big2_encoding = Tnormal_encoding{
  24509. Fenc: TENCODING{
  24510. Fscanners: [4]TSCANNER{},
  24511. FliteralScanners: [2]TSCANNER{},
  24512. FminBytesPerChar: int32(2),
  24513. FisUtf16: uint8(1),
  24514. },
  24515. Ftype1: [256]uint8{
  24516. 9: uint8(_BT_S),
  24517. 10: uint8(_BT_LF),
  24518. 13: uint8(_BT_S),
  24519. 32: uint8(_BT_S),
  24520. 33: uint8(_BT_EXCL),
  24521. 34: uint8(_BT_QUOT),
  24522. 35: uint8(_BT_NUM),
  24523. 36: uint8(_BT_OTHER),
  24524. 37: uint8(_BT_PERCNT),
  24525. 38: uint8(_BT_AMP),
  24526. 39: uint8(_BT_APOS),
  24527. 40: uint8(_BT_LPAR),
  24528. 41: uint8(_BT_RPAR),
  24529. 42: uint8(_BT_AST),
  24530. 43: uint8(_BT_PLUS),
  24531. 44: uint8(_BT_COMMA),
  24532. 45: uint8(_BT_MINUS),
  24533. 46: uint8(_BT_NAME),
  24534. 47: uint8(_BT_SOL),
  24535. 48: uint8(_BT_DIGIT),
  24536. 49: uint8(_BT_DIGIT),
  24537. 50: uint8(_BT_DIGIT),
  24538. 51: uint8(_BT_DIGIT),
  24539. 52: uint8(_BT_DIGIT),
  24540. 53: uint8(_BT_DIGIT),
  24541. 54: uint8(_BT_DIGIT),
  24542. 55: uint8(_BT_DIGIT),
  24543. 56: uint8(_BT_DIGIT),
  24544. 57: uint8(_BT_DIGIT),
  24545. 58: uint8(_BT_NMSTRT),
  24546. 59: uint8(_BT_SEMI),
  24547. 60: uint8(_BT_LT),
  24548. 61: uint8(_BT_EQUALS),
  24549. 62: uint8(_BT_GT),
  24550. 63: uint8(_BT_QUEST),
  24551. 64: uint8(_BT_OTHER),
  24552. 65: uint8(_BT_HEX),
  24553. 66: uint8(_BT_HEX),
  24554. 67: uint8(_BT_HEX),
  24555. 68: uint8(_BT_HEX),
  24556. 69: uint8(_BT_HEX),
  24557. 70: uint8(_BT_HEX),
  24558. 71: uint8(_BT_NMSTRT),
  24559. 72: uint8(_BT_NMSTRT),
  24560. 73: uint8(_BT_NMSTRT),
  24561. 74: uint8(_BT_NMSTRT),
  24562. 75: uint8(_BT_NMSTRT),
  24563. 76: uint8(_BT_NMSTRT),
  24564. 77: uint8(_BT_NMSTRT),
  24565. 78: uint8(_BT_NMSTRT),
  24566. 79: uint8(_BT_NMSTRT),
  24567. 80: uint8(_BT_NMSTRT),
  24568. 81: uint8(_BT_NMSTRT),
  24569. 82: uint8(_BT_NMSTRT),
  24570. 83: uint8(_BT_NMSTRT),
  24571. 84: uint8(_BT_NMSTRT),
  24572. 85: uint8(_BT_NMSTRT),
  24573. 86: uint8(_BT_NMSTRT),
  24574. 87: uint8(_BT_NMSTRT),
  24575. 88: uint8(_BT_NMSTRT),
  24576. 89: uint8(_BT_NMSTRT),
  24577. 90: uint8(_BT_NMSTRT),
  24578. 91: uint8(_BT_LSQB),
  24579. 92: uint8(_BT_OTHER),
  24580. 93: uint8(_BT_RSQB),
  24581. 94: uint8(_BT_OTHER),
  24582. 95: uint8(_BT_NMSTRT),
  24583. 96: uint8(_BT_OTHER),
  24584. 97: uint8(_BT_HEX),
  24585. 98: uint8(_BT_HEX),
  24586. 99: uint8(_BT_HEX),
  24587. 100: uint8(_BT_HEX),
  24588. 101: uint8(_BT_HEX),
  24589. 102: uint8(_BT_HEX),
  24590. 103: uint8(_BT_NMSTRT),
  24591. 104: uint8(_BT_NMSTRT),
  24592. 105: uint8(_BT_NMSTRT),
  24593. 106: uint8(_BT_NMSTRT),
  24594. 107: uint8(_BT_NMSTRT),
  24595. 108: uint8(_BT_NMSTRT),
  24596. 109: uint8(_BT_NMSTRT),
  24597. 110: uint8(_BT_NMSTRT),
  24598. 111: uint8(_BT_NMSTRT),
  24599. 112: uint8(_BT_NMSTRT),
  24600. 113: uint8(_BT_NMSTRT),
  24601. 114: uint8(_BT_NMSTRT),
  24602. 115: uint8(_BT_NMSTRT),
  24603. 116: uint8(_BT_NMSTRT),
  24604. 117: uint8(_BT_NMSTRT),
  24605. 118: uint8(_BT_NMSTRT),
  24606. 119: uint8(_BT_NMSTRT),
  24607. 120: uint8(_BT_NMSTRT),
  24608. 121: uint8(_BT_NMSTRT),
  24609. 122: uint8(_BT_NMSTRT),
  24610. 123: uint8(_BT_OTHER),
  24611. 124: uint8(_BT_VERBAR),
  24612. 125: uint8(_BT_OTHER),
  24613. 126: uint8(_BT_OTHER),
  24614. 127: uint8(_BT_OTHER),
  24615. 128: uint8(_BT_OTHER),
  24616. 129: uint8(_BT_OTHER),
  24617. 130: uint8(_BT_OTHER),
  24618. 131: uint8(_BT_OTHER),
  24619. 132: uint8(_BT_OTHER),
  24620. 133: uint8(_BT_OTHER),
  24621. 134: uint8(_BT_OTHER),
  24622. 135: uint8(_BT_OTHER),
  24623. 136: uint8(_BT_OTHER),
  24624. 137: uint8(_BT_OTHER),
  24625. 138: uint8(_BT_OTHER),
  24626. 139: uint8(_BT_OTHER),
  24627. 140: uint8(_BT_OTHER),
  24628. 141: uint8(_BT_OTHER),
  24629. 142: uint8(_BT_OTHER),
  24630. 143: uint8(_BT_OTHER),
  24631. 144: uint8(_BT_OTHER),
  24632. 145: uint8(_BT_OTHER),
  24633. 146: uint8(_BT_OTHER),
  24634. 147: uint8(_BT_OTHER),
  24635. 148: uint8(_BT_OTHER),
  24636. 149: uint8(_BT_OTHER),
  24637. 150: uint8(_BT_OTHER),
  24638. 151: uint8(_BT_OTHER),
  24639. 152: uint8(_BT_OTHER),
  24640. 153: uint8(_BT_OTHER),
  24641. 154: uint8(_BT_OTHER),
  24642. 155: uint8(_BT_OTHER),
  24643. 156: uint8(_BT_OTHER),
  24644. 157: uint8(_BT_OTHER),
  24645. 158: uint8(_BT_OTHER),
  24646. 159: uint8(_BT_OTHER),
  24647. 160: uint8(_BT_OTHER),
  24648. 161: uint8(_BT_OTHER),
  24649. 162: uint8(_BT_OTHER),
  24650. 163: uint8(_BT_OTHER),
  24651. 164: uint8(_BT_OTHER),
  24652. 165: uint8(_BT_OTHER),
  24653. 166: uint8(_BT_OTHER),
  24654. 167: uint8(_BT_OTHER),
  24655. 168: uint8(_BT_OTHER),
  24656. 169: uint8(_BT_OTHER),
  24657. 170: uint8(_BT_NMSTRT),
  24658. 171: uint8(_BT_OTHER),
  24659. 172: uint8(_BT_OTHER),
  24660. 173: uint8(_BT_OTHER),
  24661. 174: uint8(_BT_OTHER),
  24662. 175: uint8(_BT_OTHER),
  24663. 176: uint8(_BT_OTHER),
  24664. 177: uint8(_BT_OTHER),
  24665. 178: uint8(_BT_OTHER),
  24666. 179: uint8(_BT_OTHER),
  24667. 180: uint8(_BT_OTHER),
  24668. 181: uint8(_BT_NMSTRT),
  24669. 182: uint8(_BT_OTHER),
  24670. 183: uint8(_BT_NAME),
  24671. 184: uint8(_BT_OTHER),
  24672. 185: uint8(_BT_OTHER),
  24673. 186: uint8(_BT_NMSTRT),
  24674. 187: uint8(_BT_OTHER),
  24675. 188: uint8(_BT_OTHER),
  24676. 189: uint8(_BT_OTHER),
  24677. 190: uint8(_BT_OTHER),
  24678. 191: uint8(_BT_OTHER),
  24679. 192: uint8(_BT_NMSTRT),
  24680. 193: uint8(_BT_NMSTRT),
  24681. 194: uint8(_BT_NMSTRT),
  24682. 195: uint8(_BT_NMSTRT),
  24683. 196: uint8(_BT_NMSTRT),
  24684. 197: uint8(_BT_NMSTRT),
  24685. 198: uint8(_BT_NMSTRT),
  24686. 199: uint8(_BT_NMSTRT),
  24687. 200: uint8(_BT_NMSTRT),
  24688. 201: uint8(_BT_NMSTRT),
  24689. 202: uint8(_BT_NMSTRT),
  24690. 203: uint8(_BT_NMSTRT),
  24691. 204: uint8(_BT_NMSTRT),
  24692. 205: uint8(_BT_NMSTRT),
  24693. 206: uint8(_BT_NMSTRT),
  24694. 207: uint8(_BT_NMSTRT),
  24695. 208: uint8(_BT_NMSTRT),
  24696. 209: uint8(_BT_NMSTRT),
  24697. 210: uint8(_BT_NMSTRT),
  24698. 211: uint8(_BT_NMSTRT),
  24699. 212: uint8(_BT_NMSTRT),
  24700. 213: uint8(_BT_NMSTRT),
  24701. 214: uint8(_BT_NMSTRT),
  24702. 215: uint8(_BT_OTHER),
  24703. 216: uint8(_BT_NMSTRT),
  24704. 217: uint8(_BT_NMSTRT),
  24705. 218: uint8(_BT_NMSTRT),
  24706. 219: uint8(_BT_NMSTRT),
  24707. 220: uint8(_BT_NMSTRT),
  24708. 221: uint8(_BT_NMSTRT),
  24709. 222: uint8(_BT_NMSTRT),
  24710. 223: uint8(_BT_NMSTRT),
  24711. 224: uint8(_BT_NMSTRT),
  24712. 225: uint8(_BT_NMSTRT),
  24713. 226: uint8(_BT_NMSTRT),
  24714. 227: uint8(_BT_NMSTRT),
  24715. 228: uint8(_BT_NMSTRT),
  24716. 229: uint8(_BT_NMSTRT),
  24717. 230: uint8(_BT_NMSTRT),
  24718. 231: uint8(_BT_NMSTRT),
  24719. 232: uint8(_BT_NMSTRT),
  24720. 233: uint8(_BT_NMSTRT),
  24721. 234: uint8(_BT_NMSTRT),
  24722. 235: uint8(_BT_NMSTRT),
  24723. 236: uint8(_BT_NMSTRT),
  24724. 237: uint8(_BT_NMSTRT),
  24725. 238: uint8(_BT_NMSTRT),
  24726. 239: uint8(_BT_NMSTRT),
  24727. 240: uint8(_BT_NMSTRT),
  24728. 241: uint8(_BT_NMSTRT),
  24729. 242: uint8(_BT_NMSTRT),
  24730. 243: uint8(_BT_NMSTRT),
  24731. 244: uint8(_BT_NMSTRT),
  24732. 245: uint8(_BT_NMSTRT),
  24733. 246: uint8(_BT_NMSTRT),
  24734. 247: uint8(_BT_OTHER),
  24735. 248: uint8(_BT_NMSTRT),
  24736. 249: uint8(_BT_NMSTRT),
  24737. 250: uint8(_BT_NMSTRT),
  24738. 251: uint8(_BT_NMSTRT),
  24739. 252: uint8(_BT_NMSTRT),
  24740. 253: uint8(_BT_NMSTRT),
  24741. 254: uint8(_BT_NMSTRT),
  24742. 255: uint8(_BT_NMSTRT),
  24743. },
  24744. }
  24745. func init() {
  24746. p := unsafe.Pointer(&_internal_big2_encoding)
  24747. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  24748. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  24749. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  24750. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  24751. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  24752. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  24753. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  24754. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  24755. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  24756. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  24757. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  24758. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  24759. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  24760. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  24761. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  24762. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  24763. }
  24764. func _streqci(tls *libc.TLS, s1 uintptr, s2 uintptr) (r int32) {
  24765. var c1, c2 uint8
  24766. var v2, v3 uintptr
  24767. _, _, _, _ = c1, c2, v2, v3
  24768. for {
  24769. v2 = s1
  24770. s1++
  24771. c1 = *(*uint8)(unsafe.Pointer(v2))
  24772. v3 = s2
  24773. s2++
  24774. c2 = *(*uint8)(unsafe.Pointer(v3))
  24775. if int32(m_ASCII_a) <= libc.Int32FromUint8(c1) && libc.Int32FromUint8(c1) <= int32(m_ASCII_z1) {
  24776. c1 = uint8(int32(c1) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a)))
  24777. }
  24778. if int32(m_ASCII_a) <= libc.Int32FromUint8(c2) && libc.Int32FromUint8(c2) <= int32(m_ASCII_z1) {
  24779. /* The following line will never get executed. streqci() is
  24780. * only called from two places, both of which guarantee to put
  24781. * upper-case strings into s2.
  24782. */
  24783. c2 = uint8(int32(c2) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a)))
  24784. } /* LCOV_EXCL_LINE */
  24785. if libc.Int32FromUint8(c1) != libc.Int32FromUint8(c2) {
  24786. return 0
  24787. }
  24788. if !(c1 != 0) {
  24789. break
  24790. }
  24791. goto _1
  24792. _1:
  24793. }
  24794. return int32(1)
  24795. }
  24796. func _initUpdatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  24797. _ = enc
  24798. _normal_updatePosition(tls, uintptr(unsafe.Pointer(&_utf8_encoding)), ptr, end, pos)
  24799. }
  24800. func _toAscii(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r int32) {
  24801. bp := tls.Alloc(32)
  24802. defer tls.Free(32)
  24803. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  24804. var _ /* buf at bp+8 */ [1]uint8
  24805. var _ /* p at bp+16 */ uintptr
  24806. *(*uintptr)(unsafe.Pointer(bp + 16)) = bp + 8
  24807. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+16, *(*uintptr)(unsafe.Pointer(bp + 16))+uintptr(1))
  24808. if *(*uintptr)(unsafe.Pointer(bp + 16)) == bp+8 {
  24809. return -int32(1)
  24810. } else {
  24811. return libc.Int32FromUint8((*(*[1]uint8)(unsafe.Pointer(bp + 8)))[0])
  24812. }
  24813. return r
  24814. }
  24815. func _isSpace(tls *libc.TLS, c int32) (r int32) {
  24816. switch c {
  24817. case int32(0x20):
  24818. fallthrough
  24819. case int32(0xD):
  24820. fallthrough
  24821. case int32(0xA):
  24822. fallthrough
  24823. case int32(0x9):
  24824. return int32(1)
  24825. }
  24826. return 0
  24827. }
  24828. // C documentation
  24829. //
  24830. // /* Return 1 if there's just optional white space or there's an S
  24831. // followed by name=val.
  24832. // */
  24833. func _parsePseudoAttribute(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, namePtr uintptr, nameEndPtr uintptr, valPtr uintptr, nextTokPtr uintptr) (r int32) {
  24834. var c, v2 int32
  24835. var open uint8
  24836. _, _, _ = c, open, v2
  24837. if ptr == end {
  24838. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  24839. return int32(1)
  24840. }
  24841. if !(_isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0) {
  24842. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24843. return 0
  24844. }
  24845. for cond := true; cond; cond = _isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0 {
  24846. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  24847. }
  24848. if ptr == end {
  24849. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  24850. return int32(1)
  24851. }
  24852. *(*uintptr)(unsafe.Pointer(namePtr)) = ptr
  24853. for {
  24854. c = _toAscii(tls, enc, ptr, end)
  24855. if c == -int32(1) {
  24856. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24857. return 0
  24858. }
  24859. if c == int32(m_ASCII_EQUALS) {
  24860. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  24861. break
  24862. }
  24863. if _isSpace(tls, c) != 0 {
  24864. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  24865. for {
  24866. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  24867. goto _3
  24868. _3:
  24869. ;
  24870. v2 = _toAscii(tls, enc, ptr, end)
  24871. c = v2
  24872. if !(_isSpace(tls, v2) != 0) {
  24873. break
  24874. }
  24875. }
  24876. if c != int32(m_ASCII_EQUALS) {
  24877. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24878. return 0
  24879. }
  24880. break
  24881. }
  24882. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  24883. goto _1
  24884. _1:
  24885. }
  24886. if ptr == *(*uintptr)(unsafe.Pointer(namePtr)) {
  24887. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24888. return 0
  24889. }
  24890. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  24891. c = _toAscii(tls, enc, ptr, end)
  24892. for _isSpace(tls, c) != 0 {
  24893. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  24894. c = _toAscii(tls, enc, ptr, end)
  24895. }
  24896. if c != int32(m_ASCII_QUOT1) && c != int32(m_ASCII_APOS1) {
  24897. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24898. return 0
  24899. }
  24900. open = libc.Uint8FromInt32(c)
  24901. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  24902. *(*uintptr)(unsafe.Pointer(valPtr)) = ptr
  24903. for {
  24904. c = _toAscii(tls, enc, ptr, end)
  24905. if c == libc.Int32FromUint8(open) {
  24906. break
  24907. }
  24908. if !(int32(m_ASCII_a) <= c && c <= int32(m_ASCII_z1)) && !(int32(m_ASCII_A) <= c && c <= int32(m_ASCII_Z1)) && !(int32(m_ASCII_0) <= c && c <= int32(m_ASCII_9)) && c != int32(m_ASCII_PERIOD) && c != int32(m_ASCII_MINUS1) && c != int32(m_ASCII_UNDERSCORE1) {
  24909. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24910. return 0
  24911. }
  24912. goto _4
  24913. _4:
  24914. ;
  24915. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  24916. }
  24917. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  24918. return int32(1)
  24919. }
  24920. var _KW_version = [8]uint8{
  24921. 0: uint8(m_ASCII_v1),
  24922. 1: uint8(m_ASCII_e),
  24923. 2: uint8(m_ASCII_r),
  24924. 3: uint8(m_ASCII_s),
  24925. 4: uint8(m_ASCII_i1),
  24926. 5: uint8(m_ASCII_o),
  24927. 6: uint8(m_ASCII_n),
  24928. }
  24929. var _KW_encoding = [9]uint8{
  24930. 0: uint8(m_ASCII_e),
  24931. 1: uint8(m_ASCII_n),
  24932. 2: uint8(m_ASCII_c),
  24933. 3: uint8(m_ASCII_o),
  24934. 4: uint8(m_ASCII_d1),
  24935. 5: uint8(m_ASCII_i1),
  24936. 6: uint8(m_ASCII_n),
  24937. 7: uint8(m_ASCII_g),
  24938. }
  24939. var _KW_standalone = [11]uint8{
  24940. 0: uint8(m_ASCII_s),
  24941. 1: uint8(m_ASCII_t),
  24942. 2: uint8(m_ASCII_a),
  24943. 3: uint8(m_ASCII_n),
  24944. 4: uint8(m_ASCII_d1),
  24945. 5: uint8(m_ASCII_a),
  24946. 6: uint8(m_ASCII_l),
  24947. 7: uint8(m_ASCII_o),
  24948. 8: uint8(m_ASCII_n),
  24949. 9: uint8(m_ASCII_e),
  24950. }
  24951. var _KW_yes = [4]uint8{
  24952. 0: uint8(m_ASCII_y1),
  24953. 1: uint8(m_ASCII_e),
  24954. 2: uint8(m_ASCII_s),
  24955. }
  24956. var _KW_no = [3]uint8{
  24957. 0: uint8(m_ASCII_n),
  24958. 1: uint8(m_ASCII_o),
  24959. }
  24960. func _doParseXmlDecl(tls *libc.TLS, encodingFinder uintptr, isGeneralTextEntity int32, enc uintptr, _ptr uintptr, end uintptr, badPtr uintptr, versionPtr uintptr, versionEndPtr uintptr, encodingName uintptr, encoding uintptr, standalone uintptr) (r int32) {
  24961. bp := tls.Alloc(32)
  24962. defer tls.Free(32)
  24963. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  24964. var c int32
  24965. var _ /* name at bp+16 */ uintptr
  24966. var _ /* nameEnd at bp+24 */ uintptr
  24967. var _ /* val at bp+8 */ uintptr
  24968. _ = c
  24969. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  24970. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  24971. *(*uintptr)(unsafe.Pointer(bp + 24)) = libc.UintptrFromInt32(0)
  24972. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(int32(5) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  24973. end -= uintptr(int32(2) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  24974. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) || !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  24975. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24976. return 0
  24977. }
  24978. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24)), uintptr(unsafe.Pointer(&_KW_version))) != 0) {
  24979. if !(isGeneralTextEntity != 0) {
  24980. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 16))
  24981. return 0
  24982. }
  24983. } else {
  24984. if versionPtr != 0 {
  24985. *(*uintptr)(unsafe.Pointer(versionPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  24986. }
  24987. if versionEndPtr != 0 {
  24988. *(*uintptr)(unsafe.Pointer(versionEndPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24989. }
  24990. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) {
  24991. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24992. return 0
  24993. }
  24994. if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  24995. if isGeneralTextEntity != 0 {
  24996. /* a TextDecl must have an EncodingDecl */
  24997. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24998. return 0
  24999. }
  25000. return int32(1)
  25001. }
  25002. }
  25003. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24)), uintptr(unsafe.Pointer(&_KW_encoding))) != 0 {
  25004. c = _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), end)
  25005. if !(int32(m_ASCII_a) <= c && c <= int32(m_ASCII_z1)) && !(int32(m_ASCII_A) <= c && c <= int32(m_ASCII_Z1)) {
  25006. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  25007. return 0
  25008. }
  25009. if encodingName != 0 {
  25010. *(*uintptr)(unsafe.Pointer(encodingName)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  25011. }
  25012. if encoding != 0 {
  25013. *(*uintptr)(unsafe.Pointer(encoding)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{encodingFinder})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  25014. }
  25015. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) {
  25016. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  25017. return 0
  25018. }
  25019. if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  25020. return int32(1)
  25021. }
  25022. }
  25023. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24)), uintptr(unsafe.Pointer(&_KW_standalone))) != 0) || isGeneralTextEntity != 0 {
  25024. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 16))
  25025. return 0
  25026. }
  25027. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), uintptr(unsafe.Pointer(&_KW_yes))) != 0 {
  25028. if standalone != 0 {
  25029. *(*int32)(unsafe.Pointer(standalone)) = int32(1)
  25030. }
  25031. } else {
  25032. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), uintptr(unsafe.Pointer(&_KW_no))) != 0 {
  25033. if standalone != 0 {
  25034. *(*int32)(unsafe.Pointer(standalone)) = 0
  25035. }
  25036. } else {
  25037. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  25038. return 0
  25039. }
  25040. }
  25041. for _isSpace(tls, _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end)) != 0 {
  25042. *(*uintptr)(unsafe.Pointer(bp)) += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  25043. }
  25044. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  25045. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  25046. return 0
  25047. }
  25048. return int32(1)
  25049. }
  25050. func _checkCharRefNumber(tls *libc.TLS, result int32) (r int32) {
  25051. switch result >> libc.Int32FromInt32(8) {
  25052. case int32(0xD8):
  25053. fallthrough
  25054. case int32(0xD9):
  25055. fallthrough
  25056. case int32(0xDA):
  25057. fallthrough
  25058. case int32(0xDB):
  25059. fallthrough
  25060. case int32(0xDC):
  25061. fallthrough
  25062. case int32(0xDD):
  25063. fallthrough
  25064. case int32(0xDE):
  25065. fallthrough
  25066. case int32(0xDF):
  25067. return -int32(1)
  25068. case 0:
  25069. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(result)))) == int32(_BT_NONXML) {
  25070. return -int32(1)
  25071. }
  25072. case int32(0xFF):
  25073. if result == int32(0xFFFE) || result == int32(0xFFFF) {
  25074. return -int32(1)
  25075. }
  25076. break
  25077. }
  25078. return result
  25079. }
  25080. func XXmlUtf8Encode(tls *libc.TLS, c int32, buf uintptr) (r int32) {
  25081. if c < 0 {
  25082. return 0
  25083. } /* LCOV_EXCL_LINE: this case is always eliminated beforehand */
  25084. if c < 128 {
  25085. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c | int32(_UTF8_cval1))
  25086. return int32(1)
  25087. }
  25088. if c < 2048 {
  25089. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  25090. *(*uint8)(unsafe.Pointer(buf + 1)) = libc.Uint8FromInt32(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  25091. return int32(2)
  25092. }
  25093. if c < 65536 {
  25094. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(12) | int32(_UTF8_cval3))
  25095. *(*uint8)(unsafe.Pointer(buf + 1)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  25096. *(*uint8)(unsafe.Pointer(buf + 2)) = libc.Uint8FromInt32(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  25097. return int32(3)
  25098. }
  25099. if c < int32(0x110000) {
  25100. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(18) | int32(_UTF8_cval4))
  25101. *(*uint8)(unsafe.Pointer(buf + 1)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(12)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  25102. *(*uint8)(unsafe.Pointer(buf + 2)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  25103. *(*uint8)(unsafe.Pointer(buf + 3)) = libc.Uint8FromInt32(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  25104. return int32(4)
  25105. }
  25106. return 0 /* LCOV_EXCL_LINE: this case too is eliminated before calling */
  25107. }
  25108. func XXmlUtf16Encode(tls *libc.TLS, charNum int32, buf uintptr) (r int32) {
  25109. if charNum < 0 {
  25110. return 0
  25111. }
  25112. if charNum < int32(0x10000) {
  25113. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum)
  25114. return int32(1)
  25115. }
  25116. if charNum < int32(0x110000) {
  25117. charNum -= int32(0x10000)
  25118. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum>>libc.Int32FromInt32(10) + libc.Int32FromInt32(0xD800))
  25119. *(*uint16)(unsafe.Pointer(buf + 1*2)) = libc.Uint16FromInt32(charNum&libc.Int32FromInt32(0x3FF) + libc.Int32FromInt32(0xDC00))
  25120. return int32(2)
  25121. }
  25122. return 0
  25123. }
  25124. type Tunknown_encoding = struct {
  25125. Fnormal Tnormal_encoding
  25126. Fconvert TCONVERTER
  25127. FuserData uintptr
  25128. Futf16 [256]uint16
  25129. Futf8 [256][4]uint8
  25130. }
  25131. func XXmlSizeOfUnknownEncoding(tls *libc.TLS) (r int32) {
  25132. return int32(2016)
  25133. }
  25134. func _unknown_isName(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  25135. var c int32
  25136. var uenc uintptr
  25137. _, _ = c, uenc
  25138. uenc = enc
  25139. c = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tunknown_encoding)(unsafe.Pointer(uenc)).Fconvert})))(tls, (*Tunknown_encoding)(unsafe.Pointer(uenc)).FuserData, p)
  25140. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  25141. return 0
  25142. }
  25143. return libc.Int32FromUint32(_namingBitmap[libc.Int32FromUint8(_namePages[c>>int32(8)])<<int32(3)+c&int32(0xFF)>>int32(5)] & (libc.Uint32FromUint32(1) << (c & libc.Int32FromInt32(0xFF) & libc.Int32FromInt32(0x1F))))
  25144. }
  25145. func _unknown_isNmstrt(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  25146. var c int32
  25147. var uenc uintptr
  25148. _, _ = c, uenc
  25149. uenc = enc
  25150. c = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tunknown_encoding)(unsafe.Pointer(uenc)).Fconvert})))(tls, (*Tunknown_encoding)(unsafe.Pointer(uenc)).FuserData, p)
  25151. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  25152. return 0
  25153. }
  25154. return libc.Int32FromUint32(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[c>>int32(8)])<<int32(3)+c&int32(0xFF)>>int32(5)] & (libc.Uint32FromUint32(1) << (c & libc.Int32FromInt32(0xFF) & libc.Int32FromInt32(0x1F))))
  25155. }
  25156. func _unknown_isInvalid(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  25157. var c int32
  25158. var uenc uintptr
  25159. _, _ = c, uenc
  25160. uenc = enc
  25161. c = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tunknown_encoding)(unsafe.Pointer(uenc)).Fconvert})))(tls, (*Tunknown_encoding)(unsafe.Pointer(uenc)).FuserData, p)
  25162. return libc.BoolInt32(c & ^libc.Int32FromInt32(0xFFFF) != 0 || _checkCharRefNumber(tls, c) < 0)
  25163. }
  25164. func _unknown_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  25165. bp := tls.Alloc(16)
  25166. defer tls.Free(16)
  25167. var c, n int32
  25168. var uenc, utf8, v2 uintptr
  25169. var _ /* buf at bp+0 */ [4]uint8
  25170. _, _, _, _, _ = c, n, uenc, utf8, v2
  25171. uenc = enc
  25172. for {
  25173. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  25174. return int32(_XML_CONVERT_COMPLETED)
  25175. }
  25176. utf8 = uenc + 992 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))*4
  25177. v2 = utf8
  25178. utf8++
  25179. n = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v2)))
  25180. if n == 0 {
  25181. c = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tunknown_encoding)(unsafe.Pointer(uenc)).Fconvert})))(tls, (*Tunknown_encoding)(unsafe.Pointer(uenc)).FuserData, *(*uintptr)(unsafe.Pointer(fromP)))
  25182. n = XXmlUtf8Encode(tls, c, bp)
  25183. if int64(n) > int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) {
  25184. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  25185. }
  25186. utf8 = bp
  25187. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))))) - (int32(_BT_LEAD2) - libc.Int32FromInt32(2)))
  25188. } else {
  25189. if int64(n) > int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) {
  25190. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  25191. }
  25192. *(*uintptr)(unsafe.Pointer(fromP))++
  25193. }
  25194. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), utf8, libc.Uint64FromInt32(n))
  25195. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(n)
  25196. goto _1
  25197. _1:
  25198. }
  25199. return r
  25200. }
  25201. func _unknown_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  25202. var c uint16
  25203. var uenc, v1, v2 uintptr
  25204. _, _, _, _ = c, uenc, v1, v2
  25205. uenc = enc
  25206. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  25207. c = *(*uint16)(unsafe.Pointer(uenc + 480 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))*2))
  25208. if libc.Int32FromUint16(c) == 0 {
  25209. c = libc.Uint16FromInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tunknown_encoding)(unsafe.Pointer(uenc)).Fconvert})))(tls, (*Tunknown_encoding)(unsafe.Pointer(uenc)).FuserData, *(*uintptr)(unsafe.Pointer(fromP))))
  25210. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))))) - (int32(_BT_LEAD2) - libc.Int32FromInt32(2)))
  25211. } else {
  25212. *(*uintptr)(unsafe.Pointer(fromP))++
  25213. }
  25214. v2 = toP
  25215. v1 = *(*uintptr)(unsafe.Pointer(v2))
  25216. *(*uintptr)(unsafe.Pointer(v2)) += 2
  25217. *(*uint16)(unsafe.Pointer(v1)) = c
  25218. }
  25219. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  25220. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  25221. } else {
  25222. return int32(_XML_CONVERT_COMPLETED)
  25223. }
  25224. return r
  25225. }
  25226. func XXmlInitUnknownEncoding(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  25227. var c, i, v3 int32
  25228. var e uintptr
  25229. _, _, _, _ = c, e, i, v3
  25230. e = mem
  25231. libc.Xmemcpy(tls, mem, uintptr(unsafe.Pointer(&_latin1_encoding)), uint64(464))
  25232. i = 0
  25233. for {
  25234. if !(i < int32(128)) {
  25235. break
  25236. }
  25237. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(i)))) != int32(_BT_OTHER) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(i)))) != int32(_BT_NONXML) && *(*int32)(unsafe.Pointer(table + uintptr(i)*4)) != i {
  25238. return uintptr(0)
  25239. }
  25240. goto _1
  25241. _1:
  25242. ;
  25243. i++
  25244. }
  25245. i = 0
  25246. for {
  25247. if !(i < int32(256)) {
  25248. break
  25249. }
  25250. c = *(*int32)(unsafe.Pointer(table + uintptr(i)*4))
  25251. if c == -int32(1) {
  25252. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_MALFORM)
  25253. /* This shouldn't really get used. */
  25254. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0xFFFF)
  25255. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = uint8(1)
  25256. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = uint8(0)
  25257. } else {
  25258. if c < 0 {
  25259. if c < -int32(4) {
  25260. return uintptr(0)
  25261. }
  25262. /* Multi-byte sequences need a converter function */
  25263. if !(convert != 0) {
  25264. return uintptr(0)
  25265. }
  25266. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = libc.Uint8FromInt32(int32(_BT_LEAD2) - (c + libc.Int32FromInt32(2)))
  25267. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = uint8(0)
  25268. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0)
  25269. } else {
  25270. if c < int32(0x80) {
  25271. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(c)))) != int32(_BT_OTHER) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(c)))) != int32(_BT_NONXML) && c != i {
  25272. return uintptr(0)
  25273. }
  25274. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = *(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(c)))
  25275. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = uint8(1)
  25276. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = libc.Uint8FromInt32(c)
  25277. if c == 0 {
  25278. v3 = int32(0xFFFF)
  25279. } else {
  25280. v3 = c
  25281. }
  25282. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = libc.Uint16FromInt32(v3)
  25283. } else {
  25284. if _checkCharRefNumber(tls, c) < 0 {
  25285. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NONXML)
  25286. /* This shouldn't really get used. */
  25287. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0xFFFF)
  25288. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = uint8(1)
  25289. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = uint8(0)
  25290. } else {
  25291. if c > int32(0xFFFF) {
  25292. return uintptr(0)
  25293. }
  25294. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  25295. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NMSTRT)
  25296. } else {
  25297. if _namingBitmap[libc.Int32FromUint8(_namePages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  25298. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NAME)
  25299. } else {
  25300. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_OTHER)
  25301. }
  25302. }
  25303. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = libc.Uint8FromInt32(XXmlUtf8Encode(tls, c, e+992+uintptr(i)*4+uintptr(1)))
  25304. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = libc.Uint16FromInt32(c)
  25305. }
  25306. }
  25307. }
  25308. }
  25309. goto _2
  25310. _2:
  25311. ;
  25312. i++
  25313. }
  25314. (*Tunknown_encoding)(unsafe.Pointer(e)).FuserData = userData
  25315. (*Tunknown_encoding)(unsafe.Pointer(e)).Fconvert = convert
  25316. if convert != 0 {
  25317. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName2 = __ccgo_fp(_unknown_isName)
  25318. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName3 = __ccgo_fp(_unknown_isName)
  25319. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName4 = __ccgo_fp(_unknown_isName)
  25320. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt2 = __ccgo_fp(_unknown_isNmstrt)
  25321. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt3 = __ccgo_fp(_unknown_isNmstrt)
  25322. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt4 = __ccgo_fp(_unknown_isNmstrt)
  25323. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid2 = __ccgo_fp(_unknown_isInvalid)
  25324. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid3 = __ccgo_fp(_unknown_isInvalid)
  25325. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid4 = __ccgo_fp(_unknown_isInvalid)
  25326. }
  25327. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf8Convert = __ccgo_fp(_unknown_toUtf8)
  25328. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf16Convert = __ccgo_fp(_unknown_toUtf16)
  25329. return e
  25330. }
  25331. const _UNKNOWN_ENC = -1
  25332. const _ISO_8859_1_ENC = 0
  25333. const _US_ASCII_ENC = 1
  25334. const _UTF_8_ENC = 2
  25335. const _UTF_16_ENC = 3
  25336. const _UTF_16BE_ENC = 4
  25337. const _UTF_16LE_ENC = 5
  25338. const
  25339. /* must match encodingNames up to here */
  25340. _NO_ENC = 6
  25341. var _KW_ISO_8859_1 = [11]uint8{
  25342. 0: uint8(m_ASCII_I),
  25343. 1: uint8(m_ASCII_S),
  25344. 2: uint8(m_ASCII_O),
  25345. 3: uint8(m_ASCII_MINUS1),
  25346. 4: uint8(m_ASCII_8),
  25347. 5: uint8(m_ASCII_8),
  25348. 6: uint8(m_ASCII_51),
  25349. 7: uint8(m_ASCII_9),
  25350. 8: uint8(m_ASCII_MINUS1),
  25351. 9: uint8(m_ASCII_1),
  25352. }
  25353. var _KW_US_ASCII = [9]uint8{
  25354. 0: uint8(m_ASCII_U1),
  25355. 1: uint8(m_ASCII_S),
  25356. 2: uint8(m_ASCII_MINUS1),
  25357. 3: uint8(m_ASCII_A),
  25358. 4: uint8(m_ASCII_S),
  25359. 5: uint8(m_ASCII_C),
  25360. 6: uint8(m_ASCII_I),
  25361. 7: uint8(m_ASCII_I),
  25362. }
  25363. var _KW_UTF_8 = [6]uint8{
  25364. 0: uint8(m_ASCII_U1),
  25365. 1: uint8(m_ASCII_T),
  25366. 2: uint8(m_ASCII_F),
  25367. 3: uint8(m_ASCII_MINUS1),
  25368. 4: uint8(m_ASCII_8),
  25369. }
  25370. var _KW_UTF_16 = [7]uint8{
  25371. 0: uint8(m_ASCII_U1),
  25372. 1: uint8(m_ASCII_T),
  25373. 2: uint8(m_ASCII_F),
  25374. 3: uint8(m_ASCII_MINUS1),
  25375. 4: uint8(m_ASCII_1),
  25376. 5: uint8(m_ASCII_61),
  25377. }
  25378. var _KW_UTF_16BE = [9]uint8{
  25379. 0: uint8(m_ASCII_U1),
  25380. 1: uint8(m_ASCII_T),
  25381. 2: uint8(m_ASCII_F),
  25382. 3: uint8(m_ASCII_MINUS1),
  25383. 4: uint8(m_ASCII_1),
  25384. 5: uint8(m_ASCII_61),
  25385. 6: uint8(m_ASCII_B1),
  25386. 7: uint8(m_ASCII_E),
  25387. }
  25388. var _KW_UTF_16LE = [9]uint8{
  25389. 0: uint8(m_ASCII_U1),
  25390. 1: uint8(m_ASCII_T),
  25391. 2: uint8(m_ASCII_F),
  25392. 3: uint8(m_ASCII_MINUS1),
  25393. 4: uint8(m_ASCII_1),
  25394. 5: uint8(m_ASCII_61),
  25395. 6: uint8(m_ASCII_L),
  25396. 7: uint8(m_ASCII_E),
  25397. }
  25398. func _getEncodingIndex(tls *libc.TLS, name uintptr) (r int32) {
  25399. var i int32
  25400. _ = i
  25401. if name == libc.UintptrFromInt32(0) {
  25402. return int32(_NO_ENC)
  25403. }
  25404. i = 0
  25405. for {
  25406. if !(i < libc.Int32FromUint64(libc.Uint64FromInt64(48)/libc.Uint64FromInt64(8))) {
  25407. break
  25408. }
  25409. if _streqci(tls, name, _encodingNames[i]) != 0 {
  25410. return i
  25411. }
  25412. goto _1
  25413. _1:
  25414. ;
  25415. i++
  25416. }
  25417. return int32(_UNKNOWN_ENC)
  25418. }
  25419. var _encodingNames = [6]uintptr{
  25420. 0: uintptr(unsafe.Pointer(&_KW_ISO_8859_1)),
  25421. 1: uintptr(unsafe.Pointer(&_KW_US_ASCII)),
  25422. 2: uintptr(unsafe.Pointer(&_KW_UTF_8)),
  25423. 3: uintptr(unsafe.Pointer(&_KW_UTF_16)),
  25424. 4: uintptr(unsafe.Pointer(&_KW_UTF_16BE)),
  25425. 5: uintptr(unsafe.Pointer(&_KW_UTF_16LE)),
  25426. }
  25427. /* For binary compatibility, we store the index of the encoding
  25428. specified at initialization in the isUtf16 member.
  25429. */
  25430. /* This is what detects the encoding. encodingTable maps from
  25431. encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of
  25432. the external (protocol) specified encoding; state is
  25433. XML_CONTENT_STATE if we're parsing an external text entity, and
  25434. XML_PROLOG_STATE otherwise.
  25435. */
  25436. func _initScan(tls *libc.TLS, encodingTable uintptr, enc uintptr, state int32, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25437. var e int32
  25438. var encPtr uintptr
  25439. _, _ = e, encPtr
  25440. if ptr >= end {
  25441. return -int32(4)
  25442. }
  25443. encPtr = (*TINIT_ENCODING)(unsafe.Pointer(enc)).FencPtr
  25444. if ptr+uintptr(1) == end {
  25445. /* only a single byte available for auto-detection */
  25446. /* so we're parsing an external text entity... */
  25447. /* if UTF-16 was externally specified, then we need at least 2 bytes */
  25448. switch libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) {
  25449. case int32(_UTF_16_ENC):
  25450. fallthrough
  25451. case int32(_UTF_16LE_ENC):
  25452. fallthrough
  25453. case int32(_UTF_16BE_ENC):
  25454. return -int32(1)
  25455. }
  25456. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  25457. case int32(0xFE):
  25458. fallthrough
  25459. case int32(0xFF):
  25460. fallthrough
  25461. case int32(0xEF): /* possibly first byte of UTF-8 BOM */
  25462. if libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  25463. break
  25464. }
  25465. /* fall through */
  25466. fallthrough
  25467. case 0x00:
  25468. fallthrough
  25469. case int32(0x3C):
  25470. return -int32(1)
  25471. }
  25472. } else {
  25473. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))<<libc.Int32FromInt32(8) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) {
  25474. case int32(0xFEFF):
  25475. if libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  25476. break
  25477. }
  25478. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25479. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*8))
  25480. return int32(m_XML_TOK_BOM)
  25481. /* 00 3C is handled in the default case */
  25482. fallthrough
  25483. case int32(0x3C00):
  25484. if (libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16BE_ENC) || libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16_ENC)) && state == int32(m_XML_CONTENT_STATE) {
  25485. break
  25486. }
  25487. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  25488. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*8))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  25489. case int32(0xFFFE):
  25490. if libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  25491. break
  25492. }
  25493. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25494. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  25495. return int32(m_XML_TOK_BOM)
  25496. case int32(0xEFBB):
  25497. /* Maybe a UTF-8 BOM (EF BB BF) */
  25498. /* If there's an explicitly specified (external) encoding
  25499. of ISO-8859-1 or some flavour of UTF-16
  25500. and this is an external text entity,
  25501. don't look for the BOM,
  25502. because it might be a legal data.
  25503. */
  25504. if state == int32(m_XML_CONTENT_STATE) {
  25505. e = libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16)
  25506. if e == int32(_ISO_8859_1_ENC) || e == int32(_UTF_16BE_ENC) || e == int32(_UTF_16LE_ENC) || e == int32(_UTF_16_ENC) {
  25507. break
  25508. }
  25509. }
  25510. if ptr+uintptr(2) == end {
  25511. return -int32(1)
  25512. }
  25513. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 2))) == int32(0xBF) {
  25514. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(3)
  25515. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_8_ENC)*8))
  25516. return int32(m_XML_TOK_BOM)
  25517. }
  25518. default:
  25519. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32('\000') {
  25520. /* 0 isn't a legal data character. Furthermore a document
  25521. entity can only start with ASCII characters. So the only
  25522. way this can fail to be big-endian UTF-16 if it it's an
  25523. external parsed general entity that's labelled as
  25524. UTF-16LE.
  25525. */
  25526. if state == int32(m_XML_CONTENT_STATE) && libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16LE_ENC) {
  25527. break
  25528. }
  25529. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*8))
  25530. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*8))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  25531. } else {
  25532. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32('\000') {
  25533. /* We could recover here in the case:
  25534. - parsing an external entity
  25535. - second byte is 0
  25536. - no externally specified encoding
  25537. - no encoding declaration
  25538. by assuming UTF-16LE. But we don't, because this would mean when
  25539. presented just with a single byte, we couldn't reliably determine
  25540. whether we needed further bytes.
  25541. */
  25542. if state == int32(m_XML_CONTENT_STATE) {
  25543. break
  25544. }
  25545. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  25546. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*8))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  25547. }
  25548. }
  25549. break
  25550. }
  25551. }
  25552. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16))*8))
  25553. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*8))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  25554. }
  25555. /* This file is included!
  25556. __ __ _
  25557. ___\ \/ /_ __ __ _| |_
  25558. / _ \\ /| '_ \ / _` | __|
  25559. | __// \| |_) | (_| | |_
  25560. \___/_/\_\ .__/ \__,_|\__|
  25561. |_| XML parser
  25562. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  25563. Copyright (c) 2000-2017 Expat development team
  25564. Licensed under the MIT license:
  25565. Permission is hereby granted, free of charge, to any person obtaining
  25566. a copy of this software and associated documentation files (the
  25567. "Software"), to deal in the Software without restriction, including
  25568. without limitation the rights to use, copy, modify, merge, publish,
  25569. distribute, sublicense, and/or sell copies of the Software, and to permit
  25570. persons to whom the Software is furnished to do so, subject to the
  25571. following conditions:
  25572. The above copyright notice and this permission notice shall be included
  25573. in all copies or substantial portions of the Software.
  25574. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25575. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25576. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  25577. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  25578. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  25579. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  25580. USE OR OTHER DEALINGS IN THE SOFTWARE.
  25581. */
  25582. func XXmlGetUtf8InternalEncoding(tls *libc.TLS) (r uintptr) {
  25583. return uintptr(unsafe.Pointer(&_internal_utf8_encoding))
  25584. }
  25585. func XXmlGetUtf16InternalEncoding(tls *libc.TLS) (r uintptr) {
  25586. return uintptr(unsafe.Pointer(&_internal_big2_encoding))
  25587. }
  25588. var _encodings = [7]uintptr{
  25589. 0: uintptr(unsafe.Pointer(&_latin1_encoding)),
  25590. 1: uintptr(unsafe.Pointer(&_ascii_encoding)),
  25591. 2: uintptr(unsafe.Pointer(&_utf8_encoding)),
  25592. 3: uintptr(unsafe.Pointer(&_big2_encoding)),
  25593. 4: uintptr(unsafe.Pointer(&_big2_encoding)),
  25594. 5: uintptr(unsafe.Pointer(&_little2_encoding)),
  25595. 6: uintptr(unsafe.Pointer(&_utf8_encoding)),
  25596. }
  25597. func _initScanProlog(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25598. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  25599. }
  25600. func _initScanContent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25601. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  25602. }
  25603. func XXmlInitEncoding(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  25604. var i int32
  25605. _ = i
  25606. i = _getEncodingIndex(tls, name)
  25607. if i == int32(_UNKNOWN_ENC) {
  25608. return 0
  25609. }
  25610. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = libc.Uint8FromInt32(i)
  25611. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanProlog)
  25612. *(*TSCANNER)(unsafe.Pointer(p + 1*8)) = __ccgo_fp(_initScanContent)
  25613. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  25614. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  25615. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  25616. return int32(1)
  25617. }
  25618. func _findEncoding(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  25619. bp := tls.Alloc(144)
  25620. defer tls.Free(144)
  25621. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  25622. var i int32
  25623. var _ /* buf at bp+8 */ [128]uint8
  25624. var _ /* p at bp+136 */ uintptr
  25625. _ = i
  25626. *(*uintptr)(unsafe.Pointer(bp + 136)) = bp + 8
  25627. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+136, *(*uintptr)(unsafe.Pointer(bp + 136))+uintptr(m_ENCODING_MAX)-uintptr(1))
  25628. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  25629. return uintptr(0)
  25630. }
  25631. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136)))) = uint8(0)
  25632. if _streqci(tls, bp+8, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  25633. return enc
  25634. }
  25635. i = _getEncodingIndex(tls, bp+8)
  25636. if i == int32(_UNKNOWN_ENC) {
  25637. return uintptr(0)
  25638. }
  25639. return _encodings[i]
  25640. }
  25641. func XXmlParseXmlDecl(tls *libc.TLS, isGeneralTextEntity int32, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr, versionPtr uintptr, versionEndPtr uintptr, encodingName uintptr, encoding uintptr, standalone uintptr) (r int32) {
  25642. return _doParseXmlDecl(tls, __ccgo_fp(_findEncoding), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  25643. }
  25644. /* This file is included!
  25645. __ __ _
  25646. ___\ \/ /_ __ __ _| |_
  25647. / _ \\ /| '_ \ / _` | __|
  25648. | __// \| |_) | (_| | |_
  25649. \___/_/\_\ .__/ \__,_|\__|
  25650. |_| XML parser
  25651. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  25652. Copyright (c) 2000-2017 Expat development team
  25653. Licensed under the MIT license:
  25654. Permission is hereby granted, free of charge, to any person obtaining
  25655. a copy of this software and associated documentation files (the
  25656. "Software"), to deal in the Software without restriction, including
  25657. without limitation the rights to use, copy, modify, merge, publish,
  25658. distribute, sublicense, and/or sell copies of the Software, and to permit
  25659. persons to whom the Software is furnished to do so, subject to the
  25660. following conditions:
  25661. The above copyright notice and this permission notice shall be included
  25662. in all copies or substantial portions of the Software.
  25663. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25664. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25665. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  25666. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  25667. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  25668. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  25669. USE OR OTHER DEALINGS IN THE SOFTWARE.
  25670. */
  25671. func XXmlGetUtf8InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  25672. return uintptr(unsafe.Pointer(&_internal_utf8_encoding_ns))
  25673. }
  25674. func XXmlGetUtf16InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  25675. return uintptr(unsafe.Pointer(&_internal_big2_encoding_ns))
  25676. }
  25677. var _encodingsNS = [7]uintptr{
  25678. 0: uintptr(unsafe.Pointer(&_latin1_encoding_ns)),
  25679. 1: uintptr(unsafe.Pointer(&_ascii_encoding_ns)),
  25680. 2: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  25681. 3: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  25682. 4: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  25683. 5: uintptr(unsafe.Pointer(&_little2_encoding_ns)),
  25684. 6: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  25685. }
  25686. func _initScanPrologNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25687. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  25688. }
  25689. func _initScanContentNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25690. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  25691. }
  25692. func XXmlInitEncodingNS(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  25693. var i int32
  25694. _ = i
  25695. i = _getEncodingIndex(tls, name)
  25696. if i == int32(_UNKNOWN_ENC) {
  25697. return 0
  25698. }
  25699. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = libc.Uint8FromInt32(i)
  25700. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanPrologNS)
  25701. *(*TSCANNER)(unsafe.Pointer(p + 1*8)) = __ccgo_fp(_initScanContentNS)
  25702. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  25703. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  25704. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  25705. return int32(1)
  25706. }
  25707. func _findEncodingNS(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  25708. bp := tls.Alloc(144)
  25709. defer tls.Free(144)
  25710. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  25711. var i int32
  25712. var _ /* buf at bp+8 */ [128]uint8
  25713. var _ /* p at bp+136 */ uintptr
  25714. _ = i
  25715. *(*uintptr)(unsafe.Pointer(bp + 136)) = bp + 8
  25716. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+136, *(*uintptr)(unsafe.Pointer(bp + 136))+uintptr(m_ENCODING_MAX)-uintptr(1))
  25717. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  25718. return uintptr(0)
  25719. }
  25720. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136)))) = uint8(0)
  25721. if _streqci(tls, bp+8, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  25722. return enc
  25723. }
  25724. i = _getEncodingIndex(tls, bp+8)
  25725. if i == int32(_UNKNOWN_ENC) {
  25726. return uintptr(0)
  25727. }
  25728. return _encodingsNS[i]
  25729. }
  25730. func XXmlParseXmlDeclNS(tls *libc.TLS, isGeneralTextEntity int32, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr, versionPtr uintptr, versionEndPtr uintptr, encodingName uintptr, encoding uintptr, standalone uintptr) (r int32) {
  25731. return _doParseXmlDecl(tls, __ccgo_fp(_findEncodingNS), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  25732. }
  25733. func XXmlInitUnknownEncodingNS(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  25734. var enc uintptr
  25735. _ = enc
  25736. enc = XXmlInitUnknownEncoding(tls, mem, table, convert, userData)
  25737. if enc != 0 {
  25738. *(*uint8)(unsafe.Pointer(enc + 136 + 58)) = uint8(_BT_COLON)
  25739. }
  25740. return enc
  25741. }
  25742. const m_ASCII_01 = 0x30
  25743. const m_ASCII_11 = 0x31
  25744. const m_ASCII_21 = 0x32
  25745. const m_ASCII_31 = 0x33
  25746. const m_ASCII_42 = 0x34
  25747. const m_ASCII_52 = 0x35
  25748. const m_ASCII_62 = 0x36
  25749. const m_ASCII_72 = 0x37
  25750. const m_ASCII_81 = 0x38
  25751. const m_ASCII_91 = 0x39
  25752. const m_ASCII_AMP2 = 0x26
  25753. const m_ASCII_APOS2 = 0x27
  25754. const m_ASCII_COLON1 = 0x3A
  25755. const m_ASCII_EQUALS1 = 0x3D
  25756. const m_ASCII_EXCL1 = 0x21
  25757. const m_ASCII_G1 = 71
  25758. const m_ASCII_GT2 = 0x3E
  25759. const m_ASCII_K2 = 75
  25760. const m_ASCII_LSQB2 = 0x5B
  25761. const m_ASCII_LT2 = 0x3C
  25762. const m_ASCII_MINUS2 = 0x2D
  25763. const m_ASCII_N2 = 78
  25764. const m_ASCII_P1 = 80
  25765. const m_ASCII_PERIOD1 = 0x2E
  25766. const m_ASCII_Q1 = 81
  25767. const m_ASCII_QUOT2 = 0x22
  25768. const m_ASCII_R2 = 82
  25769. const m_ASCII_RSQB2 = 0x5D
  25770. const m_ASCII_SEMI2 = 0x3B
  25771. const m_ASCII_SPACE2 = 0x20
  25772. const m_ASCII_TAB2 = 0x09
  25773. const m_ASCII_UNDERSCORE2 = 0x5F
  25774. const m_ASCII_Y2 = 89
  25775. const m_ASCII_Z2 = 0x5A
  25776. const m_ASCII_a1 = 0x61
  25777. const m_ASCII_b2 = 0x62
  25778. const m_ASCII_c1 = 0x63
  25779. const m_ASCII_d2 = 0x64
  25780. const m_ASCII_e1 = 0x65
  25781. const m_ASCII_f2 = 0x66
  25782. const m_ASCII_g1 = 0x67
  25783. const m_ASCII_i2 = 0x69
  25784. const m_ASCII_l1 = 0x6C
  25785. const m_ASCII_m1 = 0x6D
  25786. const m_ASCII_n1 = 0x6E
  25787. const m_ASCII_o1 = 0x6F
  25788. const m_ASCII_p1 = 0x70
  25789. const m_ASCII_q2 = 0x71
  25790. const m_ASCII_r1 = 0x72
  25791. const m_ASCII_s1 = 0x73
  25792. const m_ASCII_t1 = 0x74
  25793. const m_ASCII_u2 = 0x75
  25794. const m_ASCII_v2 = 0x76
  25795. const m_ASCII_x1 = 0x78
  25796. const m_ASCII_y2 = 0x79
  25797. const m_ASCII_z2 = 0x7A
  25798. /*
  25799. __ __ _
  25800. ___\ \/ /_ __ __ _| |_
  25801. / _ \\ /| '_ \ / _` | __|
  25802. | __// \| |_) | (_| | |_
  25803. \___/_/\_\ .__/ \__,_|\__|
  25804. |_| XML parser
  25805. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  25806. Copyright (c) 2000-2017 Expat development team
  25807. Licensed under the MIT license:
  25808. Permission is hereby granted, free of charge, to any person obtaining
  25809. a copy of this software and associated documentation files (the
  25810. "Software"), to deal in the Software without restriction, including
  25811. without limitation the rights to use, copy, modify, merge, publish,
  25812. distribute, sublicense, and/or sell copies of the Software, and to permit
  25813. persons to whom the Software is furnished to do so, subject to the
  25814. following conditions:
  25815. The above copyright notice and this permission notice shall be included
  25816. in all copies or substantial portions of the Software.
  25817. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25818. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25819. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  25820. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  25821. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  25822. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  25823. USE OR OTHER DEALINGS IN THE SOFTWARE.
  25824. */
  25825. /* Doesn't check:
  25826. that ,| are not mixed in a model group
  25827. content of literals
  25828. */
  25829. var _KW_ANY = [4]uint8{
  25830. 0: uint8(m_ASCII_A),
  25831. 1: uint8(m_ASCII_N2),
  25832. 2: uint8(m_ASCII_Y2),
  25833. }
  25834. var _KW_ATTLIST = [8]uint8{
  25835. 0: uint8(m_ASCII_A),
  25836. 1: uint8(m_ASCII_T),
  25837. 2: uint8(m_ASCII_T),
  25838. 3: uint8(m_ASCII_L),
  25839. 4: uint8(m_ASCII_I),
  25840. 5: uint8(m_ASCII_S),
  25841. 6: uint8(m_ASCII_T),
  25842. }
  25843. var _KW_CDATA = [6]uint8{
  25844. 0: uint8(m_ASCII_C),
  25845. 1: uint8(m_ASCII_D),
  25846. 2: uint8(m_ASCII_A),
  25847. 3: uint8(m_ASCII_T),
  25848. 4: uint8(m_ASCII_A),
  25849. }
  25850. var _KW_DOCTYPE = [8]uint8{
  25851. 0: uint8(m_ASCII_D),
  25852. 1: uint8(m_ASCII_O),
  25853. 2: uint8(m_ASCII_C),
  25854. 3: uint8(m_ASCII_T),
  25855. 4: uint8(m_ASCII_Y2),
  25856. 5: uint8(m_ASCII_P1),
  25857. 6: uint8(m_ASCII_E),
  25858. }
  25859. var _KW_ELEMENT = [8]uint8{
  25860. 0: uint8(m_ASCII_E),
  25861. 1: uint8(m_ASCII_L),
  25862. 2: uint8(m_ASCII_E),
  25863. 3: uint8(m_ASCII_M),
  25864. 4: uint8(m_ASCII_E),
  25865. 5: uint8(m_ASCII_N2),
  25866. 6: uint8(m_ASCII_T),
  25867. }
  25868. var _KW_EMPTY = [6]uint8{
  25869. 0: uint8(m_ASCII_E),
  25870. 1: uint8(m_ASCII_M),
  25871. 2: uint8(m_ASCII_P1),
  25872. 3: uint8(m_ASCII_T),
  25873. 4: uint8(m_ASCII_Y2),
  25874. }
  25875. var _KW_ENTITIES = [9]uint8{
  25876. 0: uint8(m_ASCII_E),
  25877. 1: uint8(m_ASCII_N2),
  25878. 2: uint8(m_ASCII_T),
  25879. 3: uint8(m_ASCII_I),
  25880. 4: uint8(m_ASCII_T),
  25881. 5: uint8(m_ASCII_I),
  25882. 6: uint8(m_ASCII_E),
  25883. 7: uint8(m_ASCII_S),
  25884. }
  25885. var _KW_ENTITY = [7]uint8{
  25886. 0: uint8(m_ASCII_E),
  25887. 1: uint8(m_ASCII_N2),
  25888. 2: uint8(m_ASCII_T),
  25889. 3: uint8(m_ASCII_I),
  25890. 4: uint8(m_ASCII_T),
  25891. 5: uint8(m_ASCII_Y2),
  25892. }
  25893. var _KW_FIXED = [6]uint8{
  25894. 0: uint8(m_ASCII_F),
  25895. 1: uint8(m_ASCII_I),
  25896. 2: uint8(m_ASCII_X),
  25897. 3: uint8(m_ASCII_E),
  25898. 4: uint8(m_ASCII_D),
  25899. }
  25900. var _KW_ID = [3]uint8{
  25901. 0: uint8(m_ASCII_I),
  25902. 1: uint8(m_ASCII_D),
  25903. }
  25904. var _KW_IDREF = [6]uint8{
  25905. 0: uint8(m_ASCII_I),
  25906. 1: uint8(m_ASCII_D),
  25907. 2: uint8(m_ASCII_R2),
  25908. 3: uint8(m_ASCII_E),
  25909. 4: uint8(m_ASCII_F),
  25910. }
  25911. var _KW_IDREFS = [7]uint8{
  25912. 0: uint8(m_ASCII_I),
  25913. 1: uint8(m_ASCII_D),
  25914. 2: uint8(m_ASCII_R2),
  25915. 3: uint8(m_ASCII_E),
  25916. 4: uint8(m_ASCII_F),
  25917. 5: uint8(m_ASCII_S),
  25918. }
  25919. var _KW_IGNORE = [7]uint8{
  25920. 0: uint8(m_ASCII_I),
  25921. 1: uint8(m_ASCII_G1),
  25922. 2: uint8(m_ASCII_N2),
  25923. 3: uint8(m_ASCII_O),
  25924. 4: uint8(m_ASCII_R2),
  25925. 5: uint8(m_ASCII_E),
  25926. }
  25927. var _KW_IMPLIED = [8]uint8{
  25928. 0: uint8(m_ASCII_I),
  25929. 1: uint8(m_ASCII_M),
  25930. 2: uint8(m_ASCII_P1),
  25931. 3: uint8(m_ASCII_L),
  25932. 4: uint8(m_ASCII_I),
  25933. 5: uint8(m_ASCII_E),
  25934. 6: uint8(m_ASCII_D),
  25935. }
  25936. var _KW_INCLUDE = [8]uint8{
  25937. 0: uint8(m_ASCII_I),
  25938. 1: uint8(m_ASCII_N2),
  25939. 2: uint8(m_ASCII_C),
  25940. 3: uint8(m_ASCII_L),
  25941. 4: uint8(m_ASCII_U1),
  25942. 5: uint8(m_ASCII_D),
  25943. 6: uint8(m_ASCII_E),
  25944. }
  25945. var _KW_NDATA = [6]uint8{
  25946. 0: uint8(m_ASCII_N2),
  25947. 1: uint8(m_ASCII_D),
  25948. 2: uint8(m_ASCII_A),
  25949. 3: uint8(m_ASCII_T),
  25950. 4: uint8(m_ASCII_A),
  25951. }
  25952. var _KW_NMTOKEN = [8]uint8{
  25953. 0: uint8(m_ASCII_N2),
  25954. 1: uint8(m_ASCII_M),
  25955. 2: uint8(m_ASCII_T),
  25956. 3: uint8(m_ASCII_O),
  25957. 4: uint8(m_ASCII_K2),
  25958. 5: uint8(m_ASCII_E),
  25959. 6: uint8(m_ASCII_N2),
  25960. }
  25961. var _KW_NMTOKENS = [9]uint8{
  25962. 0: uint8(m_ASCII_N2),
  25963. 1: uint8(m_ASCII_M),
  25964. 2: uint8(m_ASCII_T),
  25965. 3: uint8(m_ASCII_O),
  25966. 4: uint8(m_ASCII_K2),
  25967. 5: uint8(m_ASCII_E),
  25968. 6: uint8(m_ASCII_N2),
  25969. 7: uint8(m_ASCII_S),
  25970. }
  25971. var _KW_NOTATION = [9]uint8{
  25972. 0: uint8(m_ASCII_N2),
  25973. 1: uint8(m_ASCII_O),
  25974. 2: uint8(m_ASCII_T),
  25975. 3: uint8(m_ASCII_A),
  25976. 4: uint8(m_ASCII_T),
  25977. 5: uint8(m_ASCII_I),
  25978. 6: uint8(m_ASCII_O),
  25979. 7: uint8(m_ASCII_N2),
  25980. }
  25981. var _KW_PCDATA = [7]uint8{
  25982. 0: uint8(m_ASCII_P1),
  25983. 1: uint8(m_ASCII_C),
  25984. 2: uint8(m_ASCII_D),
  25985. 3: uint8(m_ASCII_A),
  25986. 4: uint8(m_ASCII_T),
  25987. 5: uint8(m_ASCII_A),
  25988. }
  25989. var _KW_PUBLIC = [7]uint8{
  25990. 0: uint8(m_ASCII_P1),
  25991. 1: uint8(m_ASCII_U1),
  25992. 2: uint8(m_ASCII_B1),
  25993. 3: uint8(m_ASCII_L),
  25994. 4: uint8(m_ASCII_I),
  25995. 5: uint8(m_ASCII_C),
  25996. }
  25997. var _KW_REQUIRED = [9]uint8{
  25998. 0: uint8(m_ASCII_R2),
  25999. 1: uint8(m_ASCII_E),
  26000. 2: uint8(m_ASCII_Q1),
  26001. 3: uint8(m_ASCII_U1),
  26002. 4: uint8(m_ASCII_I),
  26003. 5: uint8(m_ASCII_R2),
  26004. 6: uint8(m_ASCII_E),
  26005. 7: uint8(m_ASCII_D),
  26006. }
  26007. var _KW_SYSTEM = [7]uint8{
  26008. 0: uint8(m_ASCII_S),
  26009. 1: uint8(m_ASCII_Y2),
  26010. 2: uint8(m_ASCII_S),
  26011. 3: uint8(m_ASCII_T),
  26012. 4: uint8(m_ASCII_E),
  26013. 5: uint8(m_ASCII_M),
  26014. }
  26015. func _prolog0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26016. switch tok {
  26017. case int32(m_XML_TOK_PROLOG_S):
  26018. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  26019. return int32(_XML_ROLE_NONE)
  26020. case int32(m_XML_TOK_XML_DECL):
  26021. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  26022. return int32(_XML_ROLE_XML_DECL)
  26023. case int32(m_XML_TOK_PI):
  26024. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  26025. return int32(_XML_ROLE_PI)
  26026. case int32(m_XML_TOK_COMMENT):
  26027. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  26028. return int32(_XML_ROLE_COMMENT)
  26029. case int32(m_XML_TOK_BOM):
  26030. return int32(_XML_ROLE_NONE)
  26031. case int32(m_XML_TOK_DECL_OPEN):
  26032. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr(int32(2)*(*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_DOCTYPE))) != 0) {
  26033. break
  26034. }
  26035. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  26036. return int32(_XML_ROLE_DOCTYPE_NONE)
  26037. case int32(m_XML_TOK_INSTANCE_START):
  26038. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  26039. return int32(_XML_ROLE_INSTANCE_START)
  26040. }
  26041. return _common(tls, state, tok)
  26042. }
  26043. func _prolog1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26044. switch tok {
  26045. case int32(m_XML_TOK_PROLOG_S):
  26046. return int32(_XML_ROLE_NONE)
  26047. case int32(m_XML_TOK_PI):
  26048. return int32(_XML_ROLE_PI)
  26049. case int32(m_XML_TOK_COMMENT):
  26050. return int32(_XML_ROLE_COMMENT)
  26051. case int32(m_XML_TOK_BOM):
  26052. /* This case can never arise. To reach this role function, the
  26053. * parse must have passed through prolog0 and therefore have had
  26054. * some form of input, even if only a space. At that point, a
  26055. * byte order mark is no longer a valid character (though
  26056. * technically it should be interpreted as a non-breaking space),
  26057. * so will be rejected by the tokenizing stages.
  26058. */
  26059. return int32(_XML_ROLE_NONE) /* LCOV_EXCL_LINE */
  26060. case int32(m_XML_TOK_DECL_OPEN):
  26061. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr(int32(2)*(*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_DOCTYPE))) != 0) {
  26062. break
  26063. }
  26064. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  26065. return int32(_XML_ROLE_DOCTYPE_NONE)
  26066. case int32(m_XML_TOK_INSTANCE_START):
  26067. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  26068. return int32(_XML_ROLE_INSTANCE_START)
  26069. }
  26070. return _common(tls, state, tok)
  26071. }
  26072. func _prolog2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26073. _ = ptr
  26074. _ = end
  26075. _ = enc
  26076. switch tok {
  26077. case int32(m_XML_TOK_PROLOG_S):
  26078. return int32(_XML_ROLE_NONE)
  26079. case int32(m_XML_TOK_PI):
  26080. return int32(_XML_ROLE_PI)
  26081. case int32(m_XML_TOK_COMMENT):
  26082. return int32(_XML_ROLE_COMMENT)
  26083. case int32(m_XML_TOK_INSTANCE_START):
  26084. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  26085. return int32(_XML_ROLE_INSTANCE_START)
  26086. }
  26087. return _common(tls, state, tok)
  26088. }
  26089. func _doctype0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26090. _ = ptr
  26091. _ = end
  26092. _ = enc
  26093. switch tok {
  26094. case int32(m_XML_TOK_PROLOG_S):
  26095. return int32(_XML_ROLE_DOCTYPE_NONE)
  26096. case int32(m_XML_TOK_NAME):
  26097. fallthrough
  26098. case int32(m_XML_TOK_PREFIXED_NAME):
  26099. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype1)
  26100. return int32(_XML_ROLE_DOCTYPE_NAME)
  26101. }
  26102. return _common(tls, state, tok)
  26103. }
  26104. func _doctype1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26105. switch tok {
  26106. case int32(m_XML_TOK_PROLOG_S):
  26107. return int32(_XML_ROLE_DOCTYPE_NONE)
  26108. case int32(m_XML_TOK_OPEN_BRACKET):
  26109. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  26110. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  26111. case int32(m_XML_TOK_DECL_CLOSE):
  26112. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  26113. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  26114. case int32(m_XML_TOK_NAME):
  26115. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_SYSTEM))) != 0 {
  26116. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  26117. return int32(_XML_ROLE_DOCTYPE_NONE)
  26118. }
  26119. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_PUBLIC))) != 0 {
  26120. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype2)
  26121. return int32(_XML_ROLE_DOCTYPE_NONE)
  26122. }
  26123. break
  26124. }
  26125. return _common(tls, state, tok)
  26126. }
  26127. func _doctype2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26128. _ = ptr
  26129. _ = end
  26130. _ = enc
  26131. switch tok {
  26132. case int32(m_XML_TOK_PROLOG_S):
  26133. return int32(_XML_ROLE_DOCTYPE_NONE)
  26134. case int32(m_XML_TOK_LITERAL):
  26135. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  26136. return int32(_XML_ROLE_DOCTYPE_PUBLIC_ID)
  26137. }
  26138. return _common(tls, state, tok)
  26139. }
  26140. func _doctype3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26141. _ = ptr
  26142. _ = end
  26143. _ = enc
  26144. switch tok {
  26145. case int32(m_XML_TOK_PROLOG_S):
  26146. return int32(_XML_ROLE_DOCTYPE_NONE)
  26147. case int32(m_XML_TOK_LITERAL):
  26148. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype4)
  26149. return int32(_XML_ROLE_DOCTYPE_SYSTEM_ID)
  26150. }
  26151. return _common(tls, state, tok)
  26152. }
  26153. func _doctype4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26154. _ = ptr
  26155. _ = end
  26156. _ = enc
  26157. switch tok {
  26158. case int32(m_XML_TOK_PROLOG_S):
  26159. return int32(_XML_ROLE_DOCTYPE_NONE)
  26160. case int32(m_XML_TOK_OPEN_BRACKET):
  26161. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  26162. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  26163. case int32(m_XML_TOK_DECL_CLOSE):
  26164. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  26165. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  26166. }
  26167. return _common(tls, state, tok)
  26168. }
  26169. func _doctype5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26170. _ = ptr
  26171. _ = end
  26172. _ = enc
  26173. switch tok {
  26174. case int32(m_XML_TOK_PROLOG_S):
  26175. return int32(_XML_ROLE_DOCTYPE_NONE)
  26176. case int32(m_XML_TOK_DECL_CLOSE):
  26177. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  26178. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  26179. }
  26180. return _common(tls, state, tok)
  26181. }
  26182. func _internalSubset(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26183. switch tok {
  26184. case int32(m_XML_TOK_PROLOG_S):
  26185. return int32(_XML_ROLE_NONE)
  26186. case int32(m_XML_TOK_DECL_OPEN):
  26187. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr(int32(2)*(*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_ENTITY))) != 0 {
  26188. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity0)
  26189. return int32(_XML_ROLE_ENTITY_NONE)
  26190. }
  26191. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr(int32(2)*(*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_ATTLIST))) != 0 {
  26192. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist0)
  26193. return int32(_XML_ROLE_ATTLIST_NONE)
  26194. }
  26195. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr(int32(2)*(*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_ELEMENT))) != 0 {
  26196. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element0)
  26197. return int32(_XML_ROLE_ELEMENT_NONE)
  26198. }
  26199. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr(int32(2)*(*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_NOTATION))) != 0 {
  26200. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation0)
  26201. return int32(_XML_ROLE_NOTATION_NONE)
  26202. }
  26203. case int32(m_XML_TOK_PI):
  26204. return int32(_XML_ROLE_PI)
  26205. case int32(m_XML_TOK_COMMENT):
  26206. return int32(_XML_ROLE_COMMENT)
  26207. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  26208. return int32(_XML_ROLE_PARAM_ENTITY_REF)
  26209. case int32(m_XML_TOK_CLOSE_BRACKET):
  26210. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype5)
  26211. return int32(_XML_ROLE_DOCTYPE_NONE)
  26212. case -int32(4):
  26213. return int32(_XML_ROLE_NONE)
  26214. }
  26215. return _common(tls, state, tok)
  26216. }
  26217. func _externalSubset0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26218. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  26219. if tok == int32(m_XML_TOK_XML_DECL) {
  26220. return int32(_XML_ROLE_TEXT_DECL)
  26221. }
  26222. return _externalSubset1(tls, state, tok, ptr, end, enc)
  26223. }
  26224. func _externalSubset1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26225. switch tok {
  26226. case int32(m_XML_TOK_COND_SECT_OPEN):
  26227. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect0)
  26228. return int32(_XML_ROLE_NONE)
  26229. case int32(m_XML_TOK_COND_SECT_CLOSE):
  26230. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel == uint32(0) {
  26231. break
  26232. }
  26233. *(*uint32)(unsafe.Pointer(state + 16)) -= uint32(1)
  26234. return int32(_XML_ROLE_NONE)
  26235. case int32(m_XML_TOK_PROLOG_S):
  26236. return int32(_XML_ROLE_NONE)
  26237. case int32(m_XML_TOK_CLOSE_BRACKET):
  26238. case -int32(4):
  26239. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel != 0 {
  26240. break
  26241. }
  26242. return int32(_XML_ROLE_NONE)
  26243. default:
  26244. return _internalSubset(tls, state, tok, ptr, end, enc)
  26245. }
  26246. return _common(tls, state, tok)
  26247. }
  26248. func _entity0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26249. _ = ptr
  26250. _ = end
  26251. _ = enc
  26252. switch tok {
  26253. case int32(m_XML_TOK_PROLOG_S):
  26254. return int32(_XML_ROLE_ENTITY_NONE)
  26255. case int32(m_XML_TOK_PERCENT):
  26256. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity1)
  26257. return int32(_XML_ROLE_ENTITY_NONE)
  26258. case int32(m_XML_TOK_NAME):
  26259. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity2)
  26260. return int32(_XML_ROLE_GENERAL_ENTITY_NAME)
  26261. }
  26262. return _common(tls, state, tok)
  26263. }
  26264. func _entity1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26265. _ = ptr
  26266. _ = end
  26267. _ = enc
  26268. switch tok {
  26269. case int32(m_XML_TOK_PROLOG_S):
  26270. return int32(_XML_ROLE_ENTITY_NONE)
  26271. case int32(m_XML_TOK_NAME):
  26272. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity7)
  26273. return int32(_XML_ROLE_PARAM_ENTITY_NAME)
  26274. }
  26275. return _common(tls, state, tok)
  26276. }
  26277. func _entity2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26278. switch tok {
  26279. case int32(m_XML_TOK_PROLOG_S):
  26280. return int32(_XML_ROLE_ENTITY_NONE)
  26281. case int32(m_XML_TOK_NAME):
  26282. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_SYSTEM))) != 0 {
  26283. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  26284. return int32(_XML_ROLE_ENTITY_NONE)
  26285. }
  26286. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_PUBLIC))) != 0 {
  26287. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity3)
  26288. return int32(_XML_ROLE_ENTITY_NONE)
  26289. }
  26290. case int32(m_XML_TOK_LITERAL):
  26291. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26292. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  26293. return int32(_XML_ROLE_ENTITY_VALUE)
  26294. }
  26295. return _common(tls, state, tok)
  26296. }
  26297. func _entity3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26298. _ = ptr
  26299. _ = end
  26300. _ = enc
  26301. switch tok {
  26302. case int32(m_XML_TOK_PROLOG_S):
  26303. return int32(_XML_ROLE_ENTITY_NONE)
  26304. case int32(m_XML_TOK_LITERAL):
  26305. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  26306. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  26307. }
  26308. return _common(tls, state, tok)
  26309. }
  26310. func _entity4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26311. _ = ptr
  26312. _ = end
  26313. _ = enc
  26314. switch tok {
  26315. case int32(m_XML_TOK_PROLOG_S):
  26316. return int32(_XML_ROLE_ENTITY_NONE)
  26317. case int32(m_XML_TOK_LITERAL):
  26318. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity5)
  26319. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  26320. }
  26321. return _common(tls, state, tok)
  26322. }
  26323. func _entity5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26324. var v1 uintptr
  26325. _ = v1
  26326. switch tok {
  26327. case int32(m_XML_TOK_PROLOG_S):
  26328. return int32(_XML_ROLE_ENTITY_NONE)
  26329. case int32(m_XML_TOK_DECL_CLOSE):
  26330. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  26331. v1 = __ccgo_fp(_internalSubset)
  26332. } else {
  26333. v1 = __ccgo_fp(_externalSubset1)
  26334. }
  26335. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  26336. return int32(_XML_ROLE_ENTITY_COMPLETE)
  26337. case int32(m_XML_TOK_NAME):
  26338. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_NDATA))) != 0 {
  26339. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity6)
  26340. return int32(_XML_ROLE_ENTITY_NONE)
  26341. }
  26342. break
  26343. }
  26344. return _common(tls, state, tok)
  26345. }
  26346. func _entity6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26347. _ = ptr
  26348. _ = end
  26349. _ = enc
  26350. switch tok {
  26351. case int32(m_XML_TOK_PROLOG_S):
  26352. return int32(_XML_ROLE_ENTITY_NONE)
  26353. case int32(m_XML_TOK_NAME):
  26354. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26355. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  26356. return int32(_XML_ROLE_ENTITY_NOTATION_NAME)
  26357. }
  26358. return _common(tls, state, tok)
  26359. }
  26360. func _entity7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26361. switch tok {
  26362. case int32(m_XML_TOK_PROLOG_S):
  26363. return int32(_XML_ROLE_ENTITY_NONE)
  26364. case int32(m_XML_TOK_NAME):
  26365. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_SYSTEM))) != 0 {
  26366. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  26367. return int32(_XML_ROLE_ENTITY_NONE)
  26368. }
  26369. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_PUBLIC))) != 0 {
  26370. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity8)
  26371. return int32(_XML_ROLE_ENTITY_NONE)
  26372. }
  26373. case int32(m_XML_TOK_LITERAL):
  26374. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26375. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  26376. return int32(_XML_ROLE_ENTITY_VALUE)
  26377. }
  26378. return _common(tls, state, tok)
  26379. }
  26380. func _entity8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26381. _ = ptr
  26382. _ = end
  26383. _ = enc
  26384. switch tok {
  26385. case int32(m_XML_TOK_PROLOG_S):
  26386. return int32(_XML_ROLE_ENTITY_NONE)
  26387. case int32(m_XML_TOK_LITERAL):
  26388. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  26389. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  26390. }
  26391. return _common(tls, state, tok)
  26392. }
  26393. func _entity9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26394. _ = ptr
  26395. _ = end
  26396. _ = enc
  26397. switch tok {
  26398. case int32(m_XML_TOK_PROLOG_S):
  26399. return int32(_XML_ROLE_ENTITY_NONE)
  26400. case int32(m_XML_TOK_LITERAL):
  26401. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity10)
  26402. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  26403. }
  26404. return _common(tls, state, tok)
  26405. }
  26406. func _entity10(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26407. var v1 uintptr
  26408. _ = v1
  26409. _ = ptr
  26410. _ = end
  26411. _ = enc
  26412. switch tok {
  26413. case int32(m_XML_TOK_PROLOG_S):
  26414. return int32(_XML_ROLE_ENTITY_NONE)
  26415. case int32(m_XML_TOK_DECL_CLOSE):
  26416. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  26417. v1 = __ccgo_fp(_internalSubset)
  26418. } else {
  26419. v1 = __ccgo_fp(_externalSubset1)
  26420. }
  26421. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  26422. return int32(_XML_ROLE_ENTITY_COMPLETE)
  26423. }
  26424. return _common(tls, state, tok)
  26425. }
  26426. func _notation0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26427. _ = ptr
  26428. _ = end
  26429. _ = enc
  26430. switch tok {
  26431. case int32(m_XML_TOK_PROLOG_S):
  26432. return int32(_XML_ROLE_NOTATION_NONE)
  26433. case int32(m_XML_TOK_NAME):
  26434. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation1)
  26435. return int32(_XML_ROLE_NOTATION_NAME)
  26436. }
  26437. return _common(tls, state, tok)
  26438. }
  26439. func _notation1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26440. switch tok {
  26441. case int32(m_XML_TOK_PROLOG_S):
  26442. return int32(_XML_ROLE_NOTATION_NONE)
  26443. case int32(m_XML_TOK_NAME):
  26444. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_SYSTEM))) != 0 {
  26445. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation3)
  26446. return int32(_XML_ROLE_NOTATION_NONE)
  26447. }
  26448. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_PUBLIC))) != 0 {
  26449. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation2)
  26450. return int32(_XML_ROLE_NOTATION_NONE)
  26451. }
  26452. break
  26453. }
  26454. return _common(tls, state, tok)
  26455. }
  26456. func _notation2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26457. _ = ptr
  26458. _ = end
  26459. _ = enc
  26460. switch tok {
  26461. case int32(m_XML_TOK_PROLOG_S):
  26462. return int32(_XML_ROLE_NOTATION_NONE)
  26463. case int32(m_XML_TOK_LITERAL):
  26464. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation4)
  26465. return int32(_XML_ROLE_NOTATION_PUBLIC_ID)
  26466. }
  26467. return _common(tls, state, tok)
  26468. }
  26469. func _notation3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26470. _ = ptr
  26471. _ = end
  26472. _ = enc
  26473. switch tok {
  26474. case int32(m_XML_TOK_PROLOG_S):
  26475. return int32(_XML_ROLE_NOTATION_NONE)
  26476. case int32(m_XML_TOK_LITERAL):
  26477. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26478. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  26479. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  26480. }
  26481. return _common(tls, state, tok)
  26482. }
  26483. func _notation4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26484. var v1 uintptr
  26485. _ = v1
  26486. _ = ptr
  26487. _ = end
  26488. _ = enc
  26489. switch tok {
  26490. case int32(m_XML_TOK_PROLOG_S):
  26491. return int32(_XML_ROLE_NOTATION_NONE)
  26492. case int32(m_XML_TOK_LITERAL):
  26493. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26494. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  26495. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  26496. case int32(m_XML_TOK_DECL_CLOSE):
  26497. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  26498. v1 = __ccgo_fp(_internalSubset)
  26499. } else {
  26500. v1 = __ccgo_fp(_externalSubset1)
  26501. }
  26502. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  26503. return int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID)
  26504. }
  26505. return _common(tls, state, tok)
  26506. }
  26507. func _attlist0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26508. _ = ptr
  26509. _ = end
  26510. _ = enc
  26511. switch tok {
  26512. case int32(m_XML_TOK_PROLOG_S):
  26513. return int32(_XML_ROLE_ATTLIST_NONE)
  26514. case int32(m_XML_TOK_NAME):
  26515. fallthrough
  26516. case int32(m_XML_TOK_PREFIXED_NAME):
  26517. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  26518. return int32(_XML_ROLE_ATTLIST_ELEMENT_NAME)
  26519. }
  26520. return _common(tls, state, tok)
  26521. }
  26522. func _attlist1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26523. var v1 uintptr
  26524. _ = v1
  26525. _ = ptr
  26526. _ = end
  26527. _ = enc
  26528. switch tok {
  26529. case int32(m_XML_TOK_PROLOG_S):
  26530. return int32(_XML_ROLE_ATTLIST_NONE)
  26531. case int32(m_XML_TOK_DECL_CLOSE):
  26532. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  26533. v1 = __ccgo_fp(_internalSubset)
  26534. } else {
  26535. v1 = __ccgo_fp(_externalSubset1)
  26536. }
  26537. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  26538. return int32(_XML_ROLE_ATTLIST_NONE)
  26539. case int32(m_XML_TOK_NAME):
  26540. fallthrough
  26541. case int32(m_XML_TOK_PREFIXED_NAME):
  26542. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist2)
  26543. return int32(_XML_ROLE_ATTRIBUTE_NAME)
  26544. }
  26545. return _common(tls, state, tok)
  26546. }
  26547. func _attlist2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26548. var i int32
  26549. _ = i
  26550. switch tok {
  26551. case int32(m_XML_TOK_PROLOG_S):
  26552. return int32(_XML_ROLE_ATTLIST_NONE)
  26553. case int32(m_XML_TOK_NAME):
  26554. i = 0
  26555. for {
  26556. if !(i < libc.Int32FromUint64(libc.Uint64FromInt64(64)/libc.Uint64FromInt64(8))) {
  26557. break
  26558. }
  26559. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, _types[i]) != 0 {
  26560. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  26561. return int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA) + i
  26562. }
  26563. goto _1
  26564. _1:
  26565. ;
  26566. i++
  26567. }
  26568. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_NOTATION))) != 0 {
  26569. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist5)
  26570. return int32(_XML_ROLE_ATTLIST_NONE)
  26571. }
  26572. case int32(m_XML_TOK_OPEN_PAREN):
  26573. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  26574. return int32(_XML_ROLE_ATTLIST_NONE)
  26575. }
  26576. return _common(tls, state, tok)
  26577. }
  26578. var _types = [8]uintptr{
  26579. 0: uintptr(unsafe.Pointer(&_KW_CDATA)),
  26580. 1: uintptr(unsafe.Pointer(&_KW_ID)),
  26581. 2: uintptr(unsafe.Pointer(&_KW_IDREF)),
  26582. 3: uintptr(unsafe.Pointer(&_KW_IDREFS)),
  26583. 4: uintptr(unsafe.Pointer(&_KW_ENTITY)),
  26584. 5: uintptr(unsafe.Pointer(&_KW_ENTITIES)),
  26585. 6: uintptr(unsafe.Pointer(&_KW_NMTOKEN)),
  26586. 7: uintptr(unsafe.Pointer(&_KW_NMTOKENS)),
  26587. }
  26588. func _attlist3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26589. _ = ptr
  26590. _ = end
  26591. _ = enc
  26592. switch tok {
  26593. case int32(m_XML_TOK_PROLOG_S):
  26594. return int32(_XML_ROLE_ATTLIST_NONE)
  26595. case int32(m_XML_TOK_NMTOKEN):
  26596. fallthrough
  26597. case int32(m_XML_TOK_NAME):
  26598. fallthrough
  26599. case int32(m_XML_TOK_PREFIXED_NAME):
  26600. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist4)
  26601. return int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE)
  26602. }
  26603. return _common(tls, state, tok)
  26604. }
  26605. func _attlist4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26606. _ = ptr
  26607. _ = end
  26608. _ = enc
  26609. switch tok {
  26610. case int32(m_XML_TOK_PROLOG_S):
  26611. return int32(_XML_ROLE_ATTLIST_NONE)
  26612. case int32(m_XML_TOK_CLOSE_PAREN):
  26613. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  26614. return int32(_XML_ROLE_ATTLIST_NONE)
  26615. case int32(m_XML_TOK_OR):
  26616. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  26617. return int32(_XML_ROLE_ATTLIST_NONE)
  26618. }
  26619. return _common(tls, state, tok)
  26620. }
  26621. func _attlist5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26622. _ = ptr
  26623. _ = end
  26624. _ = enc
  26625. switch tok {
  26626. case int32(m_XML_TOK_PROLOG_S):
  26627. return int32(_XML_ROLE_ATTLIST_NONE)
  26628. case int32(m_XML_TOK_OPEN_PAREN):
  26629. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  26630. return int32(_XML_ROLE_ATTLIST_NONE)
  26631. }
  26632. return _common(tls, state, tok)
  26633. }
  26634. func _attlist6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26635. _ = ptr
  26636. _ = end
  26637. _ = enc
  26638. switch tok {
  26639. case int32(m_XML_TOK_PROLOG_S):
  26640. return int32(_XML_ROLE_ATTLIST_NONE)
  26641. case int32(m_XML_TOK_NAME):
  26642. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist7)
  26643. return int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE)
  26644. }
  26645. return _common(tls, state, tok)
  26646. }
  26647. func _attlist7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26648. _ = ptr
  26649. _ = end
  26650. _ = enc
  26651. switch tok {
  26652. case int32(m_XML_TOK_PROLOG_S):
  26653. return int32(_XML_ROLE_ATTLIST_NONE)
  26654. case int32(m_XML_TOK_CLOSE_PAREN):
  26655. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  26656. return int32(_XML_ROLE_ATTLIST_NONE)
  26657. case int32(m_XML_TOK_OR):
  26658. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  26659. return int32(_XML_ROLE_ATTLIST_NONE)
  26660. }
  26661. return _common(tls, state, tok)
  26662. }
  26663. // C documentation
  26664. //
  26665. // /* default value */
  26666. func _attlist8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26667. switch tok {
  26668. case int32(m_XML_TOK_PROLOG_S):
  26669. return int32(_XML_ROLE_ATTLIST_NONE)
  26670. case int32(m_XML_TOK_POUND_NAME):
  26671. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_IMPLIED))) != 0 {
  26672. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  26673. return int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE)
  26674. }
  26675. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_REQUIRED))) != 0 {
  26676. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  26677. return int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE)
  26678. }
  26679. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_FIXED))) != 0 {
  26680. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist9)
  26681. return int32(_XML_ROLE_ATTLIST_NONE)
  26682. }
  26683. case int32(m_XML_TOK_LITERAL):
  26684. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  26685. return int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE)
  26686. }
  26687. return _common(tls, state, tok)
  26688. }
  26689. func _attlist9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26690. _ = ptr
  26691. _ = end
  26692. _ = enc
  26693. switch tok {
  26694. case int32(m_XML_TOK_PROLOG_S):
  26695. return int32(_XML_ROLE_ATTLIST_NONE)
  26696. case int32(m_XML_TOK_LITERAL):
  26697. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  26698. return int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE)
  26699. }
  26700. return _common(tls, state, tok)
  26701. }
  26702. func _element0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26703. _ = ptr
  26704. _ = end
  26705. _ = enc
  26706. switch tok {
  26707. case int32(m_XML_TOK_PROLOG_S):
  26708. return int32(_XML_ROLE_ELEMENT_NONE)
  26709. case int32(m_XML_TOK_NAME):
  26710. fallthrough
  26711. case int32(m_XML_TOK_PREFIXED_NAME):
  26712. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element1)
  26713. return int32(_XML_ROLE_ELEMENT_NAME)
  26714. }
  26715. return _common(tls, state, tok)
  26716. }
  26717. func _element1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26718. switch tok {
  26719. case int32(m_XML_TOK_PROLOG_S):
  26720. return int32(_XML_ROLE_ELEMENT_NONE)
  26721. case int32(m_XML_TOK_NAME):
  26722. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_EMPTY))) != 0 {
  26723. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26724. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26725. return int32(_XML_ROLE_CONTENT_EMPTY)
  26726. }
  26727. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_ANY))) != 0 {
  26728. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26729. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26730. return int32(_XML_ROLE_CONTENT_ANY)
  26731. }
  26732. case int32(m_XML_TOK_OPEN_PAREN):
  26733. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element2)
  26734. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(1)
  26735. return int32(_XML_ROLE_GROUP_OPEN)
  26736. }
  26737. return _common(tls, state, tok)
  26738. }
  26739. func _element2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26740. switch tok {
  26741. case int32(m_XML_TOK_PROLOG_S):
  26742. return int32(_XML_ROLE_ELEMENT_NONE)
  26743. case int32(m_XML_TOK_POUND_NAME):
  26744. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_PCDATA))) != 0 {
  26745. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element3)
  26746. return int32(_XML_ROLE_CONTENT_PCDATA)
  26747. }
  26748. case int32(m_XML_TOK_OPEN_PAREN):
  26749. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(2)
  26750. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  26751. return int32(_XML_ROLE_GROUP_OPEN)
  26752. case int32(m_XML_TOK_NAME):
  26753. fallthrough
  26754. case int32(m_XML_TOK_PREFIXED_NAME):
  26755. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  26756. return int32(_XML_ROLE_CONTENT_ELEMENT)
  26757. case int32(m_XML_TOK_NAME_QUESTION):
  26758. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  26759. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  26760. case int32(m_XML_TOK_NAME_ASTERISK):
  26761. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  26762. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  26763. case int32(m_XML_TOK_NAME_PLUS):
  26764. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  26765. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  26766. }
  26767. return _common(tls, state, tok)
  26768. }
  26769. func _element3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26770. _ = ptr
  26771. _ = end
  26772. _ = enc
  26773. switch tok {
  26774. case int32(m_XML_TOK_PROLOG_S):
  26775. return int32(_XML_ROLE_ELEMENT_NONE)
  26776. case int32(m_XML_TOK_CLOSE_PAREN):
  26777. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26778. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26779. return int32(_XML_ROLE_GROUP_CLOSE)
  26780. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  26781. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26782. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26783. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  26784. case int32(m_XML_TOK_OR):
  26785. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  26786. return int32(_XML_ROLE_ELEMENT_NONE)
  26787. }
  26788. return _common(tls, state, tok)
  26789. }
  26790. func _element4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26791. _ = ptr
  26792. _ = end
  26793. _ = enc
  26794. switch tok {
  26795. case int32(m_XML_TOK_PROLOG_S):
  26796. return int32(_XML_ROLE_ELEMENT_NONE)
  26797. case int32(m_XML_TOK_NAME):
  26798. fallthrough
  26799. case int32(m_XML_TOK_PREFIXED_NAME):
  26800. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element5)
  26801. return int32(_XML_ROLE_CONTENT_ELEMENT)
  26802. }
  26803. return _common(tls, state, tok)
  26804. }
  26805. func _element5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26806. _ = ptr
  26807. _ = end
  26808. _ = enc
  26809. switch tok {
  26810. case int32(m_XML_TOK_PROLOG_S):
  26811. return int32(_XML_ROLE_ELEMENT_NONE)
  26812. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  26813. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26814. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26815. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  26816. case int32(m_XML_TOK_OR):
  26817. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  26818. return int32(_XML_ROLE_ELEMENT_NONE)
  26819. }
  26820. return _common(tls, state, tok)
  26821. }
  26822. func _element6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26823. _ = ptr
  26824. _ = end
  26825. _ = enc
  26826. switch tok {
  26827. case int32(m_XML_TOK_PROLOG_S):
  26828. return int32(_XML_ROLE_ELEMENT_NONE)
  26829. case int32(m_XML_TOK_OPEN_PAREN):
  26830. *(*uint32)(unsafe.Pointer(state + 8)) += uint32(1)
  26831. return int32(_XML_ROLE_GROUP_OPEN)
  26832. case int32(m_XML_TOK_NAME):
  26833. fallthrough
  26834. case int32(m_XML_TOK_PREFIXED_NAME):
  26835. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  26836. return int32(_XML_ROLE_CONTENT_ELEMENT)
  26837. case int32(m_XML_TOK_NAME_QUESTION):
  26838. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  26839. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  26840. case int32(m_XML_TOK_NAME_ASTERISK):
  26841. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  26842. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  26843. case int32(m_XML_TOK_NAME_PLUS):
  26844. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  26845. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  26846. }
  26847. return _common(tls, state, tok)
  26848. }
  26849. func _element7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26850. _ = ptr
  26851. _ = end
  26852. _ = enc
  26853. switch tok {
  26854. case int32(m_XML_TOK_PROLOG_S):
  26855. return int32(_XML_ROLE_ELEMENT_NONE)
  26856. case int32(m_XML_TOK_CLOSE_PAREN):
  26857. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  26858. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  26859. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26860. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26861. }
  26862. return int32(_XML_ROLE_GROUP_CLOSE)
  26863. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  26864. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  26865. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  26866. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26867. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26868. }
  26869. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  26870. case int32(m_XML_TOK_CLOSE_PAREN_QUESTION):
  26871. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  26872. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  26873. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26874. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26875. }
  26876. return int32(_XML_ROLE_GROUP_CLOSE_OPT)
  26877. case int32(m_XML_TOK_CLOSE_PAREN_PLUS):
  26878. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  26879. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  26880. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26881. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26882. }
  26883. return int32(_XML_ROLE_GROUP_CLOSE_PLUS)
  26884. case int32(m_XML_TOK_COMMA):
  26885. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  26886. return int32(_XML_ROLE_GROUP_SEQUENCE)
  26887. case int32(m_XML_TOK_OR):
  26888. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  26889. return int32(_XML_ROLE_GROUP_CHOICE)
  26890. }
  26891. return _common(tls, state, tok)
  26892. }
  26893. func _condSect0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26894. switch tok {
  26895. case int32(m_XML_TOK_PROLOG_S):
  26896. return int32(_XML_ROLE_NONE)
  26897. case int32(m_XML_TOK_NAME):
  26898. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_INCLUDE))) != 0 {
  26899. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect1)
  26900. return int32(_XML_ROLE_NONE)
  26901. }
  26902. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_IGNORE))) != 0 {
  26903. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect2)
  26904. return int32(_XML_ROLE_NONE)
  26905. }
  26906. break
  26907. }
  26908. return _common(tls, state, tok)
  26909. }
  26910. func _condSect1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26911. _ = ptr
  26912. _ = end
  26913. _ = enc
  26914. switch tok {
  26915. case int32(m_XML_TOK_PROLOG_S):
  26916. return int32(_XML_ROLE_NONE)
  26917. case int32(m_XML_TOK_OPEN_BRACKET):
  26918. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  26919. *(*uint32)(unsafe.Pointer(state + 16)) += uint32(1)
  26920. return int32(_XML_ROLE_NONE)
  26921. }
  26922. return _common(tls, state, tok)
  26923. }
  26924. func _condSect2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26925. _ = ptr
  26926. _ = end
  26927. _ = enc
  26928. switch tok {
  26929. case int32(m_XML_TOK_PROLOG_S):
  26930. return int32(_XML_ROLE_NONE)
  26931. case int32(m_XML_TOK_OPEN_BRACKET):
  26932. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  26933. return int32(_XML_ROLE_IGNORE_SECT)
  26934. }
  26935. return _common(tls, state, tok)
  26936. }
  26937. func _declClose(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26938. var v1 uintptr
  26939. _ = v1
  26940. _ = ptr
  26941. _ = end
  26942. _ = enc
  26943. switch tok {
  26944. case int32(m_XML_TOK_PROLOG_S):
  26945. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  26946. case int32(m_XML_TOK_DECL_CLOSE):
  26947. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  26948. v1 = __ccgo_fp(_internalSubset)
  26949. } else {
  26950. v1 = __ccgo_fp(_externalSubset1)
  26951. }
  26952. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  26953. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  26954. }
  26955. return _common(tls, state, tok)
  26956. }
  26957. // C documentation
  26958. //
  26959. // /* This function will only be invoked if the internal logic of the
  26960. // * parser has broken down. It is used in two cases:
  26961. // *
  26962. // * 1: When the XML prolog has been finished. At this point the
  26963. // * processor (the parser level above these role handlers) should
  26964. // * switch from prologProcessor to contentProcessor and reinitialise
  26965. // * the handler function.
  26966. // *
  26967. // * 2: When an error has been detected (via common() below). At this
  26968. // * point again the processor should be switched to errorProcessor,
  26969. // * which will never call a handler.
  26970. // *
  26971. // * The result of this is that error() can only be called if the
  26972. // * processor switch failed to happen, which is an internal error and
  26973. // * therefore we shouldn't be able to provoke it simply by using the
  26974. // * library. It is a necessary backstop, however, so we merely exclude
  26975. // * it from the coverage statistics.
  26976. // *
  26977. // * LCOV_EXCL_START
  26978. // */
  26979. func _error(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26980. _ = state
  26981. _ = tok
  26982. _ = ptr
  26983. _ = end
  26984. _ = enc
  26985. return int32(_XML_ROLE_NONE)
  26986. }
  26987. /* LCOV_EXCL_STOP */
  26988. func _common(tls *libc.TLS, state uintptr, tok int32) (r int32) {
  26989. if !((*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0) && tok == int32(m_XML_TOK_PARAM_ENTITY_REF) {
  26990. return int32(_XML_ROLE_INNER_PARAM_ENTITY_REF)
  26991. }
  26992. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  26993. return int32(_XML_ROLE_ERROR)
  26994. }
  26995. func XXmlPrologStateInit(tls *libc.TLS, state uintptr) {
  26996. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog0)
  26997. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = int32(1)
  26998. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  26999. (*TPROLOG_STATE)(unsafe.Pointer(state)).FinEntityValue = 0
  27000. }
  27001. func XXmlPrologStateInitExternalEntity(tls *libc.TLS, state uintptr) {
  27002. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset0)
  27003. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = 0
  27004. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  27005. }
  27006. func __ccgo_fp(f interface{}) uintptr {
  27007. type iface [2]uintptr
  27008. return (*iface)(unsafe.Pointer(&f))[1]
  27009. }
  27010. var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data
  27011. var __ccgo_ts1 = "\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0e\x0f\x00/dev/urandom\x00EXPAT_ENTROPY_DEBUG\x001\x00Entropy: %s --> 0x%0*lx (%lu bytes)\n\x00getrandom\x00fallback(4)\x00fallback(8)\x00out of memory\x00syntax error\x00no element found\x00not well-formed (invalid token)\x00unclosed token\x00partial character\x00mismatched tag\x00duplicate attribute\x00junk after document element\x00illegal parameter entity reference\x00undefined entity\x00recursive entity reference\x00asynchronous entity\x00reference to invalid character number\x00reference to binary entity\x00reference to external entity in attribute\x00XML or text declaration not at start of entity\x00unknown encoding\x00encoding specified in XML declaration is incorrect\x00unclosed CDATA section\x00error in processing external entity reference\x00document is not standalone\x00unexpected parser state - please send a bug report\x00entity declared in parameter entity\x00requested feature requires XML_DTD support in Expat\x00cannot change setting once parsing has begun\x00unbound prefix\x00must not undeclare prefix\x00incomplete markup in parameter entity\x00XML declaration not well-formed\x00text declaration not well-formed\x00illegal character(s) in public id\x00parser suspended\x00parser not suspended\x00parsing aborted\x00parsing finished\x00cannot suspend in external parameter entity\x00reserved prefix (xml) must not be undeclared or bound to another namespace name\x00reserved prefix (xmlns) must not be declared or undeclared\x00prefix must not be bound to one of the reserved namespace names\x00invalid argument\x00expat_2.2.10\x00sizeof(XML_Char)\x00sizeof(XML_LChar)\x00XML_DTD\x00XML_CONTEXT_BYTES\x00XML_NS\x00"