ccgo_linux_arm64.go 1.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146
  1. // Code generated for linux/arm64 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/arm64 -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 && arm64
  3. package libexpat
  4. import (
  5. "reflect"
  6. "unsafe"
  7. "modernc.org/libbsd"
  8. "modernc.org/libc"
  9. )
  10. var _ reflect.Type
  11. var _ unsafe.Pointer
  12. const m_ARG_MAX = 131072
  13. const m_ASCII_0 = 48
  14. const m_ASCII_1 = 49
  15. const m_ASCII_2 = 50
  16. const m_ASCII_3 = 51
  17. const m_ASCII_4 = 0x34
  18. const m_ASCII_5 = 0x35
  19. const m_ASCII_6 = 0x36
  20. const m_ASCII_7 = 0x37
  21. const m_ASCII_8 = 56
  22. const m_ASCII_9 = 57
  23. const m_ASCII_A = 65
  24. const m_ASCII_AMP = 0x26
  25. const m_ASCII_APOS = 0x27
  26. const m_ASCII_B = 0x42
  27. const m_ASCII_C = 67
  28. const m_ASCII_COLON = 58
  29. const m_ASCII_COMMA = 44
  30. const m_ASCII_D = 68
  31. const m_ASCII_E = 69
  32. const m_ASCII_EQUALS = 61
  33. const m_ASCII_EXCL = 33
  34. const m_ASCII_F = 70
  35. const m_ASCII_FF = 12
  36. const m_ASCII_G = 0x47
  37. const m_ASCII_GT = 0x3E
  38. const m_ASCII_H = 0x48
  39. const m_ASCII_HASH = 35
  40. const m_ASCII_I = 73
  41. const m_ASCII_J = 0x4A
  42. const m_ASCII_K = 75
  43. const m_ASCII_L = 76
  44. const m_ASCII_LPAREN = 40
  45. const m_ASCII_LSQB = 0x5B
  46. const m_ASCII_LT = 0x3C
  47. const m_ASCII_M = 77
  48. const m_ASCII_MINUS = 0x2D
  49. const m_ASCII_N = 78
  50. const m_ASCII_O = 79
  51. const m_ASCII_P = 0x50
  52. const m_ASCII_PERIOD = 46
  53. const m_ASCII_PIPE = 124
  54. const m_ASCII_Q = 0x51
  55. const m_ASCII_QUOT = 0x22
  56. const m_ASCII_R = 82
  57. const m_ASCII_RPAREN = 41
  58. const m_ASCII_RSQB = 0x5D
  59. const m_ASCII_S = 83
  60. const m_ASCII_SEMI = 0x3B
  61. const m_ASCII_SLASH = 47
  62. const m_ASCII_SPACE = 0x20
  63. const m_ASCII_T = 84
  64. const m_ASCII_TAB = 0x09
  65. const m_ASCII_U = 0x55
  66. const m_ASCII_UNDERSCORE = 0x5F
  67. const m_ASCII_V = 0x56
  68. const m_ASCII_W = 0x57
  69. const m_ASCII_X = 88
  70. const m_ASCII_Y = 89
  71. const m_ASCII_Z = 0x5A
  72. const m_ASCII_a = 97
  73. const m_ASCII_b = 0x62
  74. const m_ASCII_c = 99
  75. const m_ASCII_d = 0x64
  76. const m_ASCII_e = 101
  77. const m_ASCII_f = 0x66
  78. const m_ASCII_g = 103
  79. const m_ASCII_h = 104
  80. const m_ASCII_i = 0x69
  81. const m_ASCII_j = 0x6A
  82. const m_ASCII_k = 0x6B
  83. const m_ASCII_l = 108
  84. const m_ASCII_m = 109
  85. const m_ASCII_n = 110
  86. const m_ASCII_o = 111
  87. const m_ASCII_p = 112
  88. const m_ASCII_q = 0x71
  89. const m_ASCII_r = 114
  90. const m_ASCII_s = 115
  91. const m_ASCII_t = 116
  92. const m_ASCII_u = 0x75
  93. const m_ASCII_v = 0x76
  94. const m_ASCII_w = 119
  95. const m_ASCII_x = 120
  96. const m_ASCII_y = 0x79
  97. const m_ASCII_z = 0x7A
  98. const m_AT_EACCESS = 0x200
  99. const m_AT_EMPTY_PATH = 0x1000
  100. const m_AT_NO_AUTOMOUNT = 0x800
  101. const m_AT_RECURSIVE = 0x8000
  102. const m_AT_REMOVEDIR = 0x200
  103. const m_AT_STATX_DONT_SYNC = 0x4000
  104. const m_AT_STATX_FORCE_SYNC = 0x2000
  105. const m_AT_STATX_SYNC_AS_STAT = 0x0000
  106. const m_AT_STATX_SYNC_TYPE = 0x6000
  107. const m_AT_SYMLINK_FOLLOW = 0x400
  108. const m_AT_SYMLINK_NOFOLLOW = 0x100
  109. const m_BC_BASE_MAX = 99
  110. const m_BC_DIM_MAX = 2048
  111. const m_BC_SCALE_MAX = 99
  112. const m_BC_STRING_MAX = 1000
  113. const m_BIG_ENDIAN = "__BIG_ENDIAN"
  114. const m_BUFSIZ = 1024
  115. const m_BYTEORDER = 1234
  116. const m_BYTE_ORDER = "__BYTE_ORDER"
  117. const m_CHARCLASS_NAME_MAX = 14
  118. const m_CHAR_BIT = 8
  119. const m_CHAR_MAX = 255
  120. const m_CHAR_MIN = 0
  121. const m_COLL_WEIGHTS_MAX = 2
  122. const m_DELAYTIMER_MAX = 0x7fffffff
  123. const m_DN_ACCESS = 0x00000001
  124. const m_DN_ATTRIB = 0x00000020
  125. const m_DN_CREATE = 0x00000004
  126. const m_DN_DELETE = 0x00000008
  127. const m_DN_MODIFY = 0x00000002
  128. const m_DN_MULTISHOT = 0x80000000
  129. const m_DN_RENAME = 0x00000010
  130. const m_E2BIG = 7
  131. const m_EACCES = 13
  132. const m_EADDRINUSE = 98
  133. const m_EADDRNOTAVAIL = 99
  134. const m_EADV = 68
  135. const m_EAFNOSUPPORT = 97
  136. const m_EAGAIN = 11
  137. const m_EALREADY = 114
  138. const m_EBADE = 52
  139. const m_EBADF = 9
  140. const m_EBADFD = 77
  141. const m_EBADMSG = 74
  142. const m_EBADR = 53
  143. const m_EBADRQC = 56
  144. const m_EBADSLT = 57
  145. const m_EBFONT = 59
  146. const m_EBUSY = 16
  147. const m_ECANCELED = 125
  148. const m_ECHILD = 10
  149. const m_ECHRNG = 44
  150. const m_ECOMM = 70
  151. const m_ECONNABORTED = 103
  152. const m_ECONNREFUSED = 111
  153. const m_ECONNRESET = 104
  154. const m_EDEADLK = 35
  155. const m_EDEADLOCK = "EDEADLK"
  156. const m_EDESTADDRREQ = 89
  157. const m_EDOM = 33
  158. const m_EDOTDOT = 73
  159. const m_EDQUOT = 122
  160. const m_EEXIST = 17
  161. const m_EFAULT = 14
  162. const m_EFBIG = 27
  163. const m_EHOSTDOWN = 112
  164. const m_EHOSTUNREACH = 113
  165. const m_EHWPOISON = 133
  166. const m_EIDRM = 43
  167. const m_EILSEQ = 84
  168. const m_EINPROGRESS = 115
  169. const m_EINTR = 4
  170. const m_EINVAL = 22
  171. const m_EIO = 5
  172. const m_EISCONN = 106
  173. const m_EISDIR = 21
  174. const m_EISNAM = 120
  175. const m_EKEYEXPIRED = 127
  176. const m_EKEYREJECTED = 129
  177. const m_EKEYREVOKED = 128
  178. const m_EL2HLT = 51
  179. const m_EL2NSYNC = 45
  180. const m_EL3HLT = 46
  181. const m_EL3RST = 47
  182. const m_ELIBACC = 79
  183. const m_ELIBBAD = 80
  184. const m_ELIBEXEC = 83
  185. const m_ELIBMAX = 82
  186. const m_ELIBSCN = 81
  187. const m_ELNRNG = 48
  188. const m_ELOOP = 40
  189. const m_EMEDIUMTYPE = 124
  190. const m_EMFILE = 24
  191. const m_EMLINK = 31
  192. const m_EMSGSIZE = 90
  193. const m_EMULTIHOP = 72
  194. const m_ENAMETOOLONG = 36
  195. const m_ENAVAIL = 119
  196. const m_ENETDOWN = 100
  197. const m_ENETRESET = 102
  198. const m_ENETUNREACH = 101
  199. const m_ENFILE = 23
  200. const m_ENOANO = 55
  201. const m_ENOBUFS = 105
  202. const m_ENOCSI = 50
  203. const m_ENODATA = 61
  204. const m_ENODEV = 19
  205. const m_ENOENT = 2
  206. const m_ENOEXEC = 8
  207. const m_ENOKEY = 126
  208. const m_ENOLCK = 37
  209. const m_ENOLINK = 67
  210. const m_ENOMEDIUM = 123
  211. const m_ENOMEM = 12
  212. const m_ENOMSG = 42
  213. const m_ENONET = 64
  214. const m_ENOPKG = 65
  215. const m_ENOPROTOOPT = 92
  216. const m_ENOSPC = 28
  217. const m_ENOSR = 63
  218. const m_ENOSTR = 60
  219. const m_ENOSYS = 38
  220. const m_ENOTBLK = 15
  221. const m_ENOTCONN = 107
  222. const m_ENOTDIR = 20
  223. const m_ENOTEMPTY = 39
  224. const m_ENOTNAM = 118
  225. const m_ENOTRECOVERABLE = 131
  226. const m_ENOTSOCK = 88
  227. const m_ENOTSUP = "EOPNOTSUPP"
  228. const m_ENOTTY = 25
  229. const m_ENOTUNIQ = 76
  230. const m_ENXIO = 6
  231. const m_EOPNOTSUPP = 95
  232. const m_EOVERFLOW = 75
  233. const m_EOWNERDEAD = 130
  234. const m_EPERM = 1
  235. const m_EPFNOSUPPORT = 96
  236. const m_EPIPE = 32
  237. const m_EPROTO = 71
  238. const m_EPROTONOSUPPORT = 93
  239. const m_EPROTOTYPE = 91
  240. const m_ERANGE = 34
  241. const m_EREMCHG = 78
  242. const m_EREMOTE = 66
  243. const m_EREMOTEIO = 121
  244. const m_ERESTART = 85
  245. const m_ERFKILL = 132
  246. const m_EROFS = 30
  247. const m_ESHUTDOWN = 108
  248. const m_ESOCKTNOSUPPORT = 94
  249. const m_ESPIPE = 29
  250. const m_ESRCH = 3
  251. const m_ESRMNT = 69
  252. const m_ESTALE = 116
  253. const m_ESTRPIPE = 86
  254. const m_ETIME = 62
  255. const m_ETIMEDOUT = 110
  256. const m_ETOOMANYREFS = 109
  257. const m_ETXTBSY = 26
  258. const m_EUCLEAN = 117
  259. const m_EUNATCH = 49
  260. const m_EUSERS = 87
  261. const m_EWOULDBLOCK = "EAGAIN"
  262. const m_EXDEV = 18
  263. const m_EXFULL = 54
  264. const m_EXIT_FAILURE = 1
  265. const m_EXIT_SUCCESS = 0
  266. const m_EXPAND_SPARE = 24
  267. const m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT = 8388608
  268. const m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT = 100
  269. const m_EXPAT_CONFIG_H = 1
  270. const m_EXPR_NEST_MAX = 32
  271. const m_Expat_External_INCLUDED = 1
  272. const m_Expat_INCLUDED = 1
  273. const m_FALLOC_FL_KEEP_SIZE = 1
  274. const m_FALLOC_FL_PUNCH_HOLE = 2
  275. const m_FAPPEND = "O_APPEND"
  276. const m_FASYNC = "O_ASYNC"
  277. const m_FD_CLOEXEC = 1
  278. const m_FD_SETSIZE = 1024
  279. const m_FFSYNC = "O_SYNC"
  280. const m_FILENAME_MAX = 4096
  281. const m_FILESIZEBITS = 64
  282. const m_FNDELAY = "O_NDELAY"
  283. const m_FNONBLOCK = "O_NONBLOCK"
  284. const m_FOPEN_MAX = 1000
  285. const m_FP_FAST_FMA = 1
  286. const m_FP_FAST_FMAF = 1
  287. const m_FP_ILOGB0 = "FP_ILOGBNAN"
  288. const m_FP_INFINITE = 1
  289. const m_FP_NAN = 0
  290. const m_FP_NORMAL = 4
  291. const m_FP_SUBNORMAL = 3
  292. const m_FP_ZERO = 2
  293. const m_F_ADD_SEALS = 1033
  294. const m_F_CANCELLK = 1029
  295. const m_F_DUPFD = 0
  296. const m_F_DUPFD_CLOEXEC = 1030
  297. const m_F_GETFD = 1
  298. const m_F_GETFL = 3
  299. const m_F_GETLEASE = 1025
  300. const m_F_GETLK = 5
  301. const m_F_GETOWN = 9
  302. const m_F_GETOWNER_UIDS = 17
  303. const m_F_GETOWN_EX = 16
  304. const m_F_GETPIPE_SZ = 1032
  305. const m_F_GETSIG = 11
  306. const m_F_GET_FILE_RW_HINT = 1037
  307. const m_F_GET_RW_HINT = 1035
  308. const m_F_GET_SEALS = 1034
  309. const m_F_LOCK = 1
  310. const m_F_NOTIFY = 1026
  311. const m_F_OFD_GETLK = 36
  312. const m_F_OFD_SETLK = 37
  313. const m_F_OFD_SETLKW = 38
  314. const m_F_OK = 0
  315. const m_F_OWNER_GID = 2
  316. const m_F_OWNER_PGRP = 2
  317. const m_F_OWNER_PID = 1
  318. const m_F_OWNER_TID = 0
  319. const m_F_RDLCK = 0
  320. const m_F_SEAL_FUTURE_WRITE = 0x0010
  321. const m_F_SEAL_GROW = 0x0004
  322. const m_F_SEAL_SEAL = 0x0001
  323. const m_F_SEAL_SHRINK = 0x0002
  324. const m_F_SEAL_WRITE = 0x0008
  325. const m_F_SETFD = 2
  326. const m_F_SETFL = 4
  327. const m_F_SETLEASE = 1024
  328. const m_F_SETLK = 6
  329. const m_F_SETLKW = 7
  330. const m_F_SETOWN = 8
  331. const m_F_SETOWN_EX = 15
  332. const m_F_SETPIPE_SZ = 1031
  333. const m_F_SETSIG = 10
  334. const m_F_SET_FILE_RW_HINT = 1038
  335. const m_F_SET_RW_HINT = 1036
  336. const m_F_TEST = 3
  337. const m_F_TLOCK = 2
  338. const m_F_ULOCK = 0
  339. const m_F_UNLCK = 2
  340. const m_F_WRLCK = 1
  341. const m_GRND_INSECURE = 0x0004
  342. const m_GRND_NONBLOCK = 0x0001
  343. const m_GRND_RANDOM = 0x0002
  344. const m_HAVE_ARC4RANDOM_BUF = 1
  345. const m_HAVE_CONFIG_H = 1
  346. const m_HAVE_DLFCN_H = 1
  347. const m_HAVE_FCNTL_H = 1
  348. const m_HAVE_GETPAGESIZE = 1
  349. const m_HAVE_GETRANDOM = 1
  350. const m_HAVE_INTTYPES_H = 1
  351. const m_HAVE_MMAP = 1
  352. const m_HAVE_STDINT_H = 1
  353. const m_HAVE_STDIO_H = 1
  354. const m_HAVE_STDLIB_H = 1
  355. const m_HAVE_STRINGS_H = 1
  356. const m_HAVE_STRING_H = 1
  357. const m_HAVE_SYSCALL_GETRANDOM = 1
  358. const m_HAVE_SYS_PARAM_H = 1
  359. const m_HAVE_SYS_STAT_H = 1
  360. const m_HAVE_SYS_TYPES_H = 1
  361. const m_HAVE_UNISTD_H = 1
  362. const m_HOST_NAME_MAX = 255
  363. const m_HUGE = 3.40282346638528859812e+38
  364. const m_HUGE_VALF = "INFINITY"
  365. const m_INIT_ATTS_SIZE = 16
  366. const m_INIT_ATTS_VERSION = 4294967295
  367. const m_INIT_BLOCK_SIZE = 1024
  368. const m_INIT_BUFFER_SIZE = 1024
  369. const m_INIT_DATA_BUF_SIZE = 1024
  370. const m_INIT_POWER = 6
  371. const m_INIT_SCAFFOLD_ELEMENTS = 32
  372. const m_INIT_TAG_BUF_SIZE = 32
  373. const m_INT16_MAX = 0x7fff
  374. const m_INT32_MAX = 0x7fffffff
  375. const m_INT64_MAX = 0x7fffffffffffffff
  376. const m_INT8_MAX = 0x7f
  377. const m_INTMAX_MAX = "INT64_MAX"
  378. const m_INTMAX_MIN = "INT64_MIN"
  379. const m_INTPTR_MAX = "INT64_MAX"
  380. const m_INTPTR_MIN = "INT64_MIN"
  381. const m_INT_FAST16_MAX = "INT32_MAX"
  382. const m_INT_FAST16_MIN = "INT32_MIN"
  383. const m_INT_FAST32_MAX = "INT32_MAX"
  384. const m_INT_FAST32_MIN = "INT32_MIN"
  385. const m_INT_FAST64_MAX = "INT64_MAX"
  386. const m_INT_FAST64_MIN = "INT64_MIN"
  387. const m_INT_FAST8_MAX = "INT8_MAX"
  388. const m_INT_FAST8_MIN = "INT8_MIN"
  389. const m_INT_LEAST16_MAX = "INT16_MAX"
  390. const m_INT_LEAST16_MIN = "INT16_MIN"
  391. const m_INT_LEAST32_MAX = "INT32_MAX"
  392. const m_INT_LEAST32_MIN = "INT32_MIN"
  393. const m_INT_LEAST64_MAX = "INT64_MAX"
  394. const m_INT_LEAST64_MIN = "INT64_MIN"
  395. const m_INT_LEAST8_MAX = "INT8_MAX"
  396. const m_INT_LEAST8_MIN = "INT8_MIN"
  397. const m_INT_MAX = 2147483647
  398. const m_IOV_MAX = 1024
  399. const m_ITIMER_PROF = 2
  400. const m_ITIMER_REAL = 0
  401. const m_ITIMER_VIRTUAL = 1
  402. const m_LINE_MAX = 4096
  403. const m_LITTLE_ENDIAN = "__LITTLE_ENDIAN"
  404. const m_LLONG_MAX = 0x7fffffffffffffff
  405. const m_LOGIN_NAME_MAX = 256
  406. const m_LONG_BIT = 64
  407. const m_LONG_MAX = "__LONG_MAX"
  408. const m_LT_OBJDIR = ".libs/"
  409. const m_L_INCR = 1
  410. const m_L_SET = 0
  411. const m_L_XTND = 2
  412. const m_L_ctermid = 20
  413. const m_L_cuserid = 20
  414. const m_L_tmpnam = 20
  415. const m_MATH_ERREXCEPT = 2
  416. const m_MATH_ERRNO = 1
  417. const m_MAX_HANDLE_SZ = 128
  418. const m_MB_LEN_MAX = 4
  419. const m_MQ_PRIO_MAX = 32768
  420. const m_M_1_PI = 0.31830988618379067154
  421. const m_M_2_PI = 0.63661977236758134308
  422. const m_M_2_SQRTPI = 1.12837916709551257390
  423. const m_M_E = 2.7182818284590452354
  424. const m_M_LN10 = 2.30258509299404568402
  425. const m_M_LN2 = 0.69314718055994530942
  426. const m_M_LOG10E = 0.43429448190325182765
  427. const m_M_LOG2E = 1.4426950408889634074
  428. const m_M_PI = 3.14159265358979323846
  429. const m_M_PI_2 = 1.57079632679489661923
  430. const m_M_PI_4 = 0.78539816339744830962
  431. const m_M_SQRT1_2 = 0.70710678118654752440
  432. const m_M_SQRT2 = 1.41421356237309504880
  433. const m_NAME_MAX = 255
  434. const m_NDEBUG = 1
  435. const m_NGROUPS_MAX = 32
  436. const m_NL_ARGMAX = 9
  437. const m_NL_LANGMAX = 32
  438. const m_NL_MSGMAX = 32767
  439. const m_NL_NMAX = 16
  440. const m_NL_SETMAX = 255
  441. const m_NL_TEXTMAX = 2048
  442. const m_NZERO = 20
  443. const m_O_APPEND = 02000
  444. const m_O_ASYNC = 020000
  445. const m_O_CLOEXEC = 02000000
  446. const m_O_CREAT = 0100
  447. const m_O_DIRECT = 0200000
  448. const m_O_DIRECTORY = 040000
  449. const m_O_DSYNC = 010000
  450. const m_O_EXCL = 0200
  451. const m_O_EXEC = "O_PATH"
  452. const m_O_LARGEFILE = 0400000
  453. const m_O_NDELAY = "O_NONBLOCK"
  454. const m_O_NOATIME = 01000000
  455. const m_O_NOCTTY = 0400
  456. const m_O_NOFOLLOW = 0100000
  457. const m_O_NONBLOCK = 04000
  458. const m_O_PATH = 010000000
  459. const m_O_RDONLY = 00
  460. const m_O_RDWR = 02
  461. const m_O_RSYNC = 04010000
  462. const m_O_SEARCH = "O_PATH"
  463. const m_O_SYNC = 04010000
  464. const m_O_TMPFILE = 020040000
  465. const m_O_TRUNC = 01000
  466. const m_O_TTY_INIT = 0
  467. const m_O_WRONLY = 01
  468. const m_PACKAGE = "expat"
  469. const m_PACKAGE_BUGREPORT = "expat-bugs@libexpat.org"
  470. const m_PACKAGE_NAME = "expat"
  471. const m_PACKAGE_STRING = "expat 2.5.0"
  472. const m_PACKAGE_TARNAME = "expat"
  473. const m_PACKAGE_URL = ""
  474. const m_PACKAGE_VERSION = "2.5.0"
  475. const m_PATH_MAX = 4096
  476. const m_PDP_ENDIAN = "__PDP_ENDIAN"
  477. const m_PIPE_BUF = 4096
  478. const m_POSIX_CLOSE_RESTART = 0
  479. const m_POSIX_FADV_DONTNEED = 4
  480. const m_POSIX_FADV_NOREUSE = 5
  481. const m_POSIX_FADV_NORMAL = 0
  482. const m_POSIX_FADV_RANDOM = 1
  483. const m_POSIX_FADV_SEQUENTIAL = 2
  484. const m_POSIX_FADV_WILLNEED = 3
  485. const m_PTHREAD_DESTRUCTOR_ITERATIONS = 4
  486. const m_PTHREAD_KEYS_MAX = 128
  487. const m_PTHREAD_STACK_MIN = 2048
  488. const m_PTRDIFF_MAX = "INT64_MAX"
  489. const m_PTRDIFF_MIN = "INT64_MIN"
  490. const m_P_tmpdir = "/tmp"
  491. const m_RAND_MAX = 0x7fffffff
  492. const m_RE_DUP_MAX = 255
  493. const m_RWF_WRITE_LIFE_NOT_SET = 0
  494. const m_RWH_WRITE_LIFE_EXTREME = 5
  495. const m_RWH_WRITE_LIFE_LONG = 4
  496. const m_RWH_WRITE_LIFE_MEDIUM = 3
  497. const m_RWH_WRITE_LIFE_NONE = 1
  498. const m_RWH_WRITE_LIFE_SHORT = 2
  499. const m_R_OK = 4
  500. const m_SCHAR_MAX = 127
  501. const m_SEEK_DATA = 3
  502. const m_SEEK_HOLE = 4
  503. const m_SEM_NSEMS_MAX = 256
  504. const m_SEM_VALUE_MAX = 0x7fffffff
  505. const m_SHRT_MAX = 0x7fff
  506. const m_SIG_ATOMIC_MAX = "INT32_MAX"
  507. const m_SIG_ATOMIC_MIN = "INT32_MIN"
  508. const m_SIP_KEYLEN = 16
  509. const m_SIZE_MAX = "UINT64_MAX"
  510. const m_SPLICE_F_GIFT = 8
  511. const m_SPLICE_F_MORE = 4
  512. const m_SPLICE_F_MOVE = 1
  513. const m_SPLICE_F_NONBLOCK = 2
  514. const m_SSIZE_MAX = "LONG_MAX"
  515. const m_STDC_HEADERS = 1
  516. const m_STDERR_FILENO = 2
  517. const m_STDIN_FILENO = 0
  518. const m_STDOUT_FILENO = 1
  519. const m_SYMLOOP_MAX = 40
  520. const m_SYNC_FILE_RANGE_WAIT_AFTER = 4
  521. const m_SYNC_FILE_RANGE_WAIT_BEFORE = 1
  522. const m_SYNC_FILE_RANGE_WRITE = 2
  523. const m_S_IRGRP = 0040
  524. const m_S_IROTH = 0004
  525. const m_S_IRUSR = 0400
  526. const m_S_IRWXG = 0070
  527. const m_S_IRWXO = 0007
  528. const m_S_IRWXU = 0700
  529. const m_S_ISGID = 02000
  530. const m_S_ISUID = 04000
  531. const m_S_ISVTX = 01000
  532. const m_S_IWGRP = 0020
  533. const m_S_IWOTH = 0002
  534. const m_S_IWUSR = 0200
  535. const m_S_IXGRP = 0010
  536. const m_S_IXOTH = 0001
  537. const m_S_IXUSR = 0100
  538. const m_TMP_MAX = 10000
  539. const m_TTY_NAME_MAX = 32
  540. const m_TZNAME_MAX = 6
  541. const m_UCHAR_MAX = 255
  542. const m_UINT16_MAX = 0xffff
  543. const m_UINT32_MAX = "0xffffffffu"
  544. const m_UINT64_MAX = "0xffffffffffffffffu"
  545. const m_UINT8_MAX = 0xff
  546. const m_UINTMAX_MAX = "UINT64_MAX"
  547. const m_UINTPTR_MAX = "UINT64_MAX"
  548. const m_UINT_FAST16_MAX = "UINT32_MAX"
  549. const m_UINT_FAST32_MAX = "UINT32_MAX"
  550. const m_UINT_FAST64_MAX = "UINT64_MAX"
  551. const m_UINT_FAST8_MAX = "UINT8_MAX"
  552. const m_UINT_LEAST16_MAX = "UINT16_MAX"
  553. const m_UINT_LEAST32_MAX = "UINT32_MAX"
  554. const m_UINT_LEAST64_MAX = "UINT64_MAX"
  555. const m_UINT_LEAST8_MAX = "UINT8_MAX"
  556. const m_UINT_MAX = 4294967295
  557. const m_USHRT_MAX = 0xffff
  558. const m_VERSION = "2.5.0"
  559. const m_WINT_MAX = "UINT32_MAX"
  560. const m_WINT_MIN = 0
  561. const m_WNOHANG = 1
  562. const m_WORD_BIT = 32
  563. const m_WUNTRACED = 2
  564. const m_W_OK = 2
  565. const m_XML_ATTRIBUTE_VALUE_LITERAL = 0
  566. const m_XML_BUILDING_EXPAT = 1
  567. const m_XML_CDATA_SECTION_STATE = 2
  568. const m_XML_CONTENT_STATE = 1
  569. const m_XML_CONTEXT_BYTES = 1024
  570. const m_XML_DEV_URANDOM = 1
  571. const m_XML_DTD = 1
  572. const m_XML_ENABLE_VISIBILITY = 0
  573. const m_XML_ENCODE_MAX = "XML_UTF8_ENCODE_MAX"
  574. const m_XML_ENTITY_VALUE_LITERAL = 1
  575. const m_XML_GetErrorByteIndex = "XML_GetCurrentByteIndex"
  576. const m_XML_GetErrorColumnNumber = "XML_GetCurrentColumnNumber"
  577. const m_XML_GetErrorLineNumber = "XML_GetCurrentLineNumber"
  578. const m_XML_IGNORE_SECTION_STATE = 3
  579. const m_XML_MAJOR_VERSION = 2
  580. const m_XML_MICRO_VERSION = 0
  581. const m_XML_MINOR_VERSION = 5
  582. const m_XML_NS = 1
  583. const m_XML_N_LITERAL_TYPES = 2
  584. const m_XML_N_STATES = 4
  585. const m_XML_PROLOG_STATE = 0
  586. const m_XML_TOK_ATTRIBUTE_VALUE_S = 39
  587. const m_XML_TOK_BOM = 14
  588. const m_XML_TOK_CDATA_SECT_CLOSE = 40
  589. const m_XML_TOK_CDATA_SECT_OPEN = 8
  590. const m_XML_TOK_CHAR_REF = 10
  591. const m_XML_TOK_CLOSE_BRACKET = 26
  592. const m_XML_TOK_CLOSE_PAREN = 24
  593. const m_XML_TOK_CLOSE_PAREN_ASTERISK = 36
  594. const m_XML_TOK_CLOSE_PAREN_PLUS = 37
  595. const m_XML_TOK_CLOSE_PAREN_QUESTION = 35
  596. const m_XML_TOK_COMMA = 38
  597. const m_XML_TOK_COMMENT = 13
  598. const m_XML_TOK_COND_SECT_CLOSE = 34
  599. const m_XML_TOK_COND_SECT_OPEN = 33
  600. const m_XML_TOK_DATA_CHARS = 6
  601. const m_XML_TOK_DATA_NEWLINE = 7
  602. const m_XML_TOK_DECL_CLOSE = 17
  603. const m_XML_TOK_DECL_OPEN = 16
  604. const m_XML_TOK_EMPTY_ELEMENT_NO_ATTS = 4
  605. const m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS = 3
  606. const m_XML_TOK_END_TAG = 5
  607. const m_XML_TOK_ENTITY_REF = 9
  608. const m_XML_TOK_IGNORE_SECT = 42
  609. const m_XML_TOK_INSTANCE_START = 29
  610. const m_XML_TOK_INVALID = 0
  611. const m_XML_TOK_LITERAL = 27
  612. const m_XML_TOK_NAME = 18
  613. const m_XML_TOK_NAME_ASTERISK = 31
  614. const m_XML_TOK_NAME_PLUS = 32
  615. const m_XML_TOK_NAME_QUESTION = 30
  616. const m_XML_TOK_NMTOKEN = 19
  617. const m_XML_TOK_OPEN_BRACKET = 25
  618. const m_XML_TOK_OPEN_PAREN = 23
  619. const m_XML_TOK_OR = 21
  620. const m_XML_TOK_PARAM_ENTITY_REF = 28
  621. const m_XML_TOK_PERCENT = 22
  622. const m_XML_TOK_PI = 11
  623. const m_XML_TOK_POUND_NAME = 20
  624. const m_XML_TOK_PREFIXED_NAME = 41
  625. const m_XML_TOK_PROLOG_S = 15
  626. const m_XML_TOK_START_TAG_NO_ATTS = 2
  627. const m_XML_TOK_START_TAG_WITH_ATTS = 1
  628. const m_XML_TOK_XML_DECL = 12
  629. const m_XML_UTF16_ENCODE_MAX = 2
  630. const m_XML_UTF8_ENCODE_MAX = 4
  631. const m_X_OK = 1
  632. const m_XmlConvert = "XmlUtf8Convert"
  633. const m_XmlEncode = "XmlUtf8Encode"
  634. const m_XmlGetInternalEncoding = "XmlGetUtf8InternalEncoding"
  635. const m_XmlGetInternalEncodingNS = "XmlGetUtf8InternalEncodingNS"
  636. const m_XmlRole_INCLUDED = 1
  637. const m_XmlTok_INCLUDED = 1
  638. const m__CS_GNU_LIBC_VERSION = 2
  639. const m__CS_GNU_LIBPTHREAD_VERSION = 3
  640. const m__CS_PATH = 0
  641. const m__CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 4
  642. const m__CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116
  643. const m__CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117
  644. const m__CS_POSIX_V6_ILP32_OFF32_LIBS = 1118
  645. const m__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119
  646. const m__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120
  647. const m__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121
  648. const m__CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122
  649. const m__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123
  650. const m__CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124
  651. const m__CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125
  652. const m__CS_POSIX_V6_LP64_OFF64_LIBS = 1126
  653. const m__CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127
  654. const m__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128
  655. const m__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129
  656. const m__CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130
  657. const m__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131
  658. const m__CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 1
  659. const m__CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132
  660. const m__CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133
  661. const m__CS_POSIX_V7_ILP32_OFF32_LIBS = 1134
  662. const m__CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135
  663. const m__CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136
  664. const m__CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137
  665. const m__CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138
  666. const m__CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139
  667. const m__CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140
  668. const m__CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141
  669. const m__CS_POSIX_V7_LP64_OFF64_LIBS = 1142
  670. const m__CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143
  671. const m__CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144
  672. const m__CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145
  673. const m__CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146
  674. const m__CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147
  675. const m__CS_POSIX_V7_THREADS_CFLAGS = 1150
  676. const m__CS_POSIX_V7_THREADS_LDFLAGS = 1151
  677. const m__CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 5
  678. const m__CS_V6_ENV = 1148
  679. const m__CS_V7_ENV = 1149
  680. const m__GNU_SOURCE = 1
  681. const m__IOFBF = 0
  682. const m__IOLBF = 1
  683. const m__IONBF = 2
  684. const m__LP64 = 1
  685. const m__PC_2_SYMLINKS = 20
  686. const m__PC_ALLOC_SIZE_MIN = 18
  687. const m__PC_ASYNC_IO = 10
  688. const m__PC_CHOWN_RESTRICTED = 6
  689. const m__PC_FILESIZEBITS = 13
  690. const m__PC_LINK_MAX = 0
  691. const m__PC_MAX_CANON = 1
  692. const m__PC_MAX_INPUT = 2
  693. const m__PC_NAME_MAX = 3
  694. const m__PC_NO_TRUNC = 7
  695. const m__PC_PATH_MAX = 4
  696. const m__PC_PIPE_BUF = 5
  697. const m__PC_PRIO_IO = 11
  698. const m__PC_REC_INCR_XFER_SIZE = 14
  699. const m__PC_REC_MAX_XFER_SIZE = 15
  700. const m__PC_REC_MIN_XFER_SIZE = 16
  701. const m__PC_REC_XFER_ALIGN = 17
  702. const m__PC_SOCK_MAXBUF = 12
  703. const m__PC_SYMLINK_MAX = 19
  704. const m__PC_SYNC_IO = 9
  705. const m__PC_VDISABLE = 8
  706. const m__POSIX2_BC_BASE_MAX = 99
  707. const m__POSIX2_BC_DIM_MAX = 2048
  708. const m__POSIX2_BC_SCALE_MAX = 99
  709. const m__POSIX2_BC_STRING_MAX = 1000
  710. const m__POSIX2_CHARCLASS_NAME_MAX = 14
  711. const m__POSIX2_COLL_WEIGHTS_MAX = 2
  712. const m__POSIX2_C_BIND = "_POSIX_VERSION"
  713. const m__POSIX2_EXPR_NEST_MAX = 32
  714. const m__POSIX2_LINE_MAX = 2048
  715. const m__POSIX2_RE_DUP_MAX = 255
  716. const m__POSIX2_VERSION = "_POSIX_VERSION"
  717. const m__POSIX_ADVISORY_INFO = "_POSIX_VERSION"
  718. const m__POSIX_AIO_LISTIO_MAX = 2
  719. const m__POSIX_AIO_MAX = 1
  720. const m__POSIX_ARG_MAX = 4096
  721. const m__POSIX_ASYNCHRONOUS_IO = "_POSIX_VERSION"
  722. const m__POSIX_BARRIERS = "_POSIX_VERSION"
  723. const m__POSIX_CHILD_MAX = 25
  724. const m__POSIX_CHOWN_RESTRICTED = 1
  725. const m__POSIX_CLOCKRES_MIN = 20000000
  726. const m__POSIX_CLOCK_SELECTION = "_POSIX_VERSION"
  727. const m__POSIX_CPUTIME = "_POSIX_VERSION"
  728. const m__POSIX_DELAYTIMER_MAX = 32
  729. const m__POSIX_FSYNC = "_POSIX_VERSION"
  730. const m__POSIX_HOST_NAME_MAX = 255
  731. const m__POSIX_IPV6 = "_POSIX_VERSION"
  732. const m__POSIX_JOB_CONTROL = 1
  733. const m__POSIX_LINK_MAX = 8
  734. const m__POSIX_LOGIN_NAME_MAX = 9
  735. const m__POSIX_MAPPED_FILES = "_POSIX_VERSION"
  736. const m__POSIX_MAX_CANON = 255
  737. const m__POSIX_MAX_INPUT = 255
  738. const m__POSIX_MEMLOCK = "_POSIX_VERSION"
  739. const m__POSIX_MEMLOCK_RANGE = "_POSIX_VERSION"
  740. const m__POSIX_MEMORY_PROTECTION = "_POSIX_VERSION"
  741. const m__POSIX_MESSAGE_PASSING = "_POSIX_VERSION"
  742. const m__POSIX_MONOTONIC_CLOCK = "_POSIX_VERSION"
  743. const m__POSIX_MQ_OPEN_MAX = 8
  744. const m__POSIX_MQ_PRIO_MAX = 32
  745. const m__POSIX_NAME_MAX = 14
  746. const m__POSIX_NGROUPS_MAX = 8
  747. const m__POSIX_NO_TRUNC = 1
  748. const m__POSIX_OPEN_MAX = 20
  749. const m__POSIX_PATH_MAX = 256
  750. const m__POSIX_PIPE_BUF = 512
  751. const m__POSIX_RAW_SOCKETS = "_POSIX_VERSION"
  752. const m__POSIX_READER_WRITER_LOCKS = "_POSIX_VERSION"
  753. const m__POSIX_REALTIME_SIGNALS = "_POSIX_VERSION"
  754. const m__POSIX_REGEXP = 1
  755. const m__POSIX_RE_DUP_MAX = 255
  756. const m__POSIX_RTSIG_MAX = 8
  757. const m__POSIX_SAVED_IDS = 1
  758. const m__POSIX_SEMAPHORES = "_POSIX_VERSION"
  759. const m__POSIX_SEM_NSEMS_MAX = 256
  760. const m__POSIX_SEM_VALUE_MAX = 32767
  761. const m__POSIX_SHARED_MEMORY_OBJECTS = "_POSIX_VERSION"
  762. const m__POSIX_SHELL = 1
  763. const m__POSIX_SIGQUEUE_MAX = 32
  764. const m__POSIX_SPAWN = "_POSIX_VERSION"
  765. const m__POSIX_SPIN_LOCKS = "_POSIX_VERSION"
  766. const m__POSIX_SSIZE_MAX = 32767
  767. const m__POSIX_SS_REPL_MAX = 4
  768. const m__POSIX_STREAM_MAX = 8
  769. const m__POSIX_SYMLINK_MAX = 255
  770. const m__POSIX_SYMLOOP_MAX = 8
  771. const m__POSIX_THREADS = "_POSIX_VERSION"
  772. const m__POSIX_THREAD_ATTR_STACKADDR = "_POSIX_VERSION"
  773. const m__POSIX_THREAD_ATTR_STACKSIZE = "_POSIX_VERSION"
  774. const m__POSIX_THREAD_CPUTIME = "_POSIX_VERSION"
  775. const m__POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4
  776. const m__POSIX_THREAD_KEYS_MAX = 128
  777. const m__POSIX_THREAD_PRIORITY_SCHEDULING = "_POSIX_VERSION"
  778. const m__POSIX_THREAD_PROCESS_SHARED = "_POSIX_VERSION"
  779. const m__POSIX_THREAD_SAFE_FUNCTIONS = "_POSIX_VERSION"
  780. const m__POSIX_THREAD_THREADS_MAX = 64
  781. const m__POSIX_TIMEOUTS = "_POSIX_VERSION"
  782. const m__POSIX_TIMERS = "_POSIX_VERSION"
  783. const m__POSIX_TIMER_MAX = 32
  784. const m__POSIX_TRACE_EVENT_NAME_MAX = 30
  785. const m__POSIX_TRACE_NAME_MAX = 8
  786. const m__POSIX_TRACE_SYS_MAX = 8
  787. const m__POSIX_TRACE_USER_EVENT_MAX = 32
  788. const m__POSIX_TTY_NAME_MAX = 9
  789. const m__POSIX_TZNAME_MAX = 6
  790. const m__POSIX_V6_LP64_OFF64 = 1
  791. const m__POSIX_V7_LP64_OFF64 = 1
  792. const m__POSIX_VDISABLE = 0
  793. const m__POSIX_VERSION = 200809
  794. const m__SC_2_CHAR_TERM = 95
  795. const m__SC_2_C_BIND = 47
  796. const m__SC_2_C_DEV = 48
  797. const m__SC_2_FORT_DEV = 49
  798. const m__SC_2_FORT_RUN = 50
  799. const m__SC_2_LOCALEDEF = 52
  800. const m__SC_2_PBS = 168
  801. const m__SC_2_PBS_ACCOUNTING = 169
  802. const m__SC_2_PBS_CHECKPOINT = 175
  803. const m__SC_2_PBS_LOCATE = 170
  804. const m__SC_2_PBS_MESSAGE = 171
  805. const m__SC_2_PBS_TRACK = 172
  806. const m__SC_2_SW_DEV = 51
  807. const m__SC_2_UPE = 97
  808. const m__SC_2_VERSION = 46
  809. const m__SC_ADVISORY_INFO = 132
  810. const m__SC_AIO_LISTIO_MAX = 23
  811. const m__SC_AIO_MAX = 24
  812. const m__SC_AIO_PRIO_DELTA_MAX = 25
  813. const m__SC_ARG_MAX = 0
  814. const m__SC_ASYNCHRONOUS_IO = 12
  815. const m__SC_ATEXIT_MAX = 87
  816. const m__SC_AVPHYS_PAGES = 86
  817. const m__SC_BARRIERS = 133
  818. const m__SC_BC_BASE_MAX = 36
  819. const m__SC_BC_DIM_MAX = 37
  820. const m__SC_BC_SCALE_MAX = 38
  821. const m__SC_BC_STRING_MAX = 39
  822. const m__SC_CHILD_MAX = 1
  823. const m__SC_CLK_TCK = 2
  824. const m__SC_CLOCK_SELECTION = 137
  825. const m__SC_COLL_WEIGHTS_MAX = 40
  826. const m__SC_CPUTIME = 138
  827. const m__SC_DELAYTIMER_MAX = 26
  828. const m__SC_EXPR_NEST_MAX = 42
  829. const m__SC_FSYNC = 15
  830. const m__SC_GETGR_R_SIZE_MAX = 69
  831. const m__SC_GETPW_R_SIZE_MAX = 70
  832. const m__SC_HOST_NAME_MAX = 180
  833. const m__SC_IOV_MAX = 60
  834. const m__SC_IPV6 = 235
  835. const m__SC_JOB_CONTROL = 7
  836. const m__SC_LINE_MAX = 43
  837. const m__SC_LOGIN_NAME_MAX = 71
  838. const m__SC_MAPPED_FILES = 16
  839. const m__SC_MEMLOCK = 17
  840. const m__SC_MEMLOCK_RANGE = 18
  841. const m__SC_MEMORY_PROTECTION = 19
  842. const m__SC_MESSAGE_PASSING = 20
  843. const m__SC_MINSIGSTKSZ = 249
  844. const m__SC_MONOTONIC_CLOCK = 149
  845. const m__SC_MQ_OPEN_MAX = 27
  846. const m__SC_MQ_PRIO_MAX = 28
  847. const m__SC_NGROUPS_MAX = 3
  848. const m__SC_NPROCESSORS_CONF = 83
  849. const m__SC_NPROCESSORS_ONLN = 84
  850. const m__SC_NZERO = 109
  851. const m__SC_OPEN_MAX = 4
  852. const m__SC_PAGESIZE = 30
  853. const m__SC_PAGE_SIZE = 30
  854. const m__SC_PASS_MAX = 88
  855. const m__SC_PHYS_PAGES = 85
  856. const m__SC_PRIORITIZED_IO = 13
  857. const m__SC_PRIORITY_SCHEDULING = 10
  858. const m__SC_RAW_SOCKETS = 236
  859. const m__SC_READER_WRITER_LOCKS = 153
  860. const m__SC_REALTIME_SIGNALS = 9
  861. const m__SC_REGEXP = 155
  862. const m__SC_RE_DUP_MAX = 44
  863. const m__SC_RTSIG_MAX = 31
  864. const m__SC_SAVED_IDS = 8
  865. const m__SC_SEMAPHORES = 21
  866. const m__SC_SEM_NSEMS_MAX = 32
  867. const m__SC_SEM_VALUE_MAX = 33
  868. const m__SC_SHARED_MEMORY_OBJECTS = 22
  869. const m__SC_SHELL = 157
  870. const m__SC_SIGQUEUE_MAX = 34
  871. const m__SC_SIGSTKSZ = 250
  872. const m__SC_SPAWN = 159
  873. const m__SC_SPIN_LOCKS = 154
  874. const m__SC_SPORADIC_SERVER = 160
  875. const m__SC_SS_REPL_MAX = 241
  876. const m__SC_STREAMS = 174
  877. const m__SC_STREAM_MAX = 5
  878. const m__SC_SYMLOOP_MAX = 173
  879. const m__SC_SYNCHRONIZED_IO = 14
  880. const m__SC_THREADS = 67
  881. const m__SC_THREAD_ATTR_STACKADDR = 77
  882. const m__SC_THREAD_ATTR_STACKSIZE = 78
  883. const m__SC_THREAD_CPUTIME = 139
  884. const m__SC_THREAD_DESTRUCTOR_ITERATIONS = 73
  885. const m__SC_THREAD_KEYS_MAX = 74
  886. const m__SC_THREAD_PRIORITY_SCHEDULING = 79
  887. const m__SC_THREAD_PRIO_INHERIT = 80
  888. const m__SC_THREAD_PRIO_PROTECT = 81
  889. const m__SC_THREAD_PROCESS_SHARED = 82
  890. const m__SC_THREAD_ROBUST_PRIO_INHERIT = 247
  891. const m__SC_THREAD_ROBUST_PRIO_PROTECT = 248
  892. const m__SC_THREAD_SAFE_FUNCTIONS = 68
  893. const m__SC_THREAD_SPORADIC_SERVER = 161
  894. const m__SC_THREAD_STACK_MIN = 75
  895. const m__SC_THREAD_THREADS_MAX = 76
  896. const m__SC_TIMEOUTS = 164
  897. const m__SC_TIMERS = 11
  898. const m__SC_TIMER_MAX = 35
  899. const m__SC_TRACE = 181
  900. const m__SC_TRACE_EVENT_FILTER = 182
  901. const m__SC_TRACE_EVENT_NAME_MAX = 242
  902. const m__SC_TRACE_INHERIT = 183
  903. const m__SC_TRACE_LOG = 184
  904. const m__SC_TRACE_NAME_MAX = 243
  905. const m__SC_TRACE_SYS_MAX = 244
  906. const m__SC_TRACE_USER_EVENT_MAX = 245
  907. const m__SC_TTY_NAME_MAX = 72
  908. const m__SC_TYPED_MEMORY_OBJECTS = 165
  909. const m__SC_TZNAME_MAX = 6
  910. const m__SC_UIO_MAXIOV = 60
  911. const m__SC_V6_ILP32_OFF32 = 176
  912. const m__SC_V6_ILP32_OFFBIG = 177
  913. const m__SC_V6_LP64_OFF64 = 178
  914. const m__SC_V6_LPBIG_OFFBIG = 179
  915. const m__SC_V7_ILP32_OFF32 = 237
  916. const m__SC_V7_ILP32_OFFBIG = 238
  917. const m__SC_V7_LP64_OFF64 = 239
  918. const m__SC_V7_LPBIG_OFFBIG = 240
  919. const m__SC_VERSION = 29
  920. const m__SC_XBS5_ILP32_OFF32 = 125
  921. const m__SC_XBS5_ILP32_OFFBIG = 126
  922. const m__SC_XBS5_LP64_OFF64 = 127
  923. const m__SC_XBS5_LPBIG_OFFBIG = 128
  924. const m__SC_XOPEN_CRYPT = 92
  925. const m__SC_XOPEN_ENH_I18N = 93
  926. const m__SC_XOPEN_LEGACY = 129
  927. const m__SC_XOPEN_REALTIME = 130
  928. const m__SC_XOPEN_REALTIME_THREADS = 131
  929. const m__SC_XOPEN_SHM = 94
  930. const m__SC_XOPEN_STREAMS = 246
  931. const m__SC_XOPEN_UNIX = 91
  932. const m__SC_XOPEN_VERSION = 89
  933. const m__SC_XOPEN_XCU_VERSION = 90
  934. const m__SC_XOPEN_XPG2 = 98
  935. const m__SC_XOPEN_XPG3 = 99
  936. const m__SC_XOPEN_XPG4 = 100
  937. const m__STDC_PREDEF_H = 1
  938. const m__XOPEN_ENH_I18N = 1
  939. const m__XOPEN_IOV_MAX = 16
  940. const m__XOPEN_NAME_MAX = 255
  941. const m__XOPEN_PATH_MAX = 1024
  942. const m__XOPEN_UNIX = 1
  943. const m__XOPEN_VERSION = 700
  944. const m___AARCH64EL__ = 1
  945. const m___AARCH64_CMODEL_SMALL__ = 1
  946. const m___ARM_64BIT_STATE = 1
  947. const m___ARM_ALIGN_MAX_PWR = 28
  948. const m___ARM_ALIGN_MAX_STACK_PWR = 16
  949. const m___ARM_ARCH = 8
  950. const m___ARM_ARCH_8A = 1
  951. const m___ARM_ARCH_ISA_A64 = 1
  952. const m___ARM_ARCH_PROFILE = 65
  953. const m___ARM_FEATURE_CLZ = 1
  954. const m___ARM_FEATURE_FMA = 1
  955. const m___ARM_FEATURE_IDIV = 1
  956. const m___ARM_FEATURE_NUMERIC_MAXMIN = 1
  957. const m___ARM_FEATURE_UNALIGNED = 1
  958. const m___ARM_FP = 14
  959. const m___ARM_FP16_ARGS = 1
  960. const m___ARM_FP16_FORMAT_IEEE = 1
  961. const m___ARM_NEON = 1
  962. const m___ARM_PCS_AAPCS64 = 1
  963. const m___ARM_SIZEOF_MINIMAL_ENUM = 4
  964. const m___ARM_SIZEOF_WCHAR_T = 4
  965. const m___ATOMIC_ACQUIRE = 2
  966. const m___ATOMIC_ACQ_REL = 4
  967. const m___ATOMIC_CONSUME = 1
  968. const m___ATOMIC_RELAXED = 0
  969. const m___ATOMIC_RELEASE = 3
  970. const m___ATOMIC_SEQ_CST = 5
  971. const m___BIGGEST_ALIGNMENT__ = 16
  972. const m___BIG_ENDIAN = 4321
  973. const m___BYTE_ORDER = 1234
  974. const m___BYTE_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  975. const m___CCGO__ = 1
  976. const m___CHAR_BIT__ = 8
  977. const m___CHAR_UNSIGNED__ = 1
  978. const m___DBL_DECIMAL_DIG__ = 17
  979. const m___DBL_DIG__ = 15
  980. const m___DBL_HAS_DENORM__ = 1
  981. const m___DBL_HAS_INFINITY__ = 1
  982. const m___DBL_HAS_QUIET_NAN__ = 1
  983. const m___DBL_IS_IEC_60559__ = 2
  984. const m___DBL_MANT_DIG__ = 53
  985. const m___DBL_MAX_10_EXP__ = 308
  986. const m___DBL_MAX_EXP__ = 1024
  987. const m___DECIMAL_DIG__ = 36
  988. const m___DEC_EVAL_METHOD__ = 2
  989. const m___ELF__ = 1
  990. const m___FINITE_MATH_ONLY__ = 0
  991. const m___FLOAT_WORD_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  992. const m___FLT128_DECIMAL_DIG__ = 36
  993. const m___FLT128_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  994. const m___FLT128_DIG__ = 33
  995. const m___FLT128_EPSILON__ = 1.92592994438723585305597794258492732e-34
  996. const m___FLT128_HAS_DENORM__ = 1
  997. const m___FLT128_HAS_INFINITY__ = 1
  998. const m___FLT128_HAS_QUIET_NAN__ = 1
  999. const m___FLT128_IS_IEC_60559__ = 2
  1000. const m___FLT128_MANT_DIG__ = 113
  1001. const m___FLT128_MAX_10_EXP__ = 4932
  1002. const m___FLT128_MAX_EXP__ = 16384
  1003. const m___FLT128_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1004. const m___FLT128_MIN__ = 3.36210314311209350626267781732175260e-4932
  1005. const m___FLT128_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1006. const m___FLT16_DECIMAL_DIG__ = 5
  1007. const m___FLT16_DENORM_MIN__ = 5.96046447753906250000000000000000000e-8
  1008. const m___FLT16_DIG__ = 3
  1009. const m___FLT16_EPSILON__ = 9.76562500000000000000000000000000000e-4
  1010. const m___FLT16_HAS_DENORM__ = 1
  1011. const m___FLT16_HAS_INFINITY__ = 1
  1012. const m___FLT16_HAS_QUIET_NAN__ = 1
  1013. const m___FLT16_IS_IEC_60559__ = 2
  1014. const m___FLT16_MANT_DIG__ = 11
  1015. const m___FLT16_MAX_10_EXP__ = 4
  1016. const m___FLT16_MAX_EXP__ = 16
  1017. const m___FLT16_MAX__ = 6.55040000000000000000000000000000000e+4
  1018. const m___FLT16_MIN__ = 6.10351562500000000000000000000000000e-5
  1019. const m___FLT16_NORM_MAX__ = 6.55040000000000000000000000000000000e+4
  1020. const m___FLT32X_DECIMAL_DIG__ = 17
  1021. const m___FLT32X_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1022. const m___FLT32X_DIG__ = 15
  1023. const m___FLT32X_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1024. const m___FLT32X_HAS_DENORM__ = 1
  1025. const m___FLT32X_HAS_INFINITY__ = 1
  1026. const m___FLT32X_HAS_QUIET_NAN__ = 1
  1027. const m___FLT32X_IS_IEC_60559__ = 2
  1028. const m___FLT32X_MANT_DIG__ = 53
  1029. const m___FLT32X_MAX_10_EXP__ = 308
  1030. const m___FLT32X_MAX_EXP__ = 1024
  1031. const m___FLT32X_MAX__ = 1.79769313486231570814527423731704357e+308
  1032. const m___FLT32X_MIN__ = 2.22507385850720138309023271733240406e-308
  1033. const m___FLT32X_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1034. const m___FLT32_DECIMAL_DIG__ = 9
  1035. const m___FLT32_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  1036. const m___FLT32_DIG__ = 6
  1037. const m___FLT32_EPSILON__ = 1.19209289550781250000000000000000000e-7
  1038. const m___FLT32_HAS_DENORM__ = 1
  1039. const m___FLT32_HAS_INFINITY__ = 1
  1040. const m___FLT32_HAS_QUIET_NAN__ = 1
  1041. const m___FLT32_IS_IEC_60559__ = 2
  1042. const m___FLT32_MANT_DIG__ = 24
  1043. const m___FLT32_MAX_10_EXP__ = 38
  1044. const m___FLT32_MAX_EXP__ = 128
  1045. const m___FLT32_MAX__ = 3.40282346638528859811704183484516925e+38
  1046. const m___FLT32_MIN__ = 1.17549435082228750796873653722224568e-38
  1047. const m___FLT32_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  1048. const m___FLT64X_DECIMAL_DIG__ = 36
  1049. const m___FLT64X_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  1050. const m___FLT64X_DIG__ = 33
  1051. const m___FLT64X_EPSILON__ = 1.92592994438723585305597794258492732e-34
  1052. const m___FLT64X_HAS_DENORM__ = 1
  1053. const m___FLT64X_HAS_INFINITY__ = 1
  1054. const m___FLT64X_HAS_QUIET_NAN__ = 1
  1055. const m___FLT64X_IS_IEC_60559__ = 2
  1056. const m___FLT64X_MANT_DIG__ = 113
  1057. const m___FLT64X_MAX_10_EXP__ = 4932
  1058. const m___FLT64X_MAX_EXP__ = 16384
  1059. const m___FLT64X_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1060. const m___FLT64X_MIN__ = 3.36210314311209350626267781732175260e-4932
  1061. const m___FLT64X_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1062. const m___FLT64_DECIMAL_DIG__ = 17
  1063. const m___FLT64_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1064. const m___FLT64_DIG__ = 15
  1065. const m___FLT64_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1066. const m___FLT64_HAS_DENORM__ = 1
  1067. const m___FLT64_HAS_INFINITY__ = 1
  1068. const m___FLT64_HAS_QUIET_NAN__ = 1
  1069. const m___FLT64_IS_IEC_60559__ = 2
  1070. const m___FLT64_MANT_DIG__ = 53
  1071. const m___FLT64_MAX_10_EXP__ = 308
  1072. const m___FLT64_MAX_EXP__ = 1024
  1073. const m___FLT64_MAX__ = 1.79769313486231570814527423731704357e+308
  1074. const m___FLT64_MIN__ = 2.22507385850720138309023271733240406e-308
  1075. const m___FLT64_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1076. const m___FLT_DECIMAL_DIG__ = 9
  1077. const m___FLT_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  1078. const m___FLT_DIG__ = 6
  1079. const m___FLT_EPSILON__ = 1.19209289550781250000000000000000000e-7
  1080. const m___FLT_EVAL_METHOD_C99__ = 0
  1081. const m___FLT_EVAL_METHOD_TS_18661_3__ = 0
  1082. const m___FLT_EVAL_METHOD__ = 0
  1083. const m___FLT_HAS_DENORM__ = 1
  1084. const m___FLT_HAS_INFINITY__ = 1
  1085. const m___FLT_HAS_QUIET_NAN__ = 1
  1086. const m___FLT_IS_IEC_60559__ = 2
  1087. const m___FLT_MANT_DIG__ = 24
  1088. const m___FLT_MAX_10_EXP__ = 38
  1089. const m___FLT_MAX_EXP__ = 128
  1090. const m___FLT_MAX__ = 3.40282346638528859811704183484516925e+38
  1091. const m___FLT_MIN__ = 1.17549435082228750796873653722224568e-38
  1092. const m___FLT_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  1093. const m___FLT_RADIX__ = 2
  1094. const m___FP_FAST_FMA = 1
  1095. const m___FP_FAST_FMAF = 1
  1096. const m___FP_FAST_FMAF32 = 1
  1097. const m___FP_FAST_FMAF32x = 1
  1098. const m___FP_FAST_FMAF64 = 1
  1099. const m___FUNCTION__ = "__func__"
  1100. const m___GCC_ASM_FLAG_OUTPUTS__ = 1
  1101. const m___GCC_ATOMIC_BOOL_LOCK_FREE = 2
  1102. const m___GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2
  1103. const m___GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2
  1104. const m___GCC_ATOMIC_CHAR_LOCK_FREE = 2
  1105. const m___GCC_ATOMIC_INT_LOCK_FREE = 2
  1106. const m___GCC_ATOMIC_LLONG_LOCK_FREE = 2
  1107. const m___GCC_ATOMIC_LONG_LOCK_FREE = 2
  1108. const m___GCC_ATOMIC_POINTER_LOCK_FREE = 2
  1109. const m___GCC_ATOMIC_SHORT_LOCK_FREE = 2
  1110. const m___GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1
  1111. const m___GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2
  1112. const m___GCC_CONSTRUCTIVE_SIZE = 64
  1113. const m___GCC_DESTRUCTIVE_SIZE = 256
  1114. const m___GCC_HAVE_DWARF2_CFI_ASM = 1
  1115. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1
  1116. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 = 1
  1117. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1
  1118. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1
  1119. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1
  1120. const m___GCC_IEC_559 = 2
  1121. const m___GCC_IEC_559_COMPLEX = 2
  1122. const m___GNUC_EXECUTION_CHARSET_NAME = "UTF-8"
  1123. const m___GNUC_MINOR__ = 2
  1124. const m___GNUC_PATCHLEVEL__ = 0
  1125. const m___GNUC_STDC_INLINE__ = 1
  1126. const m___GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE"
  1127. const m___GNUC__ = 12
  1128. const m___GXX_ABI_VERSION = 1017
  1129. const m___HAVE_SPECULATION_SAFE_VALUE = 1
  1130. const m___INT16_MAX__ = 0x7fff
  1131. const m___INT32_MAX__ = 0x7fffffff
  1132. const m___INT32_TYPE__ = "int"
  1133. const m___INT64_MAX__ = 0x7fffffffffffffff
  1134. const m___INT8_MAX__ = 0x7f
  1135. const m___INTMAX_MAX__ = 0x7fffffffffffffff
  1136. const m___INTMAX_WIDTH__ = 64
  1137. const m___INTPTR_MAX__ = 0x7fffffffffffffff
  1138. const m___INTPTR_WIDTH__ = 64
  1139. const m___INT_FAST16_MAX__ = 0x7fffffffffffffff
  1140. const m___INT_FAST16_WIDTH__ = 64
  1141. const m___INT_FAST32_MAX__ = 0x7fffffffffffffff
  1142. const m___INT_FAST32_WIDTH__ = 64
  1143. const m___INT_FAST64_MAX__ = 0x7fffffffffffffff
  1144. const m___INT_FAST64_WIDTH__ = 64
  1145. const m___INT_FAST8_MAX__ = 0x7f
  1146. const m___INT_FAST8_WIDTH__ = 8
  1147. const m___INT_LEAST16_MAX__ = 0x7fff
  1148. const m___INT_LEAST16_WIDTH__ = 16
  1149. const m___INT_LEAST32_MAX__ = 0x7fffffff
  1150. const m___INT_LEAST32_TYPE__ = "int"
  1151. const m___INT_LEAST32_WIDTH__ = 32
  1152. const m___INT_LEAST64_MAX__ = 0x7fffffffffffffff
  1153. const m___INT_LEAST64_WIDTH__ = 64
  1154. const m___INT_LEAST8_MAX__ = 0x7f
  1155. const m___INT_LEAST8_WIDTH__ = 8
  1156. const m___INT_MAX__ = 0x7fffffff
  1157. const m___INT_WIDTH__ = 32
  1158. const m___LDBL_DECIMAL_DIG__ = 36
  1159. const m___LDBL_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  1160. const m___LDBL_DIG__ = 33
  1161. const m___LDBL_EPSILON__ = 1.92592994438723585305597794258492732e-34
  1162. const m___LDBL_HAS_DENORM__ = 1
  1163. const m___LDBL_HAS_INFINITY__ = 1
  1164. const m___LDBL_HAS_QUIET_NAN__ = 1
  1165. const m___LDBL_IS_IEC_60559__ = 2
  1166. const m___LDBL_MANT_DIG__ = 113
  1167. const m___LDBL_MAX_10_EXP__ = 4932
  1168. const m___LDBL_MAX_EXP__ = 16384
  1169. const m___LDBL_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1170. const m___LDBL_MIN__ = 3.36210314311209350626267781732175260e-4932
  1171. const m___LDBL_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1172. const m___LITTLE_ENDIAN = 1234
  1173. const m___LONG_LONG_MAX__ = 0x7fffffffffffffff
  1174. const m___LONG_LONG_WIDTH__ = 64
  1175. const m___LONG_MAX = 0x7fffffffffffffff
  1176. const m___LONG_MAX__ = 0x7fffffffffffffff
  1177. const m___LONG_WIDTH__ = 64
  1178. const m___LP64__ = 1
  1179. const m___NO_INLINE__ = 1
  1180. const m___ORDER_BIG_ENDIAN__ = 4321
  1181. const m___ORDER_LITTLE_ENDIAN__ = 1234
  1182. const m___ORDER_PDP_ENDIAN__ = 3412
  1183. const m___PDP_ENDIAN = 3412
  1184. const m___PIC__ = 2
  1185. const m___PIE__ = 2
  1186. const m___PRAGMA_REDEFINE_EXTNAME = 1
  1187. const m___PRETTY_FUNCTION__ = "__func__"
  1188. const m___PTRDIFF_MAX__ = 0x7fffffffffffffff
  1189. const m___PTRDIFF_WIDTH__ = 64
  1190. const m___SCHAR_MAX__ = 0x7f
  1191. const m___SCHAR_WIDTH__ = 8
  1192. const m___SHRT_MAX__ = 0x7fff
  1193. const m___SHRT_WIDTH__ = 16
  1194. const m___SIG_ATOMIC_MAX__ = 0x7fffffff
  1195. const m___SIG_ATOMIC_TYPE__ = "int"
  1196. const m___SIG_ATOMIC_WIDTH__ = 32
  1197. const m___SIZEOF_DOUBLE__ = 8
  1198. const m___SIZEOF_FLOAT__ = 4
  1199. const m___SIZEOF_INT128__ = 16
  1200. const m___SIZEOF_INT__ = 4
  1201. const m___SIZEOF_LONG_DOUBLE__ = 8
  1202. const m___SIZEOF_LONG_LONG__ = 8
  1203. const m___SIZEOF_LONG__ = 8
  1204. const m___SIZEOF_POINTER__ = 8
  1205. const m___SIZEOF_PTRDIFF_T__ = 8
  1206. const m___SIZEOF_SHORT__ = 2
  1207. const m___SIZEOF_SIZE_T__ = 8
  1208. const m___SIZEOF_WCHAR_T__ = 4
  1209. const m___SIZEOF_WINT_T__ = 4
  1210. const m___SIZE_MAX__ = 0xffffffffffffffff
  1211. const m___SIZE_WIDTH__ = 64
  1212. const m___STDC_HOSTED__ = 1
  1213. const m___STDC_IEC_559_COMPLEX__ = 1
  1214. const m___STDC_IEC_559__ = 1
  1215. const m___STDC_IEC_60559_BFP__ = 201404
  1216. const m___STDC_IEC_60559_COMPLEX__ = 201404
  1217. const m___STDC_ISO_10646__ = 201706
  1218. const m___STDC_UTF_16__ = 1
  1219. const m___STDC_UTF_32__ = 1
  1220. const m___STDC_VERSION__ = 201710
  1221. const m___STDC__ = 1
  1222. const m___UINT16_MAX__ = 0xffff
  1223. const m___UINT32_MAX__ = 0xffffffff
  1224. const m___UINT64_MAX__ = 0xffffffffffffffff
  1225. const m___UINT8_MAX__ = 0xff
  1226. const m___UINTMAX_MAX__ = 0xffffffffffffffff
  1227. const m___UINTPTR_MAX__ = 0xffffffffffffffff
  1228. const m___UINT_FAST16_MAX__ = 0xffffffffffffffff
  1229. const m___UINT_FAST32_MAX__ = 0xffffffffffffffff
  1230. const m___UINT_FAST64_MAX__ = 0xffffffffffffffff
  1231. const m___UINT_FAST8_MAX__ = 0xff
  1232. const m___UINT_LEAST16_MAX__ = 0xffff
  1233. const m___UINT_LEAST32_MAX__ = 0xffffffff
  1234. const m___UINT_LEAST64_MAX__ = 0xffffffffffffffff
  1235. const m___UINT_LEAST8_MAX__ = 0xff
  1236. const m___USE_TIME_BITS64 = 1
  1237. const m___VERSION__ = "12.2.0"
  1238. const m___WCHAR_MAX__ = 0xffffffff
  1239. const m___WCHAR_MIN__ = 0
  1240. const m___WCHAR_WIDTH__ = 32
  1241. const m___WINT_MAX__ = 0xffffffff
  1242. const m___WINT_MIN__ = 0
  1243. const m___WINT_WIDTH__ = 32
  1244. const m___aarch64__ = 1
  1245. const m___gnu_linux__ = 1
  1246. const m___inline = "inline"
  1247. const m___linux = 1
  1248. const m___linux__ = 1
  1249. const m___pic__ = 2
  1250. const m___pie__ = 2
  1251. const m___restrict = "restrict"
  1252. const m___restrict_arr = "restrict"
  1253. const m___unix = 1
  1254. const m___unix__ = 1
  1255. const m_alloca = "__builtin_alloca"
  1256. const m_inline = "__inline"
  1257. const m_linux = 1
  1258. const m_loff_t = "off_t"
  1259. const m_math_errhandling = 2
  1260. const m_static_assert = "_Static_assert"
  1261. const m_unix = 1
  1262. type t__builtin_va_list = uintptr
  1263. type t__predefined_size_t = uint64
  1264. type t__predefined_wchar_t = uint32
  1265. type t__predefined_ptrdiff_t = int64
  1266. type Twchar_t = uint32
  1267. type Tmax_align_t = struct {
  1268. F__ll int64
  1269. F__ld float64
  1270. }
  1271. type Tsize_t = uint64
  1272. type Tptrdiff_t = int64
  1273. type Tlocale_t = uintptr
  1274. type Tssize_t = int64
  1275. type Toff_t = int64
  1276. type Tva_list = uintptr
  1277. type t__isoc_va_list = uintptr
  1278. type Tfpos_t = struct {
  1279. F__lldata [0]int64
  1280. F__align [0]float64
  1281. F__opaque [16]uint8
  1282. }
  1283. type T_G_fpos64_t = Tfpos_t
  1284. type Tcookie_io_functions_t = struct {
  1285. Fread uintptr
  1286. Fwrite uintptr
  1287. Fseek uintptr
  1288. Fclose1 uintptr
  1289. }
  1290. type T_IO_cookie_io_functions_t = Tcookie_io_functions_t
  1291. type Tdiv_t = struct {
  1292. Fquot int32
  1293. Frem int32
  1294. }
  1295. type Tldiv_t = struct {
  1296. Fquot int64
  1297. Frem int64
  1298. }
  1299. type Tlldiv_t = struct {
  1300. Fquot int64
  1301. Frem int64
  1302. }
  1303. type Tuintptr_t = uint64
  1304. type Tintptr_t = int64
  1305. type Tint8_t = int8
  1306. type Tint16_t = int16
  1307. type Tint32_t = int32
  1308. type Tint64_t = int64
  1309. type Tintmax_t = int64
  1310. type Tuint8_t = uint8
  1311. type Tuint16_t = uint16
  1312. type Tuint32_t = uint32
  1313. type Tuint64_t = uint64
  1314. type Tuintmax_t = uint64
  1315. type Tint_fast8_t = int8
  1316. type Tint_fast64_t = int64
  1317. type Tint_least8_t = int8
  1318. type Tint_least16_t = int16
  1319. type Tint_least32_t = int32
  1320. type Tint_least64_t = int64
  1321. type Tuint_fast8_t = uint8
  1322. type Tuint_fast64_t = uint64
  1323. type Tuint_least8_t = uint8
  1324. type Tuint_least16_t = uint16
  1325. type Tuint_least32_t = uint32
  1326. type Tuint_least64_t = uint64
  1327. type Tint_fast16_t = int32
  1328. type Tint_fast32_t = int32
  1329. type Tuint_fast16_t = uint32
  1330. type Tuint_fast32_t = uint32
  1331. type Tfloat_t = float32
  1332. type Tdouble_t = float64
  1333. type Ttime_t = int64
  1334. type Tsuseconds_t = int64
  1335. type Ttimeval = struct {
  1336. Ftv_sec Ttime_t
  1337. Ftv_usec Tsuseconds_t
  1338. }
  1339. type Ttimespec = struct {
  1340. Ftv_sec Ttime_t
  1341. Ftv_nsec int64
  1342. }
  1343. type Tsigset_t = struct {
  1344. F__bits [16]uint64
  1345. }
  1346. type t__sigset_t = Tsigset_t
  1347. type Tfd_mask = uint64
  1348. type Tfd_set = struct {
  1349. Ffds_bits [16]uint64
  1350. }
  1351. type Titimerval = struct {
  1352. Fit_interval Ttimeval
  1353. Fit_value Ttimeval
  1354. }
  1355. type Ttimezone = struct {
  1356. Ftz_minuteswest int32
  1357. Ftz_dsttime int32
  1358. }
  1359. type Tblksize_t = int32
  1360. type Tnlink_t = uint32
  1361. type Tregister_t = int64
  1362. type Tu_int64_t = uint64
  1363. type Tmode_t = uint32
  1364. type Tino_t = uint64
  1365. type Tdev_t = uint64
  1366. type Tblkcnt_t = int64
  1367. type Tfsblkcnt_t = uint64
  1368. type Tfsfilcnt_t = uint64
  1369. type Ttimer_t = uintptr
  1370. type Tclockid_t = int32
  1371. type Tclock_t = int64
  1372. type Tpid_t = int32
  1373. type Tid_t = uint32
  1374. type Tuid_t = uint32
  1375. type Tgid_t = uint32
  1376. type Tkey_t = int32
  1377. type Tuseconds_t = uint32
  1378. type Tpthread_t = uintptr
  1379. type Tpthread_once_t = int32
  1380. type Tpthread_key_t = uint32
  1381. type Tpthread_spinlock_t = int32
  1382. type Tpthread_mutexattr_t = struct {
  1383. F__attr uint32
  1384. }
  1385. type Tpthread_condattr_t = struct {
  1386. F__attr uint32
  1387. }
  1388. type Tpthread_barrierattr_t = struct {
  1389. F__attr uint32
  1390. }
  1391. type Tpthread_rwlockattr_t = struct {
  1392. F__attr [2]uint32
  1393. }
  1394. type Tpthread_attr_t = struct {
  1395. F__u struct {
  1396. F__vi [0][14]int32
  1397. F__s [0][7]uint64
  1398. F__i [14]int32
  1399. }
  1400. }
  1401. type Tpthread_mutex_t = struct {
  1402. F__u struct {
  1403. F__vi [0][10]int32
  1404. F__p [0][5]uintptr
  1405. F__i [10]int32
  1406. }
  1407. }
  1408. type Tpthread_cond_t = struct {
  1409. F__u struct {
  1410. F__vi [0][12]int32
  1411. F__p [0][6]uintptr
  1412. F__i [12]int32
  1413. }
  1414. }
  1415. type Tpthread_rwlock_t = struct {
  1416. F__u struct {
  1417. F__vi [0][14]int32
  1418. F__p [0][7]uintptr
  1419. F__i [14]int32
  1420. }
  1421. }
  1422. type Tpthread_barrier_t = struct {
  1423. F__u struct {
  1424. F__vi [0][8]int32
  1425. F__p [0][4]uintptr
  1426. F__i [8]int32
  1427. }
  1428. }
  1429. type Tu_int8_t = uint8
  1430. type Tu_int16_t = uint16
  1431. type Tu_int32_t = uint32
  1432. type Tcaddr_t = uintptr
  1433. type Tu_char = uint8
  1434. type Tu_short = uint16
  1435. type Tushort = uint16
  1436. type Tu_int = uint32
  1437. type Tuint = uint32
  1438. type Tu_long = uint64
  1439. type Tulong = uint64
  1440. type Tquad_t = int64
  1441. type Tu_quad_t = uint64
  1442. type Tiovec = struct {
  1443. Fiov_base uintptr
  1444. Fiov_len Tsize_t
  1445. }
  1446. type Tflock = struct {
  1447. Fl_type int16
  1448. Fl_whence int16
  1449. Fl_start Toff_t
  1450. Fl_len Toff_t
  1451. Fl_pid Tpid_t
  1452. }
  1453. type Tfile_handle = struct {
  1454. Fhandle_bytes uint32
  1455. Fhandle_type int32
  1456. }
  1457. type Tf_owner_ex = struct {
  1458. Ftype1 int32
  1459. Fpid Tpid_t
  1460. }
  1461. type TXML_Char = uint8
  1462. type TXML_LChar = uint8
  1463. type TXML_Index = int64
  1464. type TXML_Size = uint64
  1465. type TXML_ParserStruct = struct {
  1466. Fm_userData uintptr
  1467. Fm_handlerArg uintptr
  1468. Fm_buffer uintptr
  1469. Fm_mem TXML_Memory_Handling_Suite
  1470. Fm_bufferPtr uintptr
  1471. Fm_bufferEnd uintptr
  1472. Fm_bufferLim uintptr
  1473. Fm_parseEndByteIndex TXML_Index
  1474. Fm_parseEndPtr uintptr
  1475. Fm_dataBuf uintptr
  1476. Fm_dataBufEnd uintptr
  1477. Fm_startElementHandler TXML_StartElementHandler
  1478. Fm_endElementHandler TXML_EndElementHandler
  1479. Fm_characterDataHandler TXML_CharacterDataHandler
  1480. Fm_processingInstructionHandler TXML_ProcessingInstructionHandler
  1481. Fm_commentHandler TXML_CommentHandler
  1482. Fm_startCdataSectionHandler TXML_StartCdataSectionHandler
  1483. Fm_endCdataSectionHandler TXML_EndCdataSectionHandler
  1484. Fm_defaultHandler TXML_DefaultHandler
  1485. Fm_startDoctypeDeclHandler TXML_StartDoctypeDeclHandler
  1486. Fm_endDoctypeDeclHandler TXML_EndDoctypeDeclHandler
  1487. Fm_unparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  1488. Fm_notationDeclHandler TXML_NotationDeclHandler
  1489. Fm_startNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  1490. Fm_endNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  1491. Fm_notStandaloneHandler TXML_NotStandaloneHandler
  1492. Fm_externalEntityRefHandler TXML_ExternalEntityRefHandler
  1493. Fm_externalEntityRefHandlerArg TXML_Parser
  1494. Fm_skippedEntityHandler TXML_SkippedEntityHandler
  1495. Fm_unknownEncodingHandler TXML_UnknownEncodingHandler
  1496. Fm_elementDeclHandler TXML_ElementDeclHandler
  1497. Fm_attlistDeclHandler TXML_AttlistDeclHandler
  1498. Fm_entityDeclHandler TXML_EntityDeclHandler
  1499. Fm_xmlDeclHandler TXML_XmlDeclHandler
  1500. Fm_encoding uintptr
  1501. Fm_initEncoding TINIT_ENCODING
  1502. Fm_internalEncoding uintptr
  1503. Fm_protocolEncodingName uintptr
  1504. Fm_ns TXML_Bool
  1505. Fm_ns_triplets TXML_Bool
  1506. Fm_unknownEncodingMem uintptr
  1507. Fm_unknownEncodingData uintptr
  1508. Fm_unknownEncodingHandlerData uintptr
  1509. Fm_unknownEncodingRelease uintptr
  1510. Fm_prologState TPROLOG_STATE
  1511. Fm_processor uintptr
  1512. Fm_errorCode _XML_Error
  1513. Fm_eventPtr uintptr
  1514. Fm_eventEndPtr uintptr
  1515. Fm_positionPtr uintptr
  1516. Fm_openInternalEntities uintptr
  1517. Fm_freeInternalEntities uintptr
  1518. Fm_defaultExpandInternalEntities TXML_Bool
  1519. Fm_tagLevel int32
  1520. Fm_declEntity uintptr
  1521. Fm_doctypeName uintptr
  1522. Fm_doctypeSysid uintptr
  1523. Fm_doctypePubid uintptr
  1524. Fm_declAttributeType uintptr
  1525. Fm_declNotationName uintptr
  1526. Fm_declNotationPublicId uintptr
  1527. Fm_declElementType uintptr
  1528. Fm_declAttributeId uintptr
  1529. Fm_declAttributeIsCdata TXML_Bool
  1530. Fm_declAttributeIsId TXML_Bool
  1531. Fm_dtd uintptr
  1532. Fm_curBase uintptr
  1533. Fm_tagStack uintptr
  1534. Fm_freeTagList uintptr
  1535. Fm_inheritedBindings uintptr
  1536. Fm_freeBindingList uintptr
  1537. Fm_attsSize int32
  1538. Fm_nSpecifiedAtts int32
  1539. Fm_idAttIndex int32
  1540. Fm_atts uintptr
  1541. Fm_nsAtts uintptr
  1542. Fm_nsAttsVersion uint64
  1543. Fm_nsAttsPower uint8
  1544. Fm_position TPOSITION
  1545. Fm_tempPool TSTRING_POOL
  1546. Fm_temp2Pool TSTRING_POOL
  1547. Fm_groupConnector uintptr
  1548. Fm_groupSize uint32
  1549. Fm_namespaceSeparator TXML_Char
  1550. Fm_parentParser TXML_Parser
  1551. Fm_parsingStatus TXML_ParsingStatus
  1552. Fm_isParamEntity TXML_Bool
  1553. Fm_useForeignDTD TXML_Bool
  1554. Fm_paramEntityParsing _XML_ParamEntityParsing
  1555. Fm_hash_secret_salt uint64
  1556. Fm_accounting TACCOUNTING
  1557. Fm_entity_stats TENTITY_STATS
  1558. }
  1559. type _XML_Error = int32
  1560. const _XML_ERROR_NONE = 0
  1561. const _XML_ERROR_NO_MEMORY = 1
  1562. const _XML_ERROR_SYNTAX = 2
  1563. const _XML_ERROR_NO_ELEMENTS = 3
  1564. const _XML_ERROR_INVALID_TOKEN = 4
  1565. const _XML_ERROR_UNCLOSED_TOKEN = 5
  1566. const _XML_ERROR_PARTIAL_CHAR = 6
  1567. const _XML_ERROR_TAG_MISMATCH = 7
  1568. const _XML_ERROR_DUPLICATE_ATTRIBUTE = 8
  1569. const _XML_ERROR_JUNK_AFTER_DOC_ELEMENT = 9
  1570. const _XML_ERROR_PARAM_ENTITY_REF = 10
  1571. const _XML_ERROR_UNDEFINED_ENTITY = 11
  1572. const _XML_ERROR_RECURSIVE_ENTITY_REF = 12
  1573. const _XML_ERROR_ASYNC_ENTITY = 13
  1574. const _XML_ERROR_BAD_CHAR_REF = 14
  1575. const _XML_ERROR_BINARY_ENTITY_REF = 15
  1576. const _XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF = 16
  1577. const _XML_ERROR_MISPLACED_XML_PI = 17
  1578. const _XML_ERROR_UNKNOWN_ENCODING = 18
  1579. const _XML_ERROR_INCORRECT_ENCODING = 19
  1580. const _XML_ERROR_UNCLOSED_CDATA_SECTION = 20
  1581. const _XML_ERROR_EXTERNAL_ENTITY_HANDLING = 21
  1582. const _XML_ERROR_NOT_STANDALONE = 22
  1583. const _XML_ERROR_UNEXPECTED_STATE = 23
  1584. const _XML_ERROR_ENTITY_DECLARED_IN_PE = 24
  1585. const _XML_ERROR_FEATURE_REQUIRES_XML_DTD = 25
  1586. const _XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING = 26
  1587. const _XML_ERROR_UNBOUND_PREFIX = 27
  1588. const _XML_ERROR_UNDECLARING_PREFIX = 28
  1589. const _XML_ERROR_INCOMPLETE_PE = 29
  1590. const _XML_ERROR_XML_DECL = 30
  1591. const _XML_ERROR_TEXT_DECL = 31
  1592. const _XML_ERROR_PUBLICID = 32
  1593. const _XML_ERROR_SUSPENDED = 33
  1594. const _XML_ERROR_NOT_SUSPENDED = 34
  1595. const _XML_ERROR_ABORTED = 35
  1596. const _XML_ERROR_FINISHED = 36
  1597. const _XML_ERROR_SUSPEND_PE = 37
  1598. const _XML_ERROR_RESERVED_PREFIX_XML = 38
  1599. const _XML_ERROR_RESERVED_PREFIX_XMLNS = 39
  1600. const _XML_ERROR_RESERVED_NAMESPACE_URI = 40
  1601. const _XML_ERROR_INVALID_ARGUMENT = 41
  1602. const _XML_ERROR_NO_BUFFER = 42
  1603. const _XML_ERROR_AMPLIFICATION_LIMIT_BREACH = 43
  1604. type _XML_ParamEntityParsing = int32
  1605. const _XML_PARAM_ENTITY_PARSING_NEVER = 0
  1606. const _XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE = 1
  1607. const _XML_PARAM_ENTITY_PARSING_ALWAYS = 2
  1608. type TXML_Parser = uintptr
  1609. type TXML_Bool = uint8
  1610. type _XML_Status = int32
  1611. const _XML_STATUS_ERROR = 0
  1612. const _XML_STATUS_OK = 1
  1613. const _XML_STATUS_SUSPENDED = 2
  1614. type _XML_Content_Type = int32
  1615. const _XML_CTYPE_EMPTY = 1
  1616. const _XML_CTYPE_ANY = 2
  1617. const _XML_CTYPE_MIXED = 3
  1618. const _XML_CTYPE_NAME = 4
  1619. const _XML_CTYPE_CHOICE = 5
  1620. const _XML_CTYPE_SEQ = 6
  1621. type _XML_Content_Quant = int32
  1622. const _XML_CQUANT_NONE = 0
  1623. const _XML_CQUANT_OPT = 1
  1624. const _XML_CQUANT_REP = 2
  1625. const _XML_CQUANT_PLUS = 3
  1626. type TXML_Content = struct {
  1627. Ftype1 _XML_Content_Type
  1628. Fquant _XML_Content_Quant
  1629. Fname uintptr
  1630. Fnumchildren uint32
  1631. Fchildren uintptr
  1632. }
  1633. type TXML_cp = TXML_Content
  1634. type TXML_ElementDeclHandler = uintptr
  1635. type TXML_AttlistDeclHandler = uintptr
  1636. type TXML_XmlDeclHandler = uintptr
  1637. type TXML_Memory_Handling_Suite = struct {
  1638. Fmalloc_fcn uintptr
  1639. Frealloc_fcn uintptr
  1640. Ffree_fcn uintptr
  1641. }
  1642. type TXML_StartElementHandler = uintptr
  1643. type TXML_EndElementHandler = uintptr
  1644. type TXML_CharacterDataHandler = uintptr
  1645. type TXML_ProcessingInstructionHandler = uintptr
  1646. type TXML_CommentHandler = uintptr
  1647. type TXML_StartCdataSectionHandler = uintptr
  1648. type TXML_EndCdataSectionHandler = uintptr
  1649. type TXML_DefaultHandler = uintptr
  1650. type TXML_StartDoctypeDeclHandler = uintptr
  1651. type TXML_EndDoctypeDeclHandler = uintptr
  1652. type TXML_EntityDeclHandler = uintptr
  1653. type TXML_UnparsedEntityDeclHandler = uintptr
  1654. type TXML_NotationDeclHandler = uintptr
  1655. type TXML_StartNamespaceDeclHandler = uintptr
  1656. type TXML_EndNamespaceDeclHandler = uintptr
  1657. type TXML_NotStandaloneHandler = uintptr
  1658. type TXML_ExternalEntityRefHandler = uintptr
  1659. type TXML_SkippedEntityHandler = uintptr
  1660. type TXML_Encoding = struct {
  1661. Fmap1 [256]int32
  1662. Fdata uintptr
  1663. Fconvert uintptr
  1664. Frelease uintptr
  1665. }
  1666. type TXML_UnknownEncodingHandler = uintptr
  1667. type _XML_Parsing = int32
  1668. const _XML_INITIALIZED = 0
  1669. const _XML_PARSING = 1
  1670. const _XML_FINISHED = 2
  1671. const _XML_SUSPENDED = 3
  1672. type TXML_ParsingStatus = struct {
  1673. Fparsing _XML_Parsing
  1674. FfinalBuffer TXML_Bool
  1675. }
  1676. type TXML_Expat_Version = struct {
  1677. Fmajor int32
  1678. Fminor int32
  1679. Fmicro int32
  1680. }
  1681. type _XML_FeatureEnum = int32
  1682. const _XML_FEATURE_END = 0
  1683. const _XML_FEATURE_UNICODE = 1
  1684. const _XML_FEATURE_UNICODE_WCHAR_T = 2
  1685. const _XML_FEATURE_DTD = 3
  1686. const _XML_FEATURE_CONTEXT_BYTES = 4
  1687. const _XML_FEATURE_MIN_SIZE = 5
  1688. const _XML_FEATURE_SIZEOF_XML_CHAR = 6
  1689. const _XML_FEATURE_SIZEOF_XML_LCHAR = 7
  1690. const _XML_FEATURE_NS = 8
  1691. const _XML_FEATURE_LARGE_SIZE = 9
  1692. const _XML_FEATURE_ATTR_INFO = 10
  1693. const _XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT = 11
  1694. const _XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT = 12
  1695. type TXML_Feature = struct {
  1696. Ffeature _XML_FeatureEnum
  1697. Fname uintptr
  1698. Fvalue int64
  1699. }
  1700. type Tsiphash = struct {
  1701. Fv0 Tuint64_t
  1702. Fv1 Tuint64_t
  1703. Fv2 Tuint64_t
  1704. Fv3 Tuint64_t
  1705. Fbuf [8]uint8
  1706. Fp uintptr
  1707. Fc Tuint64_t
  1708. }
  1709. type Tsipkey = struct {
  1710. Fk [2]Tuint64_t
  1711. }
  1712. func _sip_tokey(tls *libc.TLS, key uintptr, src uintptr) (r uintptr) {
  1713. *(*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)
  1714. *(*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)
  1715. return key
  1716. }
  1717. func _sip_round(tls *libc.TLS, H uintptr, rounds int32) {
  1718. var i int32
  1719. _ = i
  1720. i = 0
  1721. for {
  1722. if !(i < rounds) {
  1723. break
  1724. }
  1725. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1726. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(13) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(13))
  1727. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1728. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = (*Tsiphash)(unsafe.Pointer(H)).Fv0<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv0>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1729. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1730. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(16) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(16))
  1731. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1732. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1733. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(21) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(21))
  1734. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1735. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1736. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(17) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(17))
  1737. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1738. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = (*Tsiphash)(unsafe.Pointer(H)).Fv2<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv2>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1739. goto _1
  1740. _1:
  1741. ;
  1742. i++
  1743. }
  1744. }
  1745. func _sip24_init(tls *libc.TLS, H uintptr, key uintptr) (r uintptr) {
  1746. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = libc.Uint64FromUint32(0x736f6d65)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x70736575)) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1747. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = libc.Uint64FromUint32(0x646f7261)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x6e646f6d)) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1748. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = libc.Uint64FromUint32(0x6c796765)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x6e657261)) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1749. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = libc.Uint64FromUint32(0x74656462)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x79746573)) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1750. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1751. (*Tsiphash)(unsafe.Pointer(H)).Fc = uint64(0)
  1752. return H
  1753. }
  1754. func _sip24_update(tls *libc.TLS, H uintptr, src uintptr, len1 Tsize_t) (r uintptr) {
  1755. var m Tuint64_t
  1756. var p, pe, v1, v2, v3 uintptr
  1757. _, _, _, _, _, _ = m, p, pe, v1, v2, v3
  1758. p = src
  1759. pe = p + uintptr(len1)
  1760. for cond := true; cond; cond = p < pe {
  1761. for p < pe && (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)) {
  1762. v2 = H + 40
  1763. v1 = *(*uintptr)(unsafe.Pointer(v2))
  1764. *(*uintptr)(unsafe.Pointer(v2))++
  1765. v3 = p
  1766. p++
  1767. *(*uint8)(unsafe.Pointer(v1)) = *(*uint8)(unsafe.Pointer(v3))
  1768. }
  1769. if (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)) {
  1770. break
  1771. }
  1772. 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)
  1773. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= m
  1774. _sip_round(tls, H, int32(2))
  1775. *(*Tuint64_t)(unsafe.Pointer(H)) ^= m
  1776. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1777. *(*Tuint64_t)(unsafe.Pointer(H + 48)) += uint64(8)
  1778. }
  1779. return H
  1780. }
  1781. func _sip24_final(tls *libc.TLS, H uintptr) (r Tuint64_t) {
  1782. var b Tuint64_t
  1783. var left uint8
  1784. _, _ = b, left
  1785. left = libc.Uint8FromInt64(int64((*Tsiphash)(unsafe.Pointer(H)).Fp) - t__predefined_ptrdiff_t(H+32))
  1786. b = ((*Tsiphash)(unsafe.Pointer(H)).Fc + uint64(left)) << int32(56)
  1787. switch libc.Int32FromUint8(left) {
  1788. case int32(7):
  1789. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 6))) << int32(48)
  1790. fallthrough
  1791. case int32(6):
  1792. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 5))) << int32(40)
  1793. fallthrough
  1794. case int32(5):
  1795. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 4))) << int32(32)
  1796. fallthrough
  1797. case int32(4):
  1798. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 3))) << int32(24)
  1799. fallthrough
  1800. case int32(3):
  1801. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 2))) << int32(16)
  1802. fallthrough
  1803. case int32(2):
  1804. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 1))) << int32(8)
  1805. fallthrough
  1806. case int32(1):
  1807. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32))) << 0
  1808. fallthrough
  1809. case 0:
  1810. break
  1811. }
  1812. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= b
  1813. _sip_round(tls, H, int32(2))
  1814. *(*Tuint64_t)(unsafe.Pointer(H)) ^= b
  1815. *(*Tuint64_t)(unsafe.Pointer(H + 16)) ^= uint64(0xff)
  1816. _sip_round(tls, H, int32(4))
  1817. return (*Tsiphash)(unsafe.Pointer(H)).Fv0 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv1 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv2 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1818. }
  1819. func _siphash24(tls *libc.TLS, src uintptr, len1 Tsize_t, key uintptr) (r Tuint64_t) {
  1820. bp := tls.Alloc(64)
  1821. defer tls.Free(64)
  1822. var _ /* state at bp+0 */ Tsiphash
  1823. *(*Tsiphash)(unsafe.Pointer(bp)) = Tsiphash{}
  1824. return _sip24_final(tls, _sip24_update(tls, _sip24_init(tls, bp, key), src, len1))
  1825. }
  1826. func _sip24_valid(tls *libc.TLS) (r int32) {
  1827. bp := tls.Alloc(80)
  1828. defer tls.Free(80)
  1829. var i Tsize_t
  1830. var _ /* in at bp+0 */ [64]uint8
  1831. var _ /* k at bp+64 */ Tsipkey
  1832. _ = i
  1833. _sip_tokey(tls, bp+64, __ccgo_ts)
  1834. i = uint64(0)
  1835. for {
  1836. if !(i < uint64(64)) {
  1837. break
  1838. }
  1839. (*(*[64]uint8)(unsafe.Pointer(bp)))[i] = uint8(i)
  1840. 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) {
  1841. return 0
  1842. }
  1843. goto _1
  1844. _1:
  1845. ;
  1846. i++
  1847. }
  1848. return int32(1)
  1849. }
  1850. var _vectors = [64][8]uint8{
  1851. 0: {
  1852. 0: uint8(0x31),
  1853. 1: uint8(0x0e),
  1854. 2: uint8(0x0e),
  1855. 3: uint8(0xdd),
  1856. 4: uint8(0x47),
  1857. 5: uint8(0xdb),
  1858. 6: uint8(0x6f),
  1859. 7: uint8(0x72),
  1860. },
  1861. 1: {
  1862. 0: uint8(0xfd),
  1863. 1: uint8(0x67),
  1864. 2: uint8(0xdc),
  1865. 3: uint8(0x93),
  1866. 4: uint8(0xc5),
  1867. 5: uint8(0x39),
  1868. 6: uint8(0xf8),
  1869. 7: uint8(0x74),
  1870. },
  1871. 2: {
  1872. 0: uint8(0x5a),
  1873. 1: uint8(0x4f),
  1874. 2: uint8(0xa9),
  1875. 3: uint8(0xd9),
  1876. 4: uint8(0x09),
  1877. 5: uint8(0x80),
  1878. 6: uint8(0x6c),
  1879. 7: uint8(0x0d),
  1880. },
  1881. 3: {
  1882. 0: uint8(0x2d),
  1883. 1: uint8(0x7e),
  1884. 2: uint8(0xfb),
  1885. 3: uint8(0xd7),
  1886. 4: uint8(0x96),
  1887. 5: uint8(0x66),
  1888. 6: uint8(0x67),
  1889. 7: uint8(0x85),
  1890. },
  1891. 4: {
  1892. 0: uint8(0xb7),
  1893. 1: uint8(0x87),
  1894. 2: uint8(0x71),
  1895. 3: uint8(0x27),
  1896. 4: uint8(0xe0),
  1897. 5: uint8(0x94),
  1898. 6: uint8(0x27),
  1899. 7: uint8(0xcf),
  1900. },
  1901. 5: {
  1902. 0: uint8(0x8d),
  1903. 1: uint8(0xa6),
  1904. 2: uint8(0x99),
  1905. 3: uint8(0xcd),
  1906. 4: uint8(0x64),
  1907. 5: uint8(0x55),
  1908. 6: uint8(0x76),
  1909. 7: uint8(0x18),
  1910. },
  1911. 6: {
  1912. 0: uint8(0xce),
  1913. 1: uint8(0xe3),
  1914. 2: uint8(0xfe),
  1915. 3: uint8(0x58),
  1916. 4: uint8(0x6e),
  1917. 5: uint8(0x46),
  1918. 6: uint8(0xc9),
  1919. 7: uint8(0xcb),
  1920. },
  1921. 7: {
  1922. 0: uint8(0x37),
  1923. 1: uint8(0xd1),
  1924. 2: uint8(0x01),
  1925. 3: uint8(0x8b),
  1926. 4: uint8(0xf5),
  1927. 6: uint8(0x02),
  1928. 7: uint8(0xab),
  1929. },
  1930. 8: {
  1931. 0: uint8(0x62),
  1932. 1: uint8(0x24),
  1933. 2: uint8(0x93),
  1934. 3: uint8(0x9a),
  1935. 4: uint8(0x79),
  1936. 5: uint8(0xf5),
  1937. 6: uint8(0xf5),
  1938. 7: uint8(0x93),
  1939. },
  1940. 9: {
  1941. 0: uint8(0xb0),
  1942. 1: uint8(0xe4),
  1943. 2: uint8(0xa9),
  1944. 3: uint8(0x0b),
  1945. 4: uint8(0xdf),
  1946. 5: uint8(0x82),
  1947. 7: uint8(0x9e),
  1948. },
  1949. 10: {
  1950. 0: uint8(0xf3),
  1951. 1: uint8(0xb9),
  1952. 2: uint8(0xdd),
  1953. 3: uint8(0x94),
  1954. 4: uint8(0xc5),
  1955. 5: uint8(0xbb),
  1956. 6: uint8(0x5d),
  1957. 7: uint8(0x7a),
  1958. },
  1959. 11: {
  1960. 0: uint8(0xa7),
  1961. 1: uint8(0xad),
  1962. 2: uint8(0x6b),
  1963. 3: uint8(0x22),
  1964. 4: uint8(0x46),
  1965. 5: uint8(0x2f),
  1966. 6: uint8(0xb3),
  1967. 7: uint8(0xf4),
  1968. },
  1969. 12: {
  1970. 0: uint8(0xfb),
  1971. 1: uint8(0xe5),
  1972. 2: uint8(0x0e),
  1973. 3: uint8(0x86),
  1974. 4: uint8(0xbc),
  1975. 5: uint8(0x8f),
  1976. 6: uint8(0x1e),
  1977. 7: uint8(0x75),
  1978. },
  1979. 13: {
  1980. 0: uint8(0x90),
  1981. 1: uint8(0x3d),
  1982. 2: uint8(0x84),
  1983. 3: uint8(0xc0),
  1984. 4: uint8(0x27),
  1985. 5: uint8(0x56),
  1986. 6: uint8(0xea),
  1987. 7: uint8(0x14),
  1988. },
  1989. 14: {
  1990. 0: uint8(0xee),
  1991. 1: uint8(0xf2),
  1992. 2: uint8(0x7a),
  1993. 3: uint8(0x8e),
  1994. 4: uint8(0x90),
  1995. 5: uint8(0xca),
  1996. 6: uint8(0x23),
  1997. 7: uint8(0xf7),
  1998. },
  1999. 15: {
  2000. 0: uint8(0xe5),
  2001. 1: uint8(0x45),
  2002. 2: uint8(0xbe),
  2003. 3: uint8(0x49),
  2004. 4: uint8(0x61),
  2005. 5: uint8(0xca),
  2006. 6: uint8(0x29),
  2007. 7: uint8(0xa1),
  2008. },
  2009. 16: {
  2010. 0: uint8(0xdb),
  2011. 1: uint8(0x9b),
  2012. 2: uint8(0xc2),
  2013. 3: uint8(0x57),
  2014. 4: uint8(0x7f),
  2015. 5: uint8(0xcc),
  2016. 6: uint8(0x2a),
  2017. 7: uint8(0x3f),
  2018. },
  2019. 17: {
  2020. 0: uint8(0x94),
  2021. 1: uint8(0x47),
  2022. 2: uint8(0xbe),
  2023. 3: uint8(0x2c),
  2024. 4: uint8(0xf5),
  2025. 5: uint8(0xe9),
  2026. 6: uint8(0x9a),
  2027. 7: uint8(0x69),
  2028. },
  2029. 18: {
  2030. 0: uint8(0x9c),
  2031. 1: uint8(0xd3),
  2032. 2: uint8(0x8d),
  2033. 3: uint8(0x96),
  2034. 4: uint8(0xf0),
  2035. 5: uint8(0xb3),
  2036. 6: uint8(0xc1),
  2037. 7: uint8(0x4b),
  2038. },
  2039. 19: {
  2040. 0: uint8(0xbd),
  2041. 1: uint8(0x61),
  2042. 2: uint8(0x79),
  2043. 3: uint8(0xa7),
  2044. 4: uint8(0x1d),
  2045. 5: uint8(0xc9),
  2046. 6: uint8(0x6d),
  2047. 7: uint8(0xbb),
  2048. },
  2049. 20: {
  2050. 0: uint8(0x98),
  2051. 1: uint8(0xee),
  2052. 2: uint8(0xa2),
  2053. 3: uint8(0x1a),
  2054. 4: uint8(0xf2),
  2055. 5: uint8(0x5c),
  2056. 6: uint8(0xd6),
  2057. 7: uint8(0xbe),
  2058. },
  2059. 21: {
  2060. 0: uint8(0xc7),
  2061. 1: uint8(0x67),
  2062. 2: uint8(0x3b),
  2063. 3: uint8(0x2e),
  2064. 4: uint8(0xb0),
  2065. 5: uint8(0xcb),
  2066. 6: uint8(0xf2),
  2067. 7: uint8(0xd0),
  2068. },
  2069. 22: {
  2070. 0: uint8(0x88),
  2071. 1: uint8(0x3e),
  2072. 2: uint8(0xa3),
  2073. 3: uint8(0xe3),
  2074. 4: uint8(0x95),
  2075. 5: uint8(0x67),
  2076. 6: uint8(0x53),
  2077. 7: uint8(0x93),
  2078. },
  2079. 23: {
  2080. 0: uint8(0xc8),
  2081. 1: uint8(0xce),
  2082. 2: uint8(0x5c),
  2083. 3: uint8(0xcd),
  2084. 4: uint8(0x8c),
  2085. 5: uint8(0x03),
  2086. 6: uint8(0x0c),
  2087. 7: uint8(0xa8),
  2088. },
  2089. 24: {
  2090. 0: uint8(0x94),
  2091. 1: uint8(0xaf),
  2092. 2: uint8(0x49),
  2093. 3: uint8(0xf6),
  2094. 4: uint8(0xc6),
  2095. 5: uint8(0x50),
  2096. 6: uint8(0xad),
  2097. 7: uint8(0xb8),
  2098. },
  2099. 25: {
  2100. 0: uint8(0xea),
  2101. 1: uint8(0xb8),
  2102. 2: uint8(0x85),
  2103. 3: uint8(0x8a),
  2104. 4: uint8(0xde),
  2105. 5: uint8(0x92),
  2106. 6: uint8(0xe1),
  2107. 7: uint8(0xbc),
  2108. },
  2109. 26: {
  2110. 0: uint8(0xf3),
  2111. 1: uint8(0x15),
  2112. 2: uint8(0xbb),
  2113. 3: uint8(0x5b),
  2114. 4: uint8(0xb8),
  2115. 5: uint8(0x35),
  2116. 6: uint8(0xd8),
  2117. 7: uint8(0x17),
  2118. },
  2119. 27: {
  2120. 0: uint8(0xad),
  2121. 1: uint8(0xcf),
  2122. 2: uint8(0x6b),
  2123. 3: uint8(0x07),
  2124. 4: uint8(0x63),
  2125. 5: uint8(0x61),
  2126. 6: uint8(0x2e),
  2127. 7: uint8(0x2f),
  2128. },
  2129. 28: {
  2130. 0: uint8(0xa5),
  2131. 1: uint8(0xc9),
  2132. 2: uint8(0x1d),
  2133. 3: uint8(0xa7),
  2134. 4: uint8(0xac),
  2135. 5: uint8(0xaa),
  2136. 6: uint8(0x4d),
  2137. 7: uint8(0xde),
  2138. },
  2139. 29: {
  2140. 0: uint8(0x71),
  2141. 1: uint8(0x65),
  2142. 2: uint8(0x95),
  2143. 3: uint8(0x87),
  2144. 4: uint8(0x66),
  2145. 5: uint8(0x50),
  2146. 6: uint8(0xa2),
  2147. 7: uint8(0xa6),
  2148. },
  2149. 30: {
  2150. 0: uint8(0x28),
  2151. 1: uint8(0xef),
  2152. 2: uint8(0x49),
  2153. 3: uint8(0x5c),
  2154. 4: uint8(0x53),
  2155. 5: uint8(0xa3),
  2156. 6: uint8(0x87),
  2157. 7: uint8(0xad),
  2158. },
  2159. 31: {
  2160. 0: uint8(0x42),
  2161. 1: uint8(0xc3),
  2162. 2: uint8(0x41),
  2163. 3: uint8(0xd8),
  2164. 4: uint8(0xfa),
  2165. 5: uint8(0x92),
  2166. 6: uint8(0xd8),
  2167. 7: uint8(0x32),
  2168. },
  2169. 32: {
  2170. 0: uint8(0xce),
  2171. 1: uint8(0x7c),
  2172. 2: uint8(0xf2),
  2173. 3: uint8(0x72),
  2174. 4: uint8(0x2f),
  2175. 5: uint8(0x51),
  2176. 6: uint8(0x27),
  2177. 7: uint8(0x71),
  2178. },
  2179. 33: {
  2180. 0: uint8(0xe3),
  2181. 1: uint8(0x78),
  2182. 2: uint8(0x59),
  2183. 3: uint8(0xf9),
  2184. 4: uint8(0x46),
  2185. 5: uint8(0x23),
  2186. 6: uint8(0xf3),
  2187. 7: uint8(0xa7),
  2188. },
  2189. 34: {
  2190. 0: uint8(0x38),
  2191. 1: uint8(0x12),
  2192. 2: uint8(0x05),
  2193. 3: uint8(0xbb),
  2194. 4: uint8(0x1a),
  2195. 5: uint8(0xb0),
  2196. 6: uint8(0xe0),
  2197. 7: uint8(0x12),
  2198. },
  2199. 35: {
  2200. 0: uint8(0xae),
  2201. 1: uint8(0x97),
  2202. 2: uint8(0xa1),
  2203. 3: uint8(0x0f),
  2204. 4: uint8(0xd4),
  2205. 5: uint8(0x34),
  2206. 6: uint8(0xe0),
  2207. 7: uint8(0x15),
  2208. },
  2209. 36: {
  2210. 0: uint8(0xb4),
  2211. 1: uint8(0xa3),
  2212. 2: uint8(0x15),
  2213. 3: uint8(0x08),
  2214. 4: uint8(0xbe),
  2215. 5: uint8(0xff),
  2216. 6: uint8(0x4d),
  2217. 7: uint8(0x31),
  2218. },
  2219. 37: {
  2220. 0: uint8(0x81),
  2221. 1: uint8(0x39),
  2222. 2: uint8(0x62),
  2223. 3: uint8(0x29),
  2224. 4: uint8(0xf0),
  2225. 5: uint8(0x90),
  2226. 6: uint8(0x79),
  2227. 7: uint8(0x02),
  2228. },
  2229. 38: {
  2230. 0: uint8(0x4d),
  2231. 1: uint8(0x0c),
  2232. 2: uint8(0xf4),
  2233. 3: uint8(0x9e),
  2234. 4: uint8(0xe5),
  2235. 5: uint8(0xd4),
  2236. 6: uint8(0xdc),
  2237. 7: uint8(0xca),
  2238. },
  2239. 39: {
  2240. 0: uint8(0x5c),
  2241. 1: uint8(0x73),
  2242. 2: uint8(0x33),
  2243. 3: uint8(0x6a),
  2244. 4: uint8(0x76),
  2245. 5: uint8(0xd8),
  2246. 6: uint8(0xbf),
  2247. 7: uint8(0x9a),
  2248. },
  2249. 40: {
  2250. 0: uint8(0xd0),
  2251. 1: uint8(0xa7),
  2252. 2: uint8(0x04),
  2253. 3: uint8(0x53),
  2254. 4: uint8(0x6b),
  2255. 5: uint8(0xa9),
  2256. 6: uint8(0x3e),
  2257. 7: uint8(0x0e),
  2258. },
  2259. 41: {
  2260. 0: uint8(0x92),
  2261. 1: uint8(0x59),
  2262. 2: uint8(0x58),
  2263. 3: uint8(0xfc),
  2264. 4: uint8(0xd6),
  2265. 5: uint8(0x42),
  2266. 6: uint8(0x0c),
  2267. 7: uint8(0xad),
  2268. },
  2269. 42: {
  2270. 0: uint8(0xa9),
  2271. 1: uint8(0x15),
  2272. 2: uint8(0xc2),
  2273. 3: uint8(0x9b),
  2274. 4: uint8(0xc8),
  2275. 5: uint8(0x06),
  2276. 6: uint8(0x73),
  2277. 7: uint8(0x18),
  2278. },
  2279. 43: {
  2280. 0: uint8(0x95),
  2281. 1: uint8(0x2b),
  2282. 2: uint8(0x79),
  2283. 3: uint8(0xf3),
  2284. 4: uint8(0xbc),
  2285. 5: uint8(0x0a),
  2286. 6: uint8(0xa6),
  2287. 7: uint8(0xd4),
  2288. },
  2289. 44: {
  2290. 0: uint8(0xf2),
  2291. 1: uint8(0x1d),
  2292. 2: uint8(0xf2),
  2293. 3: uint8(0xe4),
  2294. 4: uint8(0x1d),
  2295. 5: uint8(0x45),
  2296. 6: uint8(0x35),
  2297. 7: uint8(0xf9),
  2298. },
  2299. 45: {
  2300. 0: uint8(0x87),
  2301. 1: uint8(0x57),
  2302. 2: uint8(0x75),
  2303. 3: uint8(0x19),
  2304. 4: uint8(0x04),
  2305. 5: uint8(0x8f),
  2306. 6: uint8(0x53),
  2307. 7: uint8(0xa9),
  2308. },
  2309. 46: {
  2310. 0: uint8(0x10),
  2311. 1: uint8(0xa5),
  2312. 2: uint8(0x6c),
  2313. 3: uint8(0xf5),
  2314. 4: uint8(0xdf),
  2315. 5: uint8(0xcd),
  2316. 6: uint8(0x9a),
  2317. 7: uint8(0xdb),
  2318. },
  2319. 47: {
  2320. 0: uint8(0xeb),
  2321. 1: uint8(0x75),
  2322. 2: uint8(0x09),
  2323. 3: uint8(0x5c),
  2324. 4: uint8(0xcd),
  2325. 5: uint8(0x98),
  2326. 6: uint8(0x6c),
  2327. 7: uint8(0xd0),
  2328. },
  2329. 48: {
  2330. 0: uint8(0x51),
  2331. 1: uint8(0xa9),
  2332. 2: uint8(0xcb),
  2333. 3: uint8(0x9e),
  2334. 4: uint8(0xcb),
  2335. 5: uint8(0xa3),
  2336. 6: uint8(0x12),
  2337. 7: uint8(0xe6),
  2338. },
  2339. 49: {
  2340. 0: uint8(0x96),
  2341. 1: uint8(0xaf),
  2342. 2: uint8(0xad),
  2343. 3: uint8(0xfc),
  2344. 4: uint8(0x2c),
  2345. 5: uint8(0xe6),
  2346. 6: uint8(0x66),
  2347. 7: uint8(0xc7),
  2348. },
  2349. 50: {
  2350. 0: uint8(0x72),
  2351. 1: uint8(0xfe),
  2352. 2: uint8(0x52),
  2353. 3: uint8(0x97),
  2354. 4: uint8(0x5a),
  2355. 5: uint8(0x43),
  2356. 6: uint8(0x64),
  2357. 7: uint8(0xee),
  2358. },
  2359. 51: {
  2360. 0: uint8(0x5a),
  2361. 1: uint8(0x16),
  2362. 2: uint8(0x45),
  2363. 3: uint8(0xb2),
  2364. 4: uint8(0x76),
  2365. 5: uint8(0xd5),
  2366. 6: uint8(0x92),
  2367. 7: uint8(0xa1),
  2368. },
  2369. 52: {
  2370. 0: uint8(0xb2),
  2371. 1: uint8(0x74),
  2372. 2: uint8(0xcb),
  2373. 3: uint8(0x8e),
  2374. 4: uint8(0xbf),
  2375. 5: uint8(0x87),
  2376. 6: uint8(0x87),
  2377. 7: uint8(0x0a),
  2378. },
  2379. 53: {
  2380. 0: uint8(0x6f),
  2381. 1: uint8(0x9b),
  2382. 2: uint8(0xb4),
  2383. 3: uint8(0x20),
  2384. 4: uint8(0x3d),
  2385. 5: uint8(0xe7),
  2386. 6: uint8(0xb3),
  2387. 7: uint8(0x81),
  2388. },
  2389. 54: {
  2390. 0: uint8(0xea),
  2391. 1: uint8(0xec),
  2392. 2: uint8(0xb2),
  2393. 3: uint8(0xa3),
  2394. 4: uint8(0x0b),
  2395. 5: uint8(0x22),
  2396. 6: uint8(0xa8),
  2397. 7: uint8(0x7f),
  2398. },
  2399. 55: {
  2400. 0: uint8(0x99),
  2401. 1: uint8(0x24),
  2402. 2: uint8(0xa4),
  2403. 3: uint8(0x3c),
  2404. 4: uint8(0xc1),
  2405. 5: uint8(0x31),
  2406. 6: uint8(0x57),
  2407. 7: uint8(0x24),
  2408. },
  2409. 56: {
  2410. 0: uint8(0xbd),
  2411. 1: uint8(0x83),
  2412. 2: uint8(0x8d),
  2413. 3: uint8(0x3a),
  2414. 4: uint8(0xaf),
  2415. 5: uint8(0xbf),
  2416. 6: uint8(0x8d),
  2417. 7: uint8(0xb7),
  2418. },
  2419. 57: {
  2420. 0: uint8(0x0b),
  2421. 1: uint8(0x1a),
  2422. 2: uint8(0x2a),
  2423. 3: uint8(0x32),
  2424. 4: uint8(0x65),
  2425. 5: uint8(0xd5),
  2426. 6: uint8(0x1a),
  2427. 7: uint8(0xea),
  2428. },
  2429. 58: {
  2430. 0: uint8(0x13),
  2431. 1: uint8(0x50),
  2432. 2: uint8(0x79),
  2433. 3: uint8(0xa3),
  2434. 4: uint8(0x23),
  2435. 5: uint8(0x1c),
  2436. 6: uint8(0xe6),
  2437. 7: uint8(0x60),
  2438. },
  2439. 59: {
  2440. 0: uint8(0x93),
  2441. 1: uint8(0x2b),
  2442. 2: uint8(0x28),
  2443. 3: uint8(0x46),
  2444. 4: uint8(0xe4),
  2445. 5: uint8(0xd7),
  2446. 6: uint8(0x06),
  2447. 7: uint8(0x66),
  2448. },
  2449. 60: {
  2450. 0: uint8(0xe1),
  2451. 1: uint8(0x91),
  2452. 2: uint8(0x5f),
  2453. 3: uint8(0x5c),
  2454. 4: uint8(0xb1),
  2455. 5: uint8(0xec),
  2456. 6: uint8(0xa4),
  2457. 7: uint8(0x6c),
  2458. },
  2459. 61: {
  2460. 0: uint8(0xf3),
  2461. 1: uint8(0x25),
  2462. 2: uint8(0x96),
  2463. 3: uint8(0x5c),
  2464. 4: uint8(0xa1),
  2465. 5: uint8(0x6d),
  2466. 6: uint8(0x62),
  2467. 7: uint8(0x9f),
  2468. },
  2469. 62: {
  2470. 0: uint8(0x57),
  2471. 1: uint8(0x5f),
  2472. 2: uint8(0xf2),
  2473. 3: uint8(0x8e),
  2474. 4: uint8(0x60),
  2475. 5: uint8(0x38),
  2476. 6: uint8(0x1b),
  2477. 7: uint8(0xe5),
  2478. },
  2479. 63: {
  2480. 0: uint8(0x72),
  2481. 1: uint8(0x45),
  2482. 2: uint8(0x06),
  2483. 3: uint8(0xeb),
  2484. 4: uint8(0x4c),
  2485. 5: uint8(0x32),
  2486. 6: uint8(0x8a),
  2487. 7: uint8(0x95),
  2488. },
  2489. }
  2490. type TICHAR = uint8
  2491. type TPOSITION = struct {
  2492. FlineNumber TXML_Size
  2493. FcolumnNumber TXML_Size
  2494. }
  2495. type Tposition = TPOSITION
  2496. type TATTRIBUTE = struct {
  2497. Fname uintptr
  2498. FvaluePtr uintptr
  2499. FvalueEnd uintptr
  2500. Fnormalized uint8
  2501. }
  2502. type Tencoding = struct {
  2503. Fscanners [4]TSCANNER
  2504. FliteralScanners [2]TSCANNER
  2505. FnameMatchesAscii uintptr
  2506. FnameLength uintptr
  2507. FskipS uintptr
  2508. FgetAtts uintptr
  2509. FcharRefNumber uintptr
  2510. FpredefinedEntityName uintptr
  2511. FupdatePosition uintptr
  2512. FisPublicId uintptr
  2513. Futf8Convert uintptr
  2514. Futf16Convert uintptr
  2515. FminBytesPerChar int32
  2516. FisUtf8 uint8
  2517. FisUtf16 uint8
  2518. }
  2519. type TENCODING = struct {
  2520. Fscanners [4]TSCANNER
  2521. FliteralScanners [2]TSCANNER
  2522. FnameMatchesAscii uintptr
  2523. FnameLength uintptr
  2524. FskipS uintptr
  2525. FgetAtts uintptr
  2526. FcharRefNumber uintptr
  2527. FpredefinedEntityName uintptr
  2528. FupdatePosition uintptr
  2529. FisPublicId uintptr
  2530. Futf8Convert uintptr
  2531. Futf16Convert uintptr
  2532. FminBytesPerChar int32
  2533. FisUtf8 uint8
  2534. FisUtf16 uint8
  2535. }
  2536. type TSCANNER = uintptr
  2537. type _XML_Convert_Result = int32
  2538. const _XML_CONVERT_COMPLETED = 0
  2539. const _XML_CONVERT_INPUT_INCOMPLETE = 1
  2540. const _XML_CONVERT_OUTPUT_EXHAUSTED = 2
  2541. type TINIT_ENCODING = struct {
  2542. FinitEnc TENCODING
  2543. FencPtr uintptr
  2544. }
  2545. type TCONVERTER = uintptr
  2546. const _XML_ROLE_ERROR = -1
  2547. const _XML_ROLE_NONE = 0
  2548. const _XML_ROLE_XML_DECL = 1
  2549. const _XML_ROLE_INSTANCE_START = 2
  2550. const _XML_ROLE_DOCTYPE_NONE = 3
  2551. const _XML_ROLE_DOCTYPE_NAME = 4
  2552. const _XML_ROLE_DOCTYPE_SYSTEM_ID = 5
  2553. const _XML_ROLE_DOCTYPE_PUBLIC_ID = 6
  2554. const _XML_ROLE_DOCTYPE_INTERNAL_SUBSET = 7
  2555. const _XML_ROLE_DOCTYPE_CLOSE = 8
  2556. const _XML_ROLE_GENERAL_ENTITY_NAME = 9
  2557. const _XML_ROLE_PARAM_ENTITY_NAME = 10
  2558. const _XML_ROLE_ENTITY_NONE = 11
  2559. const _XML_ROLE_ENTITY_VALUE = 12
  2560. const _XML_ROLE_ENTITY_SYSTEM_ID = 13
  2561. const _XML_ROLE_ENTITY_PUBLIC_ID = 14
  2562. const _XML_ROLE_ENTITY_COMPLETE = 15
  2563. const _XML_ROLE_ENTITY_NOTATION_NAME = 16
  2564. const _XML_ROLE_NOTATION_NONE = 17
  2565. const _XML_ROLE_NOTATION_NAME = 18
  2566. const _XML_ROLE_NOTATION_SYSTEM_ID = 19
  2567. const _XML_ROLE_NOTATION_NO_SYSTEM_ID = 20
  2568. const _XML_ROLE_NOTATION_PUBLIC_ID = 21
  2569. const _XML_ROLE_ATTRIBUTE_NAME = 22
  2570. const _XML_ROLE_ATTRIBUTE_TYPE_CDATA = 23
  2571. const _XML_ROLE_ATTRIBUTE_TYPE_ID = 24
  2572. const _XML_ROLE_ATTRIBUTE_TYPE_IDREF = 25
  2573. const _XML_ROLE_ATTRIBUTE_TYPE_IDREFS = 26
  2574. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITY = 27
  2575. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITIES = 28
  2576. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN = 29
  2577. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS = 30
  2578. const _XML_ROLE_ATTRIBUTE_ENUM_VALUE = 31
  2579. const _XML_ROLE_ATTRIBUTE_NOTATION_VALUE = 32
  2580. const _XML_ROLE_ATTLIST_NONE = 33
  2581. const _XML_ROLE_ATTLIST_ELEMENT_NAME = 34
  2582. const _XML_ROLE_IMPLIED_ATTRIBUTE_VALUE = 35
  2583. const _XML_ROLE_REQUIRED_ATTRIBUTE_VALUE = 36
  2584. const _XML_ROLE_DEFAULT_ATTRIBUTE_VALUE = 37
  2585. const _XML_ROLE_FIXED_ATTRIBUTE_VALUE = 38
  2586. const _XML_ROLE_ELEMENT_NONE = 39
  2587. const _XML_ROLE_ELEMENT_NAME = 40
  2588. const _XML_ROLE_CONTENT_ANY = 41
  2589. const _XML_ROLE_CONTENT_EMPTY = 42
  2590. const _XML_ROLE_CONTENT_PCDATA = 43
  2591. const _XML_ROLE_GROUP_OPEN = 44
  2592. const _XML_ROLE_GROUP_CLOSE = 45
  2593. const _XML_ROLE_GROUP_CLOSE_REP = 46
  2594. const _XML_ROLE_GROUP_CLOSE_OPT = 47
  2595. const _XML_ROLE_GROUP_CLOSE_PLUS = 48
  2596. const _XML_ROLE_GROUP_CHOICE = 49
  2597. const _XML_ROLE_GROUP_SEQUENCE = 50
  2598. const _XML_ROLE_CONTENT_ELEMENT = 51
  2599. const _XML_ROLE_CONTENT_ELEMENT_REP = 52
  2600. const _XML_ROLE_CONTENT_ELEMENT_OPT = 53
  2601. const _XML_ROLE_CONTENT_ELEMENT_PLUS = 54
  2602. const _XML_ROLE_PI = 55
  2603. const _XML_ROLE_COMMENT = 56
  2604. const _XML_ROLE_TEXT_DECL = 57
  2605. const _XML_ROLE_IGNORE_SECT = 58
  2606. const _XML_ROLE_INNER_PARAM_ENTITY_REF = 59
  2607. const _XML_ROLE_PARAM_ENTITY_REF = 60
  2608. type TPROLOG_STATE = struct {
  2609. Fhandler uintptr
  2610. Flevel uint32
  2611. Frole_none int32
  2612. FincludeLevel uint32
  2613. FdocumentEntity int32
  2614. FinEntityValue int32
  2615. }
  2616. type Tprolog_state = TPROLOG_STATE
  2617. type TKEY = uintptr
  2618. type TNAMED = struct {
  2619. Fname TKEY
  2620. }
  2621. type THASH_TABLE = struct {
  2622. Fv uintptr
  2623. Fpower uint8
  2624. Fsize Tsize_t
  2625. Fused Tsize_t
  2626. Fmem uintptr
  2627. }
  2628. /* For probing (after a collision) we need a step size relative prime
  2629. to the hash table size, which is a power of 2. We use double-hashing,
  2630. since we can calculate a second hash value cheaply by taking those bits
  2631. of the first hash value that were discarded (masked out) when the table
  2632. index was calculated: index = hash & mask, where mask = table->size - 1.
  2633. We limit the maximum step size to table->size / 4 (mask >> 2) and make
  2634. it odd, since odd numbers are always relative prime to a power of 2.
  2635. */
  2636. type THASH_TABLE_ITER = struct {
  2637. Fp uintptr
  2638. Fend uintptr
  2639. }
  2640. type TBINDING = struct {
  2641. Fprefix uintptr
  2642. FnextTagBinding uintptr
  2643. FprevPrefixBinding uintptr
  2644. FattId uintptr
  2645. Furi uintptr
  2646. FuriLen int32
  2647. FuriAlloc int32
  2648. }
  2649. type Tbinding = TBINDING
  2650. type TPREFIX = struct {
  2651. Fname uintptr
  2652. Fbinding uintptr
  2653. }
  2654. type Tprefix = TPREFIX
  2655. type TTAG_NAME = struct {
  2656. Fstr uintptr
  2657. FlocalPart uintptr
  2658. Fprefix uintptr
  2659. FstrLen int32
  2660. FuriLen int32
  2661. FprefixLen int32
  2662. }
  2663. // C documentation
  2664. //
  2665. // /* TAG represents an open element.
  2666. // The name of the element is stored in both the document and API
  2667. // encodings. The memory buffer 'buf' is a separately-allocated
  2668. // memory area which stores the name. During the XML_Parse()/
  2669. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2670. // version of the name (in the document encoding) is shared with the
  2671. // document buffer. If the element is open across calls to
  2672. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2673. // contain the 'raw' name as well.
  2674. //
  2675. // A parser re-uses these structures, maintaining a list of allocated
  2676. // TAG objects in a free list.
  2677. // */
  2678. type TTAG = struct {
  2679. Fparent uintptr
  2680. FrawName uintptr
  2681. FrawNameLength int32
  2682. Fname TTAG_NAME
  2683. Fbuf uintptr
  2684. FbufEnd uintptr
  2685. Fbindings uintptr
  2686. }
  2687. // C documentation
  2688. //
  2689. // /* TAG represents an open element.
  2690. // The name of the element is stored in both the document and API
  2691. // encodings. The memory buffer 'buf' is a separately-allocated
  2692. // memory area which stores the name. During the XML_Parse()/
  2693. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2694. // version of the name (in the document encoding) is shared with the
  2695. // document buffer. If the element is open across calls to
  2696. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2697. // contain the 'raw' name as well.
  2698. //
  2699. // A parser re-uses these structures, maintaining a list of allocated
  2700. // TAG objects in a free list.
  2701. // */
  2702. type Ttag = TTAG
  2703. type TENTITY = struct {
  2704. Fname uintptr
  2705. FtextPtr uintptr
  2706. FtextLen int32
  2707. Fprocessed int32
  2708. FsystemId uintptr
  2709. Fbase uintptr
  2710. FpublicId uintptr
  2711. Fnotation uintptr
  2712. Fopen TXML_Bool
  2713. Fis_param TXML_Bool
  2714. Fis_internal TXML_Bool
  2715. }
  2716. type TCONTENT_SCAFFOLD = struct {
  2717. Ftype1 _XML_Content_Type
  2718. Fquant _XML_Content_Quant
  2719. Fname uintptr
  2720. Ffirstchild int32
  2721. Flastchild int32
  2722. Fchildcnt int32
  2723. Fnextsib int32
  2724. }
  2725. type TBLOCK = struct {
  2726. Fnext uintptr
  2727. Fsize int32
  2728. Fs [1]TXML_Char
  2729. }
  2730. type Tblock = TBLOCK
  2731. type TSTRING_POOL = struct {
  2732. Fblocks uintptr
  2733. FfreeBlocks uintptr
  2734. Fend uintptr
  2735. Fptr uintptr
  2736. Fstart uintptr
  2737. Fmem uintptr
  2738. }
  2739. // C documentation
  2740. //
  2741. // /* The XML_Char before the name is used to determine whether
  2742. // an attribute has been specified. */
  2743. type TATTRIBUTE_ID = struct {
  2744. Fname uintptr
  2745. Fprefix uintptr
  2746. FmaybeTokenized TXML_Bool
  2747. Fxmlns TXML_Bool
  2748. }
  2749. // C documentation
  2750. //
  2751. // /* The XML_Char before the name is used to determine whether
  2752. // an attribute has been specified. */
  2753. type Tattribute_id = TATTRIBUTE_ID
  2754. type TDEFAULT_ATTRIBUTE = struct {
  2755. Fid uintptr
  2756. FisCdata TXML_Bool
  2757. Fvalue uintptr
  2758. }
  2759. type TNS_ATT = struct {
  2760. Fversion uint64
  2761. Fhash uint64
  2762. FuriName uintptr
  2763. }
  2764. type TELEMENT_TYPE = struct {
  2765. Fname uintptr
  2766. Fprefix uintptr
  2767. FidAtt uintptr
  2768. FnDefaultAtts int32
  2769. FallocDefaultAtts int32
  2770. FdefaultAtts uintptr
  2771. }
  2772. type TDTD = struct {
  2773. FgeneralEntities THASH_TABLE
  2774. FelementTypes THASH_TABLE
  2775. FattributeIds THASH_TABLE
  2776. Fprefixes THASH_TABLE
  2777. Fpool TSTRING_POOL
  2778. FentityValuePool TSTRING_POOL
  2779. FkeepProcessing TXML_Bool
  2780. FhasParamEntityRefs TXML_Bool
  2781. Fstandalone TXML_Bool
  2782. FparamEntityRead TXML_Bool
  2783. FparamEntities THASH_TABLE
  2784. FdefaultPrefix TPREFIX
  2785. Fin_eldecl TXML_Bool
  2786. Fscaffold uintptr
  2787. FcontentStringLen uint32
  2788. FscaffSize uint32
  2789. FscaffCount uint32
  2790. FscaffLevel int32
  2791. FscaffIndex uintptr
  2792. }
  2793. type TOPEN_INTERNAL_ENTITY = struct {
  2794. FinternalEventPtr uintptr
  2795. FinternalEventEndPtr uintptr
  2796. Fnext uintptr
  2797. Fentity uintptr
  2798. FstartTagLevel int32
  2799. FbetweenDecl TXML_Bool
  2800. }
  2801. type Topen_internal_entity = TOPEN_INTERNAL_ENTITY
  2802. type _XML_Account = int32
  2803. const _XML_ACCOUNT_DIRECT = 0
  2804. const /* bytes directly passed to the Expat parser */
  2805. _XML_ACCOUNT_ENTITY_EXPANSION = 1
  2806. const /* intermediate bytes produced during entity
  2807. expansion */
  2808. _XML_ACCOUNT_NONE = 2
  2809. type TXmlBigCount = uint64
  2810. type TACCOUNTING = struct {
  2811. FcountBytesDirect TXmlBigCount
  2812. FcountBytesIndirect TXmlBigCount
  2813. FdebugLevel int32
  2814. FmaximumAmplificationFactor float32
  2815. FactivationThresholdBytes uint64
  2816. }
  2817. type Taccounting = TACCOUNTING
  2818. type TENTITY_STATS = struct {
  2819. FcountEverOpened uint32
  2820. FcurrentDepth uint32
  2821. FmaximumDepthSeen uint32
  2822. FdebugLevel int32
  2823. }
  2824. type Tentity_stats = TENTITY_STATS
  2825. func XXML_ParserCreate(tls *libc.TLS, encodingName uintptr) (r TXML_Parser) {
  2826. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0))
  2827. }
  2828. func XXML_ParserCreateNS(tls *libc.TLS, encodingName uintptr, nsSep TXML_Char) (r TXML_Parser) {
  2829. bp := tls.Alloc(16)
  2830. defer tls.Free(16)
  2831. var _ /* tmp at bp+0 */ [2]TXML_Char
  2832. *(*[2]TXML_Char)(unsafe.Pointer(bp)) = [2]TXML_Char{
  2833. 0: nsSep,
  2834. }
  2835. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), bp)
  2836. }
  2837. // C documentation
  2838. //
  2839. // // "xml=http://www.w3.org/XML/1998/namespace"
  2840. var _implicitContext = [41]TXML_Char{
  2841. 0: uint8(m_ASCII_x),
  2842. 1: uint8(m_ASCII_m),
  2843. 2: uint8(m_ASCII_l),
  2844. 3: uint8(m_ASCII_EQUALS),
  2845. 4: uint8(m_ASCII_h),
  2846. 5: uint8(m_ASCII_t),
  2847. 6: uint8(m_ASCII_t),
  2848. 7: uint8(m_ASCII_p),
  2849. 8: uint8(m_ASCII_COLON),
  2850. 9: uint8(m_ASCII_SLASH),
  2851. 10: uint8(m_ASCII_SLASH),
  2852. 11: uint8(m_ASCII_w),
  2853. 12: uint8(m_ASCII_w),
  2854. 13: uint8(m_ASCII_w),
  2855. 14: uint8(m_ASCII_PERIOD),
  2856. 15: uint8(m_ASCII_w),
  2857. 16: uint8(m_ASCII_3),
  2858. 17: uint8(m_ASCII_PERIOD),
  2859. 18: uint8(m_ASCII_o),
  2860. 19: uint8(m_ASCII_r),
  2861. 20: uint8(m_ASCII_g),
  2862. 21: uint8(m_ASCII_SLASH),
  2863. 22: uint8(m_ASCII_X),
  2864. 23: uint8(m_ASCII_M),
  2865. 24: uint8(m_ASCII_L),
  2866. 25: uint8(m_ASCII_SLASH),
  2867. 26: uint8(m_ASCII_1),
  2868. 27: uint8(m_ASCII_9),
  2869. 28: uint8(m_ASCII_9),
  2870. 29: uint8(m_ASCII_8),
  2871. 30: uint8(m_ASCII_SLASH),
  2872. 31: uint8(m_ASCII_n),
  2873. 32: uint8(m_ASCII_a),
  2874. 33: uint8(m_ASCII_m),
  2875. 34: uint8(m_ASCII_e),
  2876. 35: uint8(m_ASCII_s),
  2877. 36: uint8(m_ASCII_p),
  2878. 37: uint8(m_ASCII_a),
  2879. 38: uint8(m_ASCII_c),
  2880. 39: uint8(m_ASCII_e),
  2881. }
  2882. /* To avoid warnings about unused functions: */
  2883. func _ENTROPY_DEBUG(tls *libc.TLS, label uintptr, entropy uint64) (r uint64) {
  2884. bp := tls.Alloc(48)
  2885. defer tls.Free(48)
  2886. if _getDebugLevel(tls, __ccgo_ts+17, uint64(0)) >= uint64(1) {
  2887. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+37, libc.VaList(bp+8, label, libc.Int32FromInt64(8)*libc.Int32FromInt32(2), entropy, libc.Uint64FromInt64(8)))
  2888. }
  2889. return entropy
  2890. }
  2891. func _generate_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  2892. bp := tls.Alloc(16)
  2893. defer tls.Free(16)
  2894. var _ /* entropy at bp+0 */ uint64
  2895. _ = parser
  2896. /* "Failproof" high quality providers: */
  2897. libbsd.Xarc4random_buf(tls, bp, uint64(8))
  2898. return _ENTROPY_DEBUG(tls, __ccgo_ts+81, *(*uint64)(unsafe.Pointer(bp)))
  2899. }
  2900. func _get_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  2901. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  2902. return _get_hash_secret_salt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser)
  2903. }
  2904. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  2905. }
  2906. func _startParsing(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  2907. /* hash functions must be initialized before setContext() is called */
  2908. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt == uint64(0) {
  2909. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = _generate_hash_secret_salt(tls, parser)
  2910. }
  2911. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  2912. /* implicit context only set for root parser, since child
  2913. parsers (i.e. external entity parsers) will inherit it
  2914. */
  2915. return _setContext(tls, parser, uintptr(unsafe.Pointer(&_implicitContext)))
  2916. }
  2917. return libc.Uint8FromInt32(1)
  2918. }
  2919. func XXML_ParserCreate_MM(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr) (r TXML_Parser) {
  2920. return _parserCreate(tls, encodingName, memsuite, nameSep, libc.UintptrFromInt32(0))
  2921. }
  2922. func _parserCreate(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr, dtd uintptr) (r TXML_Parser) {
  2923. var mtemp, mtemp1 uintptr
  2924. var parser TXML_Parser
  2925. _, _, _ = mtemp, mtemp1, parser
  2926. if memsuite != 0 {
  2927. parser = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, uint64(976))
  2928. if parser != libc.UintptrFromInt32(0) {
  2929. mtemp = parser + 24
  2930. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Fmalloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn
  2931. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Frealloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Frealloc_fcn
  2932. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Ffree_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Ffree_fcn
  2933. }
  2934. } else {
  2935. parser = libc.Xmalloc(tls, uint64(976))
  2936. if parser != libc.UintptrFromInt32(0) {
  2937. mtemp1 = parser + 24
  2938. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Fmalloc_fcn = __ccgo_fp(libc.Xmalloc)
  2939. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Frealloc_fcn = __ccgo_fp(libc.Xrealloc)
  2940. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Ffree_fcn = __ccgo_fp(libc.Xfree)
  2941. }
  2942. }
  2943. if !(parser != 0) {
  2944. return parser
  2945. }
  2946. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = libc.UintptrFromInt32(0)
  2947. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = libc.UintptrFromInt32(0)
  2948. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = int32(m_INIT_ATTS_SIZE)
  2949. (*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))
  2950. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts == libc.UintptrFromInt32(0) {
  2951. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  2952. return libc.UintptrFromInt32(0)
  2953. }
  2954. (*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))
  2955. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf == libc.UintptrFromInt32(0) {
  2956. (*(*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)
  2957. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  2958. return libc.UintptrFromInt32(0)
  2959. }
  2960. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf + uintptr(m_INIT_DATA_BUF_SIZE)
  2961. if dtd != 0 {
  2962. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = dtd
  2963. } else {
  2964. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = _dtdCreate(tls, parser+24)
  2965. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd == libc.UintptrFromInt32(0) {
  2966. (*(*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)
  2967. (*(*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)
  2968. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  2969. return libc.UintptrFromInt32(0)
  2970. }
  2971. }
  2972. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = libc.UintptrFromInt32(0)
  2973. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  2974. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  2975. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  2976. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = libc.UintptrFromInt32(0)
  2977. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = libc.UintptrFromInt32(0)
  2978. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = libc.UintptrFromInt32(0)
  2979. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = uint8(m_ASCII_EXCL)
  2980. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(0)
  2981. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(0)
  2982. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = libc.UintptrFromInt32(0)
  2983. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = uint64(0)
  2984. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(0)
  2985. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  2986. _poolInit(tls, parser+784, parser+24)
  2987. _poolInit(tls, parser+832, parser+24)
  2988. _parserInit(tls, parser, encodingName)
  2989. if encodingName != 0 && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  2990. if dtd != 0 {
  2991. // We need to stop the upcoming call to XML_ParserFree from happily
  2992. // destroying parser->m_dtd because the DTD is shared with the parent
  2993. // parser and the only guard that keeps XML_ParserFree from destroying
  2994. // parser->m_dtd is parser->m_isParamEntity but it will be set to
  2995. // XML_TRUE only later in XML_ExternalEntityParserCreate (or not at all).
  2996. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = libc.UintptrFromInt32(0)
  2997. }
  2998. XXML_ParserFree(tls, parser)
  2999. return libc.UintptrFromInt32(0)
  3000. }
  3001. if nameSep != 0 {
  3002. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(1)
  3003. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncodingNS(tls)
  3004. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = *(*TXML_Char)(unsafe.Pointer(nameSep))
  3005. } else {
  3006. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncoding(tls)
  3007. }
  3008. return parser
  3009. }
  3010. func _parserInit(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) {
  3011. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologInitProcessor)
  3012. XXmlPrologStateInit(tls, parser+496)
  3013. if encodingName != libc.UintptrFromInt32(0) {
  3014. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+24)
  3015. }
  3016. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3017. XXmlInitEncoding(tls, parser+296, parser+288, uintptr(0))
  3018. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = libc.UintptrFromInt32(0)
  3019. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = libc.UintptrFromInt32(0)
  3020. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = libc.UintptrFromInt32(0)
  3021. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = libc.UintptrFromInt32(0)
  3022. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = libc.UintptrFromInt32(0)
  3023. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = libc.UintptrFromInt32(0)
  3024. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = libc.UintptrFromInt32(0)
  3025. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = libc.UintptrFromInt32(0)
  3026. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = libc.UintptrFromInt32(0)
  3027. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = libc.UintptrFromInt32(0)
  3028. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = libc.UintptrFromInt32(0)
  3029. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = libc.UintptrFromInt32(0)
  3030. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = libc.UintptrFromInt32(0)
  3031. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = libc.UintptrFromInt32(0)
  3032. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = libc.UintptrFromInt32(0)
  3033. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = libc.UintptrFromInt32(0)
  3034. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = libc.UintptrFromInt32(0)
  3035. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = libc.UintptrFromInt32(0)
  3036. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3037. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = libc.UintptrFromInt32(0)
  3038. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = libc.UintptrFromInt32(0)
  3039. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = libc.UintptrFromInt32(0)
  3040. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = libc.UintptrFromInt32(0)
  3041. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = libc.UintptrFromInt32(0)
  3042. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3043. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3044. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex = 0
  3045. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = libc.UintptrFromInt32(0)
  3046. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = libc.UintptrFromInt32(0)
  3047. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = libc.UintptrFromInt32(0)
  3048. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  3049. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  3050. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0)
  3051. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  3052. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  3053. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  3054. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  3055. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  3056. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  3057. libc.Xmemset(tls, parser+768, 0, uint64(16))
  3058. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NONE)
  3059. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = libc.UintptrFromInt32(0)
  3060. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = libc.UintptrFromInt32(0)
  3061. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  3062. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = libc.UintptrFromInt32(0)
  3063. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3064. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = 0
  3065. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = libc.UintptrFromInt32(0)
  3066. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings = libc.UintptrFromInt32(0)
  3067. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = 0
  3068. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem = libc.UintptrFromInt32(0)
  3069. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = libc.UintptrFromInt32(0)
  3070. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = libc.UintptrFromInt32(0)
  3071. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = libc.UintptrFromInt32(0)
  3072. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_INITIALIZED)
  3073. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(0)
  3074. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  3075. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  3076. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = uint64(0)
  3077. libc.Xmemset(tls, parser+928, 0, uint64(32))
  3078. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FdebugLevel = libc.Int32FromUint64(_getDebugLevel(tls, __ccgo_ts+96, 0))
  3079. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FmaximumAmplificationFactor = libc.Float32FromFloat32(100)
  3080. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FactivationThresholdBytes = uint64(m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT)
  3081. libc.Xmemset(tls, parser+960, 0, uint64(16))
  3082. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entity_stats.FdebugLevel = libc.Int32FromUint64(_getDebugLevel(tls, __ccgo_ts+119, 0))
  3083. }
  3084. // C documentation
  3085. //
  3086. // /* moves list of bindings to m_freeBindingList */
  3087. func _moveToFreeBindingList(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  3088. var b uintptr
  3089. _ = b
  3090. for bindings != 0 {
  3091. b = bindings
  3092. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  3093. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  3094. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  3095. }
  3096. }
  3097. func XXML_ParserReset(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r TXML_Bool) {
  3098. var openEntity, openEntityList, tStk, tag uintptr
  3099. _, _, _, _ = openEntity, openEntityList, tStk, tag
  3100. if parser == libc.UintptrFromInt32(0) {
  3101. return libc.Uint8FromInt32(0)
  3102. }
  3103. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3104. return libc.Uint8FromInt32(0)
  3105. }
  3106. /* move m_tagStack to m_freeTagList */
  3107. tStk = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3108. for tStk != 0 {
  3109. tag = tStk
  3110. tStk = (*TTAG)(unsafe.Pointer(tStk)).Fparent
  3111. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3112. _moveToFreeBindingList(tls, parser, (*TTAG)(unsafe.Pointer(tag)).Fbindings)
  3113. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  3114. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag
  3115. }
  3116. /* move m_openInternalEntities to m_freeInternalEntities */
  3117. openEntityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3118. for openEntityList != 0 {
  3119. openEntity = openEntityList
  3120. openEntityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  3121. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3122. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  3123. }
  3124. _moveToFreeBindingList(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings)
  3125. (*(*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)
  3126. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3127. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3128. }
  3129. _poolClear(tls, parser+784)
  3130. _poolClear(tls, parser+832)
  3131. (*(*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)
  3132. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3133. _parserInit(tls, parser, encodingName)
  3134. _dtdReset(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, parser+24)
  3135. return libc.Uint8FromInt32(1)
  3136. }
  3137. func XXML_SetEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Status) {
  3138. if parser == libc.UintptrFromInt32(0) {
  3139. return int32(_XML_STATUS_ERROR)
  3140. }
  3141. /* Block after XML_Parse()/XML_ParseBuffer() has been called.
  3142. XXX There's no way for the caller to determine which of the
  3143. XXX possible error cases caused the XML_STATUS_ERROR return.
  3144. */
  3145. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3146. return int32(_XML_STATUS_ERROR)
  3147. }
  3148. /* Get rid of any previous encoding name */
  3149. (*(*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)
  3150. if encodingName == libc.UintptrFromInt32(0) {
  3151. /* No new encoding name */
  3152. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3153. } else {
  3154. /* Copy the new encoding name into allocated memory */
  3155. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+24)
  3156. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  3157. return int32(_XML_STATUS_ERROR)
  3158. }
  3159. }
  3160. return int32(_XML_STATUS_OK)
  3161. }
  3162. func XXML_ExternalEntityParserCreate(tls *libc.TLS, oldParser TXML_Parser, context uintptr, encodingName uintptr) (r TXML_Parser) {
  3163. bp := tls.Alloc(16)
  3164. defer tls.Free(16)
  3165. var newDtd, oldDeclElementType, oldDtd, oldHandlerArg, oldUserData uintptr
  3166. var oldAttlistDeclHandler TXML_AttlistDeclHandler
  3167. var oldCharacterDataHandler TXML_CharacterDataHandler
  3168. var oldCommentHandler TXML_CommentHandler
  3169. var oldDefaultExpandInternalEntities, oldns_triplets TXML_Bool
  3170. var oldDefaultHandler TXML_DefaultHandler
  3171. var oldElementDeclHandler TXML_ElementDeclHandler
  3172. var oldEndCdataSectionHandler TXML_EndCdataSectionHandler
  3173. var oldEndElementHandler TXML_EndElementHandler
  3174. var oldEndNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  3175. var oldEntityDeclHandler TXML_EntityDeclHandler
  3176. var oldExternalEntityRefHandler TXML_ExternalEntityRefHandler
  3177. var oldExternalEntityRefHandlerArg, parser TXML_Parser
  3178. var oldInEntityValue int32
  3179. var oldNotStandaloneHandler TXML_NotStandaloneHandler
  3180. var oldNotationDeclHandler TXML_NotationDeclHandler
  3181. var oldParamEntityParsing _XML_ParamEntityParsing
  3182. var oldProcessingInstructionHandler TXML_ProcessingInstructionHandler
  3183. var oldSkippedEntityHandler TXML_SkippedEntityHandler
  3184. var oldStartCdataSectionHandler TXML_StartCdataSectionHandler
  3185. var oldStartElementHandler TXML_StartElementHandler
  3186. var oldStartNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  3187. var oldUnknownEncodingHandler TXML_UnknownEncodingHandler
  3188. var oldUnparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  3189. var oldXmlDeclHandler TXML_XmlDeclHandler
  3190. var oldhash_secret_salt uint64
  3191. var _ /* tmp at bp+0 */ [2]TXML_Char
  3192. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  3193. parser = oldParser
  3194. newDtd = libc.UintptrFromInt32(0)
  3195. /* Validate the oldParser parameter before we pull everything out of it */
  3196. if oldParser == libc.UintptrFromInt32(0) {
  3197. return libc.UintptrFromInt32(0)
  3198. }
  3199. /* Stash the original parser contents on the stack */
  3200. oldDtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  3201. oldStartElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler
  3202. oldEndElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler
  3203. oldCharacterDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  3204. oldProcessingInstructionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler
  3205. oldCommentHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler
  3206. oldStartCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler
  3207. oldEndCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler
  3208. oldDefaultHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler
  3209. oldUnparsedEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler
  3210. oldNotationDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler
  3211. oldStartNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler
  3212. oldEndNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler
  3213. oldNotStandaloneHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler
  3214. oldExternalEntityRefHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler
  3215. oldSkippedEntityHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler
  3216. oldUnknownEncodingHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler
  3217. oldElementDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler
  3218. oldAttlistDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler
  3219. oldEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler
  3220. oldXmlDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler
  3221. oldDeclElementType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType
  3222. oldUserData = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3223. oldHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg
  3224. oldDefaultExpandInternalEntities = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities
  3225. oldExternalEntityRefHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg
  3226. oldParamEntityParsing = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing
  3227. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  3228. oldns_triplets = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets
  3229. /* Note that the new parser shares the same hash secret as the old
  3230. parser, so that dtdCopy and copyEntityTable can lookup values
  3231. from hash tables associated with either parser without us having
  3232. to worry which hash secrets each table has.
  3233. */
  3234. oldhash_secret_salt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  3235. if !(context != 0) {
  3236. newDtd = oldDtd
  3237. }
  3238. /* Note that the magical uses of the pre-processor to make field
  3239. access look more like C++ require that `parser' be overwritten
  3240. here. This makes this function more painful to follow than it
  3241. would be otherwise.
  3242. */
  3243. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  3244. *(*[2]TXML_Char)(unsafe.Pointer(bp)) = [2]TXML_Char{
  3245. 0: (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator,
  3246. }
  3247. parser = _parserCreate(tls, encodingName, parser+24, bp, newDtd)
  3248. } else {
  3249. parser = _parserCreate(tls, encodingName, parser+24, libc.UintptrFromInt32(0), newDtd)
  3250. }
  3251. if !(parser != 0) {
  3252. return libc.UintptrFromInt32(0)
  3253. }
  3254. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = oldStartElementHandler
  3255. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = oldEndElementHandler
  3256. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = oldCharacterDataHandler
  3257. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = oldProcessingInstructionHandler
  3258. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = oldCommentHandler
  3259. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = oldStartCdataSectionHandler
  3260. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = oldEndCdataSectionHandler
  3261. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = oldDefaultHandler
  3262. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler
  3263. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = oldNotationDeclHandler
  3264. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = oldStartNamespaceDeclHandler
  3265. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = oldEndNamespaceDeclHandler
  3266. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = oldNotStandaloneHandler
  3267. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = oldExternalEntityRefHandler
  3268. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = oldSkippedEntityHandler
  3269. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = oldUnknownEncodingHandler
  3270. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = oldElementDeclHandler
  3271. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = oldAttlistDeclHandler
  3272. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = oldEntityDeclHandler
  3273. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = oldXmlDeclHandler
  3274. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = oldDeclElementType
  3275. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = oldUserData
  3276. if oldUserData == oldHandlerArg {
  3277. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3278. } else {
  3279. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3280. }
  3281. if oldExternalEntityRefHandlerArg != oldParser {
  3282. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg
  3283. }
  3284. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = oldDefaultExpandInternalEntities
  3285. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = oldns_triplets
  3286. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = oldhash_secret_salt
  3287. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = oldParser
  3288. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = oldParamEntityParsing
  3289. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  3290. if context != 0 {
  3291. if !(_dtdCopy(tls, oldParser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, oldDtd, parser+24) != 0) || !(_setContext(tls, parser, context) != 0) {
  3292. XXML_ParserFree(tls, parser)
  3293. return libc.UintptrFromInt32(0)
  3294. }
  3295. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor)
  3296. } else {
  3297. /* The DTD instance referenced by parser->m_dtd is shared between the
  3298. document's root parser and external PE parsers, therefore one does not
  3299. need to call setContext. In addition, one also *must* not call
  3300. setContext, because this would overwrite existing prefix->binding
  3301. pointers in parser->m_dtd with ones that get destroyed with the external
  3302. PE parser. This would leave those prefixes with dangling pointers.
  3303. */
  3304. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(1)
  3305. XXmlPrologStateInitExternalEntity(tls, parser+496)
  3306. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntInitProcessor)
  3307. }
  3308. return parser
  3309. }
  3310. func _destroyBindings(tls *libc.TLS, bindings uintptr, parser TXML_Parser) {
  3311. var b uintptr
  3312. _ = b
  3313. for {
  3314. b = bindings
  3315. if !(b != 0) {
  3316. break
  3317. }
  3318. bindings = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  3319. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(b)).Furi)
  3320. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  3321. goto _1
  3322. _1:
  3323. }
  3324. }
  3325. func XXML_ParserFree(tls *libc.TLS, parser TXML_Parser) {
  3326. var entityList, openEntity, p, tagList uintptr
  3327. _, _, _, _ = entityList, openEntity, p, tagList
  3328. if parser == libc.UintptrFromInt32(0) {
  3329. return
  3330. }
  3331. /* free m_tagStack and m_freeTagList */
  3332. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3333. for {
  3334. if tagList == libc.UintptrFromInt32(0) {
  3335. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList == libc.UintptrFromInt32(0) {
  3336. break
  3337. }
  3338. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3339. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  3340. }
  3341. p = tagList
  3342. tagList = (*TTAG)(unsafe.Pointer(tagList)).Fparent
  3343. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TTAG)(unsafe.Pointer(p)).Fbuf)
  3344. _destroyBindings(tls, (*TTAG)(unsafe.Pointer(p)).Fbindings, parser)
  3345. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, p)
  3346. goto _1
  3347. _1:
  3348. }
  3349. /* free m_openInternalEntities and m_freeInternalEntities */
  3350. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3351. for {
  3352. if entityList == libc.UintptrFromInt32(0) {
  3353. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities == libc.UintptrFromInt32(0) {
  3354. break
  3355. }
  3356. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3357. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  3358. }
  3359. openEntity = entityList
  3360. entityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(entityList)).Fnext
  3361. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, openEntity)
  3362. goto _2
  3363. _2:
  3364. }
  3365. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList, parser)
  3366. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings, parser)
  3367. _poolDestroy(tls, parser+784)
  3368. _poolDestroy(tls, parser+832)
  3369. (*(*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)
  3370. /* external parameter entity parsers share the DTD structure
  3371. parser->m_dtd with the root parser, so we must not destroy it
  3372. */
  3373. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd != 0 {
  3374. _dtdDestroy(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0)), parser+24)
  3375. }
  3376. (*(*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)
  3377. (*(*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)
  3378. (*(*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)
  3379. (*(*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)
  3380. (*(*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)
  3381. (*(*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)
  3382. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3383. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3384. }
  3385. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3386. }
  3387. func XXML_UseParserAsHandlerArg(tls *libc.TLS, parser TXML_Parser) {
  3388. if parser != libc.UintptrFromInt32(0) {
  3389. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3390. }
  3391. }
  3392. func XXML_UseForeignDTD(tls *libc.TLS, parser TXML_Parser, useDTD TXML_Bool) (r _XML_Error) {
  3393. if parser == libc.UintptrFromInt32(0) {
  3394. return int32(_XML_ERROR_INVALID_ARGUMENT)
  3395. }
  3396. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3397. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3398. return int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING)
  3399. }
  3400. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = useDTD
  3401. return int32(_XML_ERROR_NONE)
  3402. }
  3403. func XXML_SetReturnNSTriplet(tls *libc.TLS, parser TXML_Parser, do_nst int32) {
  3404. var v1 int32
  3405. _ = v1
  3406. if parser == libc.UintptrFromInt32(0) {
  3407. return
  3408. }
  3409. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3410. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3411. return
  3412. }
  3413. if do_nst != 0 {
  3414. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  3415. } else {
  3416. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  3417. }
  3418. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(v1)
  3419. }
  3420. func XXML_SetUserData(tls *libc.TLS, parser TXML_Parser, p uintptr) {
  3421. var v1 uintptr
  3422. _ = v1
  3423. if parser == libc.UintptrFromInt32(0) {
  3424. return
  3425. }
  3426. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData {
  3427. v1 = p
  3428. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = v1
  3429. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = v1
  3430. } else {
  3431. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = p
  3432. }
  3433. }
  3434. func XXML_SetBase(tls *libc.TLS, parser TXML_Parser, p uintptr) (r _XML_Status) {
  3435. if parser == libc.UintptrFromInt32(0) {
  3436. return int32(_XML_STATUS_ERROR)
  3437. }
  3438. if p != 0 {
  3439. p = _poolCopyString(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+160, p)
  3440. if !(p != 0) {
  3441. return int32(_XML_STATUS_ERROR)
  3442. }
  3443. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = p
  3444. } else {
  3445. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3446. }
  3447. return int32(_XML_STATUS_OK)
  3448. }
  3449. func XXML_GetBase(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  3450. if parser == libc.UintptrFromInt32(0) {
  3451. return libc.UintptrFromInt32(0)
  3452. }
  3453. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  3454. }
  3455. func XXML_GetSpecifiedAttributeCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3456. if parser == libc.UintptrFromInt32(0) {
  3457. return -int32(1)
  3458. }
  3459. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts
  3460. }
  3461. func XXML_GetIdAttributeIndex(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3462. if parser == libc.UintptrFromInt32(0) {
  3463. return -int32(1)
  3464. }
  3465. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex
  3466. }
  3467. func XXML_SetElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler, end TXML_EndElementHandler) {
  3468. if parser == libc.UintptrFromInt32(0) {
  3469. return
  3470. }
  3471. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3472. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3473. }
  3474. func XXML_SetStartElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler) {
  3475. if parser != libc.UintptrFromInt32(0) {
  3476. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3477. }
  3478. }
  3479. func XXML_SetEndElementHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndElementHandler) {
  3480. if parser != libc.UintptrFromInt32(0) {
  3481. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3482. }
  3483. }
  3484. func XXML_SetCharacterDataHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CharacterDataHandler) {
  3485. if parser != libc.UintptrFromInt32(0) {
  3486. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = handler
  3487. }
  3488. }
  3489. func XXML_SetProcessingInstructionHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ProcessingInstructionHandler) {
  3490. if parser != libc.UintptrFromInt32(0) {
  3491. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = handler
  3492. }
  3493. }
  3494. func XXML_SetCommentHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CommentHandler) {
  3495. if parser != libc.UintptrFromInt32(0) {
  3496. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = handler
  3497. }
  3498. }
  3499. func XXML_SetCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler, end TXML_EndCdataSectionHandler) {
  3500. if parser == libc.UintptrFromInt32(0) {
  3501. return
  3502. }
  3503. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3504. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3505. }
  3506. func XXML_SetStartCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler) {
  3507. if parser != libc.UintptrFromInt32(0) {
  3508. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3509. }
  3510. }
  3511. func XXML_SetEndCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndCdataSectionHandler) {
  3512. if parser != libc.UintptrFromInt32(0) {
  3513. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3514. }
  3515. }
  3516. func XXML_SetDefaultHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3517. if parser == libc.UintptrFromInt32(0) {
  3518. return
  3519. }
  3520. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3521. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(0)
  3522. }
  3523. func XXML_SetDefaultHandlerExpand(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3524. if parser == libc.UintptrFromInt32(0) {
  3525. return
  3526. }
  3527. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3528. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3529. }
  3530. func XXML_SetDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler, end TXML_EndDoctypeDeclHandler) {
  3531. if parser == libc.UintptrFromInt32(0) {
  3532. return
  3533. }
  3534. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3535. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3536. }
  3537. func XXML_SetStartDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler) {
  3538. if parser != libc.UintptrFromInt32(0) {
  3539. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3540. }
  3541. }
  3542. func XXML_SetEndDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndDoctypeDeclHandler) {
  3543. if parser != libc.UintptrFromInt32(0) {
  3544. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3545. }
  3546. }
  3547. func XXML_SetUnparsedEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnparsedEntityDeclHandler) {
  3548. if parser != libc.UintptrFromInt32(0) {
  3549. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = handler
  3550. }
  3551. }
  3552. func XXML_SetNotationDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotationDeclHandler) {
  3553. if parser != libc.UintptrFromInt32(0) {
  3554. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = handler
  3555. }
  3556. }
  3557. func XXML_SetNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler, end TXML_EndNamespaceDeclHandler) {
  3558. if parser == libc.UintptrFromInt32(0) {
  3559. return
  3560. }
  3561. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3562. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3563. }
  3564. func XXML_SetStartNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler) {
  3565. if parser != libc.UintptrFromInt32(0) {
  3566. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3567. }
  3568. }
  3569. func XXML_SetEndNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndNamespaceDeclHandler) {
  3570. if parser != libc.UintptrFromInt32(0) {
  3571. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3572. }
  3573. }
  3574. func XXML_SetNotStandaloneHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotStandaloneHandler) {
  3575. if parser != libc.UintptrFromInt32(0) {
  3576. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = handler
  3577. }
  3578. }
  3579. func XXML_SetExternalEntityRefHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ExternalEntityRefHandler) {
  3580. if parser != libc.UintptrFromInt32(0) {
  3581. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = handler
  3582. }
  3583. }
  3584. func XXML_SetExternalEntityRefHandlerArg(tls *libc.TLS, parser TXML_Parser, arg uintptr) {
  3585. if parser == libc.UintptrFromInt32(0) {
  3586. return
  3587. }
  3588. if arg != 0 {
  3589. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = arg
  3590. } else {
  3591. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3592. }
  3593. }
  3594. func XXML_SetSkippedEntityHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_SkippedEntityHandler) {
  3595. if parser != libc.UintptrFromInt32(0) {
  3596. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = handler
  3597. }
  3598. }
  3599. func XXML_SetUnknownEncodingHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnknownEncodingHandler, data uintptr) {
  3600. if parser == libc.UintptrFromInt32(0) {
  3601. return
  3602. }
  3603. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = handler
  3604. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = data
  3605. }
  3606. func XXML_SetElementDeclHandler(tls *libc.TLS, parser TXML_Parser, eldecl TXML_ElementDeclHandler) {
  3607. if parser != libc.UintptrFromInt32(0) {
  3608. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = eldecl
  3609. }
  3610. }
  3611. func XXML_SetAttlistDeclHandler(tls *libc.TLS, parser TXML_Parser, attdecl TXML_AttlistDeclHandler) {
  3612. if parser != libc.UintptrFromInt32(0) {
  3613. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = attdecl
  3614. }
  3615. }
  3616. func XXML_SetEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_EntityDeclHandler) {
  3617. if parser != libc.UintptrFromInt32(0) {
  3618. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = handler
  3619. }
  3620. }
  3621. func XXML_SetXmlDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_XmlDeclHandler) {
  3622. if parser != libc.UintptrFromInt32(0) {
  3623. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = handler
  3624. }
  3625. }
  3626. func XXML_SetParamEntityParsing(tls *libc.TLS, parser TXML_Parser, peParsing _XML_ParamEntityParsing) (r int32) {
  3627. if parser == libc.UintptrFromInt32(0) {
  3628. return 0
  3629. }
  3630. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3631. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3632. return 0
  3633. }
  3634. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = peParsing
  3635. return int32(1)
  3636. }
  3637. func XXML_SetHashSalt(tls *libc.TLS, parser TXML_Parser, hash_salt uint64) (r int32) {
  3638. if parser == libc.UintptrFromInt32(0) {
  3639. return 0
  3640. }
  3641. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3642. return XXML_SetHashSalt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser, hash_salt)
  3643. }
  3644. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3645. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3646. return 0
  3647. }
  3648. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = hash_salt
  3649. return int32(1)
  3650. }
  3651. func XXML_Parse(tls *libc.TLS, parser TXML_Parser, s uintptr, len1 int32, isFinal int32) (r _XML_Status) {
  3652. var buff uintptr
  3653. _ = buff
  3654. if parser == libc.UintptrFromInt32(0) || len1 < 0 || s == libc.UintptrFromInt32(0) && len1 != 0 {
  3655. if parser != libc.UintptrFromInt32(0) {
  3656. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_INVALID_ARGUMENT)
  3657. }
  3658. return int32(_XML_STATUS_ERROR)
  3659. }
  3660. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3661. case int32(_XML_SUSPENDED):
  3662. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3663. return int32(_XML_STATUS_ERROR)
  3664. case int32(_XML_FINISHED):
  3665. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3666. return int32(_XML_STATUS_ERROR)
  3667. case int32(_XML_INITIALIZED):
  3668. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3669. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3670. return int32(_XML_STATUS_ERROR)
  3671. }
  3672. /* fall through */
  3673. fallthrough
  3674. default:
  3675. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3676. }
  3677. if len1 == 0 {
  3678. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3679. if !(isFinal != 0) {
  3680. return int32(_XML_STATUS_OK)
  3681. }
  3682. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3683. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3684. /* If data are left over from last buffer, and we now know that these
  3685. data are the final chunk of input, then we have to check them again
  3686. to detect errors based on that fact.
  3687. */
  3688. (*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)
  3689. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode == int32(_XML_ERROR_NONE) {
  3690. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3691. case int32(_XML_SUSPENDED):
  3692. /* It is hard to be certain, but it seems that this case
  3693. * cannot occur. This code is cleaning up a previous parse
  3694. * with no new data (since len == 0). Changing the parsing
  3695. * state requires getting to execute a handler function, and
  3696. * there doesn't seem to be an opportunity for that while in
  3697. * this circumstance.
  3698. *
  3699. * Given the uncertainty, we retain the code but exclude it
  3700. * from coverage tests.
  3701. *
  3702. * LCOV_EXCL_START
  3703. */
  3704. (*(*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)
  3705. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3706. return int32(_XML_STATUS_SUSPENDED)
  3707. /* LCOV_EXCL_STOP */
  3708. fallthrough
  3709. case int32(_XML_INITIALIZED):
  3710. fallthrough
  3711. case int32(_XML_PARSING):
  3712. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3713. /* fall through */
  3714. fallthrough
  3715. default:
  3716. return int32(_XML_STATUS_OK)
  3717. }
  3718. }
  3719. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3720. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3721. return int32(_XML_STATUS_ERROR)
  3722. } else {
  3723. buff = XXML_GetBuffer(tls, parser, len1)
  3724. if buff == libc.UintptrFromInt32(0) {
  3725. return int32(_XML_STATUS_ERROR)
  3726. } else {
  3727. libc.Xmemcpy(tls, buff, s, libc.Uint64FromInt32(len1))
  3728. return XXML_ParseBuffer(tls, parser, len1, isFinal)
  3729. }
  3730. }
  3731. return r
  3732. }
  3733. func XXML_ParseBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32, isFinal int32) (r _XML_Status) {
  3734. var result _XML_Status
  3735. var start uintptr
  3736. _, _ = result, start
  3737. result = int32(_XML_STATUS_OK)
  3738. if parser == libc.UintptrFromInt32(0) {
  3739. return int32(_XML_STATUS_ERROR)
  3740. }
  3741. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3742. case int32(_XML_SUSPENDED):
  3743. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3744. return int32(_XML_STATUS_ERROR)
  3745. case int32(_XML_FINISHED):
  3746. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3747. return int32(_XML_STATUS_ERROR)
  3748. case int32(_XML_INITIALIZED):
  3749. /* Has someone called XML_GetBuffer successfully before? */
  3750. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0) {
  3751. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_BUFFER)
  3752. return int32(_XML_STATUS_ERROR)
  3753. }
  3754. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3755. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3756. return int32(_XML_STATUS_ERROR)
  3757. }
  3758. /* fall through */
  3759. fallthrough
  3760. default:
  3761. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3762. }
  3763. start = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3764. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = start
  3765. *(*uintptr)(unsafe.Pointer(parser + 56)) += uintptr(len1)
  3766. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3767. *(*TXML_Index)(unsafe.Pointer(parser + 72)) += int64(len1)
  3768. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3769. (*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)
  3770. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  3771. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3772. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3773. return int32(_XML_STATUS_ERROR)
  3774. } else {
  3775. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3776. case int32(_XML_SUSPENDED):
  3777. result = int32(_XML_STATUS_SUSPENDED)
  3778. case int32(_XML_INITIALIZED):
  3779. fallthrough
  3780. case int32(_XML_PARSING):
  3781. if isFinal != 0 {
  3782. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3783. return result
  3784. }
  3785. fallthrough
  3786. default: /* should not happen */
  3787. }
  3788. }
  3789. (*(*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)
  3790. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3791. return result
  3792. }
  3793. func XXML_GetBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32) (r uintptr) {
  3794. var bufferSize, keep, neededSize, offset int32
  3795. var newBuf, v10, v11 uintptr
  3796. var v1, v2, v3, v4, v5, v6, v7, v8, v9 int64
  3797. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bufferSize, keep, neededSize, newBuf, offset, v1, v10, v11, v2, v3, v4, v5, v6, v7, v8, v9
  3798. if parser == libc.UintptrFromInt32(0) {
  3799. return libc.UintptrFromInt32(0)
  3800. }
  3801. if len1 < 0 {
  3802. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3803. return libc.UintptrFromInt32(0)
  3804. }
  3805. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3806. case int32(_XML_SUSPENDED):
  3807. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3808. return libc.UintptrFromInt32(0)
  3809. case int32(_XML_FINISHED):
  3810. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3811. return libc.UintptrFromInt32(0)
  3812. default:
  3813. }
  3814. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 {
  3815. v1 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd)
  3816. } else {
  3817. v1 = 0
  3818. }
  3819. if int64(len1) > v1 {
  3820. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3821. v2 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3822. } else {
  3823. v2 = 0
  3824. }
  3825. /* Do not invoke signed arithmetic overflow: */
  3826. neededSize = libc.Int32FromUint32(libc.Uint32FromInt32(len1) + libc.Uint32FromInt64(v2))
  3827. if neededSize < 0 {
  3828. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3829. return libc.UintptrFromInt32(0)
  3830. }
  3831. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3832. v3 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3833. } else {
  3834. v3 = 0
  3835. }
  3836. keep = int32(v3)
  3837. if keep > int32(m_XML_CONTEXT_BYTES) {
  3838. keep = int32(m_XML_CONTEXT_BYTES)
  3839. }
  3840. /* Detect and prevent integer overflow */
  3841. if keep > int32(m_INT_MAX)-neededSize {
  3842. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3843. return libc.UintptrFromInt32(0)
  3844. }
  3845. neededSize += keep
  3846. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3847. v4 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3848. } else {
  3849. v4 = 0
  3850. }
  3851. if int64(neededSize) <= v4 {
  3852. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3853. v5 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3854. } else {
  3855. v5 = 0
  3856. }
  3857. if int64(keep) < v5 {
  3858. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3859. v6 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3860. } else {
  3861. v6 = 0
  3862. }
  3863. offset = int32(v6) - keep
  3864. /* The buffer pointers cannot be NULL here; we have at least some bytes
  3865. * in the buffer */
  3866. 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)))
  3867. *(*uintptr)(unsafe.Pointer(parser + 56)) -= uintptr(offset)
  3868. *(*uintptr)(unsafe.Pointer(parser + 48)) -= uintptr(offset)
  3869. }
  3870. } else {
  3871. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3872. v7 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3873. } else {
  3874. v7 = 0
  3875. }
  3876. bufferSize = int32(v7)
  3877. if bufferSize == 0 {
  3878. bufferSize = int32(m_INIT_BUFFER_SIZE)
  3879. }
  3880. for cond := true; cond; cond = bufferSize < neededSize && bufferSize > 0 {
  3881. /* Do not invoke signed arithmetic overflow: */
  3882. bufferSize = libc.Int32FromUint32(libc.Uint32FromUint32(2) * libc.Uint32FromInt32(bufferSize))
  3883. }
  3884. if bufferSize <= 0 {
  3885. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3886. return libc.UintptrFromInt32(0)
  3887. }
  3888. newBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(bufferSize))
  3889. if newBuf == uintptr(0) {
  3890. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3891. return libc.UintptrFromInt32(0)
  3892. }
  3893. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = newBuf + uintptr(bufferSize)
  3894. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3895. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3896. v8 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3897. } else {
  3898. v8 = 0
  3899. }
  3900. libc.Xmemcpy(tls, newBuf, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr+uintptr(-keep), libc.Uint64FromInt64(v8+int64(keep)))
  3901. (*(*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)
  3902. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = newBuf
  3903. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3904. v9 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3905. } else {
  3906. v9 = 0
  3907. }
  3908. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(v9) + uintptr(keep)
  3909. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(keep)
  3910. } else {
  3911. /* This must be a brand new buffer with no data in it yet */
  3912. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = newBuf
  3913. v10 = newBuf
  3914. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = v10
  3915. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = v10
  3916. }
  3917. }
  3918. v11 = libc.UintptrFromInt32(0)
  3919. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = v11
  3920. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v11
  3921. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  3922. }
  3923. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3924. }
  3925. func XXML_StopParser(tls *libc.TLS, parser TXML_Parser, resumable TXML_Bool) (r _XML_Status) {
  3926. if parser == libc.UintptrFromInt32(0) {
  3927. return int32(_XML_STATUS_ERROR)
  3928. }
  3929. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3930. case int32(_XML_SUSPENDED):
  3931. if resumable != 0 {
  3932. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3933. return int32(_XML_STATUS_ERROR)
  3934. }
  3935. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3936. case int32(_XML_FINISHED):
  3937. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3938. return int32(_XML_STATUS_ERROR)
  3939. default:
  3940. if resumable != 0 {
  3941. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 {
  3942. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPEND_PE)
  3943. return int32(_XML_STATUS_ERROR)
  3944. }
  3945. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_SUSPENDED)
  3946. } else {
  3947. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3948. }
  3949. }
  3950. return int32(_XML_STATUS_OK)
  3951. }
  3952. func XXML_ResumeParser(tls *libc.TLS, parser TXML_Parser) (r _XML_Status) {
  3953. var result _XML_Status
  3954. _ = result
  3955. result = int32(_XML_STATUS_OK)
  3956. if parser == libc.UintptrFromInt32(0) {
  3957. return int32(_XML_STATUS_ERROR)
  3958. }
  3959. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_SUSPENDED) {
  3960. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NOT_SUSPENDED)
  3961. return int32(_XML_STATUS_ERROR)
  3962. }
  3963. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3964. (*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)
  3965. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  3966. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3967. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3968. return int32(_XML_STATUS_ERROR)
  3969. } else {
  3970. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3971. case int32(_XML_SUSPENDED):
  3972. result = int32(_XML_STATUS_SUSPENDED)
  3973. case int32(_XML_INITIALIZED):
  3974. fallthrough
  3975. case int32(_XML_PARSING):
  3976. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0 {
  3977. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3978. return result
  3979. }
  3980. fallthrough
  3981. default:
  3982. }
  3983. }
  3984. (*(*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)
  3985. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3986. return result
  3987. }
  3988. func XXML_GetParsingStatus(tls *libc.TLS, parser TXML_Parser, status uintptr) {
  3989. if parser == libc.UintptrFromInt32(0) {
  3990. return
  3991. }
  3992. *(*TXML_ParsingStatus)(unsafe.Pointer(status)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus
  3993. }
  3994. func XXML_GetErrorCode(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  3995. if parser == libc.UintptrFromInt32(0) {
  3996. return int32(_XML_ERROR_INVALID_ARGUMENT)
  3997. }
  3998. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  3999. }
  4000. func XXML_GetCurrentByteIndex(tls *libc.TLS, parser TXML_Parser) (r TXML_Index) {
  4001. if parser == libc.UintptrFromInt32(0) {
  4002. return int64(-int32(1))
  4003. }
  4004. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  4005. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex - (int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  4006. }
  4007. return int64(-int32(1))
  4008. }
  4009. func XXML_GetCurrentByteCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  4010. if parser == libc.UintptrFromInt32(0) {
  4011. return 0
  4012. }
  4013. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  4014. return int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  4015. }
  4016. return 0
  4017. }
  4018. func XXML_GetInputContext(tls *libc.TLS, parser TXML_Parser, offset uintptr, size uintptr) (r uintptr) {
  4019. if parser == libc.UintptrFromInt32(0) {
  4020. return libc.UintptrFromInt32(0)
  4021. }
  4022. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  4023. if offset != libc.UintptrFromInt32(0) {
  4024. *(*int32)(unsafe.Pointer(offset)) = int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer))
  4025. }
  4026. if size != libc.UintptrFromInt32(0) {
  4027. *(*int32)(unsafe.Pointer(size)) = int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer))
  4028. }
  4029. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  4030. }
  4031. return libc.UintptrFromInt32(0)
  4032. }
  4033. func XXML_GetCurrentLineNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  4034. if parser == libc.UintptrFromInt32(0) {
  4035. return uint64(0)
  4036. }
  4037. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  4038. (*(*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)
  4039. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4040. }
  4041. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FlineNumber + uint64(1)
  4042. }
  4043. func XXML_GetCurrentColumnNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  4044. if parser == libc.UintptrFromInt32(0) {
  4045. return uint64(0)
  4046. }
  4047. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  4048. (*(*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)
  4049. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4050. }
  4051. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FcolumnNumber
  4052. }
  4053. func XXML_FreeContentModel(tls *libc.TLS, parser TXML_Parser, model uintptr) {
  4054. if parser != libc.UintptrFromInt32(0) {
  4055. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, model)
  4056. }
  4057. }
  4058. func XXML_MemMalloc(tls *libc.TLS, parser TXML_Parser, size Tsize_t) (r uintptr) {
  4059. if parser == libc.UintptrFromInt32(0) {
  4060. return libc.UintptrFromInt32(0)
  4061. }
  4062. return (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, size)
  4063. }
  4064. func XXML_MemRealloc(tls *libc.TLS, parser TXML_Parser, ptr uintptr, size Tsize_t) (r uintptr) {
  4065. if parser == libc.UintptrFromInt32(0) {
  4066. return libc.UintptrFromInt32(0)
  4067. }
  4068. return (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, ptr, size)
  4069. }
  4070. func XXML_MemFree(tls *libc.TLS, parser TXML_Parser, ptr uintptr) {
  4071. if parser != libc.UintptrFromInt32(0) {
  4072. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, ptr)
  4073. }
  4074. }
  4075. func XXML_DefaultCurrent(tls *libc.TLS, parser TXML_Parser) {
  4076. if parser == libc.UintptrFromInt32(0) {
  4077. return
  4078. }
  4079. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4080. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0 {
  4081. _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)
  4082. } else {
  4083. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr)
  4084. }
  4085. }
  4086. }
  4087. func XXML_ErrorString(tls *libc.TLS, code _XML_Error) (r uintptr) {
  4088. switch code {
  4089. case int32(_XML_ERROR_NONE):
  4090. return libc.UintptrFromInt32(0)
  4091. case int32(_XML_ERROR_NO_MEMORY):
  4092. return __ccgo_ts + 138
  4093. case int32(_XML_ERROR_SYNTAX):
  4094. return __ccgo_ts + 152
  4095. case int32(_XML_ERROR_NO_ELEMENTS):
  4096. return __ccgo_ts + 165
  4097. case int32(_XML_ERROR_INVALID_TOKEN):
  4098. return __ccgo_ts + 182
  4099. case int32(_XML_ERROR_UNCLOSED_TOKEN):
  4100. return __ccgo_ts + 214
  4101. case int32(_XML_ERROR_PARTIAL_CHAR):
  4102. return __ccgo_ts + 229
  4103. case int32(_XML_ERROR_TAG_MISMATCH):
  4104. return __ccgo_ts + 247
  4105. case int32(_XML_ERROR_DUPLICATE_ATTRIBUTE):
  4106. return __ccgo_ts + 262
  4107. case int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT):
  4108. return __ccgo_ts + 282
  4109. case int32(_XML_ERROR_PARAM_ENTITY_REF):
  4110. return __ccgo_ts + 310
  4111. case int32(_XML_ERROR_UNDEFINED_ENTITY):
  4112. return __ccgo_ts + 345
  4113. case int32(_XML_ERROR_RECURSIVE_ENTITY_REF):
  4114. return __ccgo_ts + 362
  4115. case int32(_XML_ERROR_ASYNC_ENTITY):
  4116. return __ccgo_ts + 389
  4117. case int32(_XML_ERROR_BAD_CHAR_REF):
  4118. return __ccgo_ts + 409
  4119. case int32(_XML_ERROR_BINARY_ENTITY_REF):
  4120. return __ccgo_ts + 447
  4121. case int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF):
  4122. return __ccgo_ts + 474
  4123. case int32(_XML_ERROR_MISPLACED_XML_PI):
  4124. return __ccgo_ts + 516
  4125. case int32(_XML_ERROR_UNKNOWN_ENCODING):
  4126. return __ccgo_ts + 563
  4127. case int32(_XML_ERROR_INCORRECT_ENCODING):
  4128. return __ccgo_ts + 580
  4129. case int32(_XML_ERROR_UNCLOSED_CDATA_SECTION):
  4130. return __ccgo_ts + 631
  4131. case int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING):
  4132. return __ccgo_ts + 654
  4133. case int32(_XML_ERROR_NOT_STANDALONE):
  4134. return __ccgo_ts + 700
  4135. case int32(_XML_ERROR_UNEXPECTED_STATE):
  4136. return __ccgo_ts + 727
  4137. case int32(_XML_ERROR_ENTITY_DECLARED_IN_PE):
  4138. return __ccgo_ts + 778
  4139. case int32(_XML_ERROR_FEATURE_REQUIRES_XML_DTD):
  4140. return __ccgo_ts + 814
  4141. case int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING):
  4142. return __ccgo_ts + 866
  4143. /* Added in 1.95.7. */
  4144. fallthrough
  4145. case int32(_XML_ERROR_UNBOUND_PREFIX):
  4146. return __ccgo_ts + 911
  4147. /* Added in 1.95.8. */
  4148. fallthrough
  4149. case int32(_XML_ERROR_UNDECLARING_PREFIX):
  4150. return __ccgo_ts + 926
  4151. case int32(_XML_ERROR_INCOMPLETE_PE):
  4152. return __ccgo_ts + 952
  4153. case int32(_XML_ERROR_XML_DECL):
  4154. return __ccgo_ts + 990
  4155. case int32(_XML_ERROR_TEXT_DECL):
  4156. return __ccgo_ts + 1022
  4157. case int32(_XML_ERROR_PUBLICID):
  4158. return __ccgo_ts + 1055
  4159. case int32(_XML_ERROR_SUSPENDED):
  4160. return __ccgo_ts + 1089
  4161. case int32(_XML_ERROR_NOT_SUSPENDED):
  4162. return __ccgo_ts + 1106
  4163. case int32(_XML_ERROR_ABORTED):
  4164. return __ccgo_ts + 1127
  4165. case int32(_XML_ERROR_FINISHED):
  4166. return __ccgo_ts + 1143
  4167. case int32(_XML_ERROR_SUSPEND_PE):
  4168. return __ccgo_ts + 1160
  4169. /* Added in 2.0.0. */
  4170. fallthrough
  4171. case int32(_XML_ERROR_RESERVED_PREFIX_XML):
  4172. return __ccgo_ts + 1204
  4173. case int32(_XML_ERROR_RESERVED_PREFIX_XMLNS):
  4174. return __ccgo_ts + 1284
  4175. case int32(_XML_ERROR_RESERVED_NAMESPACE_URI):
  4176. return __ccgo_ts + 1343
  4177. /* Added in 2.2.5. */
  4178. fallthrough
  4179. case int32(_XML_ERROR_INVALID_ARGUMENT): /* Constant added in 2.2.1, already */
  4180. return __ccgo_ts + 1407
  4181. /* Added in 2.3.0. */
  4182. fallthrough
  4183. case int32(_XML_ERROR_NO_BUFFER):
  4184. return __ccgo_ts + 1424
  4185. /* Added in 2.4.0. */
  4186. fallthrough
  4187. case int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH):
  4188. return __ccgo_ts + 1486
  4189. }
  4190. return libc.UintptrFromInt32(0)
  4191. }
  4192. func XXML_ExpatVersion(tls *libc.TLS) (r uintptr) {
  4193. /* V1 is used to string-ize the version number. However, it would
  4194. string-ize the actual version macro *names* unless we get them
  4195. substituted before being passed to V1. CPP is defined to expand
  4196. a macro, then rescan for more expansions. Thus, we use V2 to expand
  4197. the version macros, then CPP will expand the resulting V1() macro
  4198. with the correct numerals. */
  4199. /* ### I'm assuming cpp is portable in this respect... */
  4200. return __ccgo_ts + 1555
  4201. }
  4202. func XXML_ExpatVersionInfo(tls *libc.TLS) (r TXML_Expat_Version) {
  4203. var version TXML_Expat_Version
  4204. _ = version
  4205. version.Fmajor = int32(m_XML_MAJOR_VERSION)
  4206. version.Fminor = int32(m_XML_MINOR_VERSION)
  4207. version.Fmicro = m_XML_MICRO_VERSION
  4208. return version
  4209. }
  4210. func XXML_GetFeatureList(tls *libc.TLS) (r uintptr) {
  4211. return uintptr(unsafe.Pointer(&_features))
  4212. }
  4213. var _features = [8]TXML_Feature{
  4214. 0: {
  4215. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_CHAR),
  4216. Fname: __ccgo_ts + 1567,
  4217. Fvalue: int64(1),
  4218. },
  4219. 1: {
  4220. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_LCHAR),
  4221. Fname: __ccgo_ts + 1584,
  4222. Fvalue: int64(1),
  4223. },
  4224. 2: {
  4225. Ffeature: int32(_XML_FEATURE_DTD),
  4226. Fname: __ccgo_ts + 1602,
  4227. },
  4228. 3: {
  4229. Ffeature: int32(_XML_FEATURE_CONTEXT_BYTES),
  4230. Fname: __ccgo_ts + 1610,
  4231. Fvalue: int64(m_XML_CONTEXT_BYTES),
  4232. },
  4233. 4: {
  4234. Ffeature: int32(_XML_FEATURE_NS),
  4235. Fname: __ccgo_ts + 1628,
  4236. },
  4237. 5: {
  4238. Ffeature: int32(_XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT),
  4239. Fname: __ccgo_ts + 1635,
  4240. Fvalue: libc.Int64FromFloat32(100),
  4241. },
  4242. 6: {
  4243. Ffeature: int32(_XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT),
  4244. Fname: __ccgo_ts + 1652,
  4245. Fvalue: int64(m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT),
  4246. },
  4247. 7: {},
  4248. }
  4249. func XXML_SetBillionLaughsAttackProtectionMaximumAmplification(tls *libc.TLS, parser TXML_Parser, maximumAmplificationFactor float32) (r TXML_Bool) {
  4250. bp := tls.Alloc(16)
  4251. defer tls.Free(16)
  4252. var v1 uint32
  4253. var v3 bool
  4254. var _ /* __u at bp+0 */ struct {
  4255. F__i [0]uint32
  4256. F__f float32
  4257. }
  4258. _, _ = v1, v3
  4259. if v3 = parser == libc.UintptrFromInt32(0) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0); !v3 {
  4260. *(*float32)(unsafe.Pointer(bp)) = maximumAmplificationFactor
  4261. v1 = *(*uint32)(unsafe.Pointer(bp))
  4262. goto _2
  4263. _2:
  4264. }
  4265. if v3 || libc.BoolInt32(v1&uint32(0x7fffffff) > uint32(0x7f800000)) != 0 || maximumAmplificationFactor < libc.Float32FromFloat32(1) {
  4266. return libc.Uint8FromInt32(0)
  4267. }
  4268. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FmaximumAmplificationFactor = maximumAmplificationFactor
  4269. return libc.Uint8FromInt32(1)
  4270. }
  4271. func XXML_SetBillionLaughsAttackProtectionActivationThreshold(tls *libc.TLS, parser TXML_Parser, activationThresholdBytes uint64) (r TXML_Bool) {
  4272. if parser == libc.UintptrFromInt32(0) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  4273. return libc.Uint8FromInt32(0)
  4274. }
  4275. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FactivationThresholdBytes = activationThresholdBytes
  4276. return libc.Uint8FromInt32(1)
  4277. }
  4278. // C documentation
  4279. //
  4280. // /* Initially tag->rawName always points into the parse buffer;
  4281. // for those TAG instances opened while the current parse buffer was
  4282. // processed, and not yet closed, we need to store tag->rawName in a more
  4283. // permanent location, since the parse buffer is about to be discarded.
  4284. // */
  4285. func _storeRawNames(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  4286. var bufSize, nameLen int32
  4287. var rawNameBuf, tag, temp uintptr
  4288. var rawNameLen Tsize_t
  4289. _, _, _, _, _, _ = bufSize, nameLen, rawNameBuf, rawNameLen, tag, temp
  4290. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4291. for tag != 0 {
  4292. nameLen = libc.Int32FromUint64(uint64(1) * libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen+libc.Int32FromInt32(1)))
  4293. rawNameBuf = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(nameLen)
  4294. /* Stop if already stored. Since m_tagStack is a stack, we can stop
  4295. at the first entry that has already been copied; everything
  4296. below it in the stack is already been accounted for in a
  4297. previous call to this function.
  4298. */
  4299. if (*TTAG)(unsafe.Pointer(tag)).FrawName == rawNameBuf {
  4300. break
  4301. }
  4302. /* For re-use purposes we need to ensure that the
  4303. size of tag->buf is a multiple of sizeof(XML_Char).
  4304. */
  4305. rawNameLen = (libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength) + (libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))) & ^(libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  4306. /* Detect and prevent integer overflow. */
  4307. if rawNameLen > libc.Uint64FromInt32(m_INT_MAX)-libc.Uint64FromInt32(nameLen) {
  4308. return libc.Uint8FromInt32(0)
  4309. }
  4310. bufSize = nameLen + libc.Int32FromUint64(rawNameLen)
  4311. if int64(bufSize) > int64((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf) {
  4312. 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))
  4313. if temp == libc.UintptrFromInt32(0) {
  4314. return libc.Uint8FromInt32(0)
  4315. }
  4316. /* if tag->name.str points to tag->buf (only when namespace
  4317. processing is off) then we have to update it
  4318. */
  4319. if (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr == (*TTAG)(unsafe.Pointer(tag)).Fbuf {
  4320. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = temp
  4321. }
  4322. /* if tag->name.localPart is set (when namespace processing is on)
  4323. then update it as well, since it will always point into tag->buf
  4324. */
  4325. if (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart != 0 {
  4326. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = temp + uintptr(int64((*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  4327. }
  4328. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4329. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4330. rawNameBuf = temp + uintptr(nameLen)
  4331. }
  4332. libc.Xmemcpy(tls, rawNameBuf, (*TTAG)(unsafe.Pointer(tag)).FrawName, libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength))
  4333. (*TTAG)(unsafe.Pointer(tag)).FrawName = rawNameBuf
  4334. tag = (*TTAG)(unsafe.Pointer(tag)).Fparent
  4335. }
  4336. return libc.Uint8FromInt32(1)
  4337. }
  4338. func _contentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4339. var result _XML_Error
  4340. _ = result
  4341. 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)), int32(_XML_ACCOUNT_DIRECT))
  4342. if result == int32(_XML_ERROR_NONE) {
  4343. if !(_storeRawNames(tls, parser) != 0) {
  4344. return int32(_XML_ERROR_NO_MEMORY)
  4345. }
  4346. }
  4347. return result
  4348. }
  4349. func _externalEntityInitProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4350. var result _XML_Error
  4351. _ = result
  4352. result = _initializeEncoding(tls, parser)
  4353. if result != int32(_XML_ERROR_NONE) {
  4354. return result
  4355. }
  4356. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor2)
  4357. return _externalEntityInitProcessor2(tls, parser, start, end, endPtr)
  4358. }
  4359. func _externalEntityInitProcessor2(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4360. bp := tls.Alloc(16)
  4361. defer tls.Free(16)
  4362. var tok int32
  4363. var _ /* next at bp+0 */ uintptr
  4364. _ = tok
  4365. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4366. 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)
  4367. switch tok {
  4368. case int32(m_XML_TOK_BOM):
  4369. if !(_accountingDiffTolerated(tls, parser, tok, start, *(*uintptr)(unsafe.Pointer(bp)), int32(2649), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  4370. _accountingOnAbort(tls, parser)
  4371. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  4372. }
  4373. /* If we are at the end of the buffer, this would cause the next stage,
  4374. i.e. externalEntityInitProcessor3, to pass control directly to
  4375. doContent (by detecting XML_TOK_NONE) without processing any xml text
  4376. declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent.
  4377. */
  4378. if *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4379. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4380. return int32(_XML_ERROR_NONE)
  4381. }
  4382. start = *(*uintptr)(unsafe.Pointer(bp))
  4383. case -int32(1):
  4384. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4385. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4386. return int32(_XML_ERROR_NONE)
  4387. }
  4388. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4389. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4390. case -int32(2):
  4391. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4392. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4393. return int32(_XML_ERROR_NONE)
  4394. }
  4395. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4396. return int32(_XML_ERROR_PARTIAL_CHAR)
  4397. }
  4398. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor3)
  4399. return _externalEntityInitProcessor3(tls, parser, start, end, endPtr)
  4400. }
  4401. func _externalEntityInitProcessor3(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4402. bp := tls.Alloc(16)
  4403. defer tls.Free(16)
  4404. var result _XML_Error
  4405. var tok int32
  4406. var _ /* next at bp+0 */ uintptr
  4407. _, _ = result, tok
  4408. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4409. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4410. 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)
  4411. /* Note: These bytes are accounted later in:
  4412. - processXmlDecl
  4413. - externalEntityContentProcessor
  4414. */
  4415. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  4416. switch tok {
  4417. case int32(m_XML_TOK_XML_DECL):
  4418. result = _processXmlDecl(tls, parser, int32(1), start, *(*uintptr)(unsafe.Pointer(bp)))
  4419. if result != int32(_XML_ERROR_NONE) {
  4420. return result
  4421. }
  4422. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4423. case int32(_XML_SUSPENDED):
  4424. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4425. return int32(_XML_ERROR_NONE)
  4426. case int32(_XML_FINISHED):
  4427. return int32(_XML_ERROR_ABORTED)
  4428. default:
  4429. start = *(*uintptr)(unsafe.Pointer(bp))
  4430. }
  4431. case -int32(1):
  4432. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4433. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4434. return int32(_XML_ERROR_NONE)
  4435. }
  4436. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4437. case -int32(2):
  4438. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4439. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4440. return int32(_XML_ERROR_NONE)
  4441. }
  4442. return int32(_XML_ERROR_PARTIAL_CHAR)
  4443. }
  4444. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  4445. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = int32(1)
  4446. return _externalEntityContentProcessor(tls, parser, start, end, endPtr)
  4447. }
  4448. func _externalEntityContentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4449. var result _XML_Error
  4450. _ = result
  4451. 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)), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  4452. if result == int32(_XML_ERROR_NONE) {
  4453. if !(_storeRawNames(tls, parser) != 0) {
  4454. return int32(_XML_ERROR_NO_MEMORY)
  4455. }
  4456. }
  4457. return result
  4458. }
  4459. func _doContent(tls *libc.TLS, parser TXML_Parser, startTagLevel int32, enc uintptr, _s uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool, account _XML_Account) (r _XML_Error) {
  4460. bp := tls.Alloc(112)
  4461. defer tls.Free(112)
  4462. *(*uintptr)(unsafe.Pointer(bp)) = _s
  4463. var accountAfter, b, context, dtd, entity, eventEndPP, eventPP, localPart, name, prefix, rawName, rawName1, rawNameEnd, tag, tag1, temp, uri, v11, v2, v3, v5, v6, v7, v8, v9 uintptr
  4464. var bufSize, convLen, len1, n, tok int32
  4465. var charDataHandler TXML_CharacterDataHandler
  4466. var convert_res, convert_res1 _XML_Convert_Result
  4467. var noElmHandlers TXML_Bool
  4468. var result, result1, result2, result3 _XML_Error
  4469. var _ /* bindings at bp+40 */ uintptr
  4470. var _ /* buf at bp+88 */ [4]TXML_Char
  4471. var _ /* c at bp+16 */ TXML_Char
  4472. var _ /* c at bp+92 */ TXML_Char
  4473. var _ /* ch at bp+17 */ TXML_Char
  4474. var _ /* dataPtr at bp+104 */ uintptr
  4475. var _ /* dataPtr at bp+96 */ uintptr
  4476. var _ /* fromPtr at bp+32 */ uintptr
  4477. var _ /* name at bp+48 */ TTAG_NAME
  4478. var _ /* next at bp+8 */ uintptr
  4479. var _ /* toPtr at bp+24 */ uintptr
  4480. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = accountAfter, 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, v11, v2, v3, v5, v6, v7, v8, v9
  4481. /* save one level of indirection */
  4482. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  4483. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  4484. eventPP = parser + 544
  4485. eventEndPP = parser + 552
  4486. } else {
  4487. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  4488. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  4489. }
  4490. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4491. for {
  4492. *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(bp)) /* XmlContentTok doesn't always set the last arg */
  4493. 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)
  4494. if tok == -int32(5) || tok == -int32(3) {
  4495. if haveMore != 0 {
  4496. v3 = *(*uintptr)(unsafe.Pointer(bp))
  4497. } else {
  4498. v3 = end
  4499. }
  4500. v2 = v3
  4501. } else {
  4502. v2 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4503. }
  4504. accountAfter = v2
  4505. if !(_accountingDiffTolerated(tls, parser, tok, *(*uintptr)(unsafe.Pointer(bp)), accountAfter, int32(2773), account) != 0) {
  4506. _accountingOnAbort(tls, parser)
  4507. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  4508. }
  4509. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4510. switch tok {
  4511. case -int32(3):
  4512. if haveMore != 0 {
  4513. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4514. return int32(_XML_ERROR_NONE)
  4515. }
  4516. *(*uintptr)(unsafe.Pointer(eventEndPP)) = end
  4517. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4518. *(*TXML_Char)(unsafe.Pointer(bp + 16)) = uint8(0xA)
  4519. (*(*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))
  4520. } else {
  4521. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4522. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4523. }
  4524. }
  4525. /* We are at the end of the final buffer, should we check for
  4526. XML_SUSPENDED, XML_FINISHED?
  4527. */
  4528. if startTagLevel == 0 {
  4529. return int32(_XML_ERROR_NO_ELEMENTS)
  4530. }
  4531. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4532. return int32(_XML_ERROR_ASYNC_ENTITY)
  4533. }
  4534. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4535. return int32(_XML_ERROR_NONE)
  4536. case -int32(4):
  4537. if haveMore != 0 {
  4538. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4539. return int32(_XML_ERROR_NONE)
  4540. }
  4541. if startTagLevel > 0 {
  4542. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4543. return int32(_XML_ERROR_ASYNC_ENTITY)
  4544. }
  4545. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4546. return int32(_XML_ERROR_NONE)
  4547. }
  4548. return int32(_XML_ERROR_NO_ELEMENTS)
  4549. case m_XML_TOK_INVALID:
  4550. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4551. return int32(_XML_ERROR_INVALID_TOKEN)
  4552. case -int32(1):
  4553. if haveMore != 0 {
  4554. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4555. return int32(_XML_ERROR_NONE)
  4556. }
  4557. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4558. case -int32(2):
  4559. if haveMore != 0 {
  4560. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4561. return int32(_XML_ERROR_NONE)
  4562. }
  4563. return int32(_XML_ERROR_PARTIAL_CHAR)
  4564. case int32(m_XML_TOK_ENTITY_REF):
  4565. *(*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)))
  4566. if *(*TXML_Char)(unsafe.Pointer(bp + 17)) != 0 {
  4567. /* NOTE: We are replacing 4-6 characters original input for 1 character
  4568. * so there is no amplification and hence recording without
  4569. * protection. */
  4570. _accountingDiffTolerated(tls, parser, tok, bp+17, bp+17+uintptr(1), int32(2839), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  4571. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4572. (*(*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))
  4573. } else {
  4574. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4575. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4576. }
  4577. }
  4578. break
  4579. }
  4580. 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))
  4581. if !(name != 0) {
  4582. return int32(_XML_ERROR_NO_MEMORY)
  4583. }
  4584. entity = _lookup(tls, parser, dtd, name, uint64(0))
  4585. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  4586. /* First, determine if a check for an existing declaration is needed;
  4587. if yes, check that the entity exists, and that it is internal,
  4588. otherwise call the skipped entity or default handler.
  4589. */
  4590. if !((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  4591. if !(entity != 0) {
  4592. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  4593. } else {
  4594. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  4595. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  4596. }
  4597. }
  4598. } else {
  4599. if !(entity != 0) {
  4600. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4601. (*(*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)
  4602. } else {
  4603. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4604. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4605. }
  4606. }
  4607. break
  4608. }
  4609. }
  4610. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  4611. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  4612. }
  4613. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  4614. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  4615. }
  4616. if (*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0 {
  4617. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities != 0) {
  4618. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4619. (*(*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)
  4620. } else {
  4621. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4622. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4623. }
  4624. }
  4625. break
  4626. }
  4627. result = _processInternalEntity(tls, parser, entity, libc.Uint8FromInt32(0))
  4628. if result != int32(_XML_ERROR_NONE) {
  4629. return result
  4630. }
  4631. } else {
  4632. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  4633. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  4634. context = _getContext(tls, parser)
  4635. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  4636. if !(context != 0) {
  4637. return int32(_XML_ERROR_NO_MEMORY)
  4638. }
  4639. 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) {
  4640. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  4641. }
  4642. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  4643. } else {
  4644. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4645. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4646. }
  4647. }
  4648. }
  4649. case int32(m_XML_TOK_START_TAG_NO_ATTS):
  4650. /* fall through */
  4651. fallthrough
  4652. case int32(m_XML_TOK_START_TAG_WITH_ATTS):
  4653. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList != 0 {
  4654. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4655. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = (*TTAG)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList)).Fparent
  4656. } else {
  4657. tag = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(88))
  4658. if !(tag != 0) {
  4659. return int32(_XML_ERROR_NO_MEMORY)
  4660. }
  4661. (*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)))
  4662. if !((*TTAG)(unsafe.Pointer(tag)).Fbuf != 0) {
  4663. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, tag)
  4664. return int32(_XML_ERROR_NO_MEMORY)
  4665. }
  4666. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(m_INIT_TAG_BUF_SIZE)
  4667. }
  4668. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  4669. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4670. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = tag
  4671. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = libc.UintptrFromInt32(0)
  4672. (*TTAG)(unsafe.Pointer(tag)).Fname.Fprefix = libc.UintptrFromInt32(0)
  4673. (*TTAG)(unsafe.Pointer(tag)).FrawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4674. (*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)
  4675. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel++
  4676. rawNameEnd = (*TTAG)(unsafe.Pointer(tag)).FrawName + uintptr((*TTAG)(unsafe.Pointer(tag)).FrawNameLength)
  4677. *(*uintptr)(unsafe.Pointer(bp + 32)) = (*TTAG)(unsafe.Pointer(tag)).FrawName
  4678. *(*uintptr)(unsafe.Pointer(bp + 24)) = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4679. for {
  4680. 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))
  4681. convLen = int32(int64(*(*uintptr)(unsafe.Pointer(bp + 24))) - int64((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  4682. if *(*uintptr)(unsafe.Pointer(bp + 32)) >= rawNameEnd || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  4683. (*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen = convLen
  4684. break
  4685. }
  4686. bufSize = int32(int64((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf)) << int32(1)
  4687. 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))
  4688. if temp == libc.UintptrFromInt32(0) {
  4689. return int32(_XML_ERROR_NO_MEMORY)
  4690. }
  4691. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4692. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4693. *(*uintptr)(unsafe.Pointer(bp + 24)) = temp + uintptr(convLen)
  4694. goto _4
  4695. _4:
  4696. }
  4697. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4698. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)))) = uint8('\000')
  4699. result1 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), tag+24, tag+80, account)
  4700. if result1 != 0 {
  4701. return result1
  4702. }
  4703. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4704. (*(*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)
  4705. } else {
  4706. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4707. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4708. }
  4709. }
  4710. _poolClear(tls, parser+784)
  4711. case int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS):
  4712. /* fall through */
  4713. fallthrough
  4714. case int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS):
  4715. rawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4716. *(*uintptr)(unsafe.Pointer(bp + 40)) = libc.UintptrFromInt32(0)
  4717. noElmHandlers = libc.Uint8FromInt32(1)
  4718. (*(*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)))
  4719. if !((*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr != 0) {
  4720. return int32(_XML_ERROR_NO_MEMORY)
  4721. }
  4722. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  4723. result2 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), bp+48, bp+40, int32(_XML_ACCOUNT_NONE))
  4724. if result2 != int32(_XML_ERROR_NONE) {
  4725. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 40)))
  4726. return result2
  4727. }
  4728. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  4729. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4730. (*(*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)
  4731. noElmHandlers = libc.Uint8FromInt32(0)
  4732. }
  4733. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4734. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4735. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(eventEndPP))
  4736. }
  4737. (*(*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)
  4738. noElmHandlers = libc.Uint8FromInt32(0)
  4739. }
  4740. if noElmHandlers != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4741. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4742. }
  4743. _poolClear(tls, parser+784)
  4744. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 40)))
  4745. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4746. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4747. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4748. } else {
  4749. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 8)), end, nextPtr)
  4750. }
  4751. }
  4752. case int32(m_XML_TOK_END_TAG):
  4753. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == startTagLevel {
  4754. return int32(_XML_ERROR_ASYNC_ENTITY)
  4755. } else {
  4756. tag1 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4757. rawName1 = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(2))
  4758. len1 = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, rawName1)
  4759. if len1 != (*TTAG)(unsafe.Pointer(tag1)).FrawNameLength || libc.Xmemcmp(tls, (*TTAG)(unsafe.Pointer(tag1)).FrawName, rawName1, libc.Uint64FromInt32(len1)) != 0 {
  4760. *(*uintptr)(unsafe.Pointer(eventPP)) = rawName1
  4761. return int32(_XML_ERROR_TAG_MISMATCH)
  4762. }
  4763. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = (*TTAG)(unsafe.Pointer(tag1)).Fparent
  4764. (*TTAG)(unsafe.Pointer(tag1)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4765. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag1
  4766. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel--
  4767. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4768. localPart = (*TTAG)(unsafe.Pointer(tag1)).Fname.FlocalPart
  4769. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && localPart != 0 {
  4770. /* localPart and prefix may have been overwritten in
  4771. tag->name.str, since this points to the binding->uri
  4772. buffer which gets re-used; so we have to add them again
  4773. */
  4774. uri = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fstr + uintptr((*TTAG)(unsafe.Pointer(tag1)).Fname.FuriLen)
  4775. /* don't need to check for space - already done in storeAtts() */
  4776. for *(*TXML_Char)(unsafe.Pointer(localPart)) != 0 {
  4777. v5 = uri
  4778. uri++
  4779. v6 = localPart
  4780. localPart++
  4781. *(*TXML_Char)(unsafe.Pointer(v5)) = *(*TXML_Char)(unsafe.Pointer(v6))
  4782. }
  4783. prefix = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fprefix
  4784. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && prefix != 0 {
  4785. v7 = uri
  4786. uri++
  4787. *(*TXML_Char)(unsafe.Pointer(v7)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  4788. for *(*TXML_Char)(unsafe.Pointer(prefix)) != 0 {
  4789. v8 = uri
  4790. uri++
  4791. v9 = prefix
  4792. prefix++
  4793. *(*TXML_Char)(unsafe.Pointer(v8)) = *(*TXML_Char)(unsafe.Pointer(v9))
  4794. }
  4795. }
  4796. *(*TXML_Char)(unsafe.Pointer(uri)) = uint8('\000')
  4797. }
  4798. (*(*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)
  4799. } else {
  4800. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4801. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4802. }
  4803. }
  4804. for (*TTAG)(unsafe.Pointer(tag1)).Fbindings != 0 {
  4805. b = (*TTAG)(unsafe.Pointer(tag1)).Fbindings
  4806. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  4807. (*(*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)
  4808. }
  4809. (*TTAG)(unsafe.Pointer(tag1)).Fbindings = (*TBINDING)(unsafe.Pointer((*TTAG)(unsafe.Pointer(tag1)).Fbindings)).FnextTagBinding
  4810. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  4811. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  4812. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  4813. }
  4814. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4815. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4816. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4817. } else {
  4818. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 8)), end, nextPtr)
  4819. }
  4820. }
  4821. }
  4822. case int32(m_XML_TOK_CHAR_REF):
  4823. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)))
  4824. if n < 0 {
  4825. return int32(_XML_ERROR_BAD_CHAR_REF)
  4826. }
  4827. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4828. (*(*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))
  4829. } else {
  4830. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4831. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4832. }
  4833. }
  4834. case int32(m_XML_TOK_XML_DECL):
  4835. return int32(_XML_ERROR_MISPLACED_XML_PI)
  4836. case int32(m_XML_TOK_DATA_NEWLINE):
  4837. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4838. *(*TXML_Char)(unsafe.Pointer(bp + 92)) = uint8(0xA)
  4839. (*(*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))
  4840. } else {
  4841. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4842. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4843. }
  4844. }
  4845. case int32(m_XML_TOK_CDATA_SECT_OPEN):
  4846. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler != 0 {
  4847. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  4848. } else {
  4849. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4850. (*(*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)
  4851. } else {
  4852. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4853. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4854. }
  4855. }
  4856. }
  4857. result3 = _doCdataSection(tls, parser, enc, bp+8, end, nextPtr, haveMore, account)
  4858. if result3 != int32(_XML_ERROR_NONE) {
  4859. return result3
  4860. } else {
  4861. if !(*(*uintptr)(unsafe.Pointer(bp + 8)) != 0) {
  4862. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_cdataSectionProcessor)
  4863. return result3
  4864. }
  4865. }
  4866. case -int32(5):
  4867. if haveMore != 0 {
  4868. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4869. return int32(_XML_ERROR_NONE)
  4870. }
  4871. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4872. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  4873. *(*uintptr)(unsafe.Pointer(bp + 96)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  4874. (*(*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)
  4875. (*(*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)))
  4876. } else {
  4877. (*(*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)))))
  4878. }
  4879. } else {
  4880. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4881. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4882. }
  4883. }
  4884. /* We are at the end of the final buffer, should we check for
  4885. XML_SUSPENDED, XML_FINISHED?
  4886. */
  4887. if startTagLevel == 0 {
  4888. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  4889. return int32(_XML_ERROR_NO_ELEMENTS)
  4890. }
  4891. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4892. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  4893. return int32(_XML_ERROR_ASYNC_ENTITY)
  4894. }
  4895. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4896. return int32(_XML_ERROR_NONE)
  4897. case int32(m_XML_TOK_DATA_CHARS):
  4898. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  4899. if charDataHandler != 0 {
  4900. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  4901. for {
  4902. *(*uintptr)(unsafe.Pointer(bp + 104)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  4903. 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)
  4904. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4905. (*(*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)))
  4906. if convert_res1 == int32(_XML_CONVERT_COMPLETED) || convert_res1 == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  4907. break
  4908. }
  4909. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4910. goto _10
  4911. _10:
  4912. }
  4913. } else {
  4914. (*(*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)))))
  4915. }
  4916. } else {
  4917. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4918. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4919. }
  4920. }
  4921. case int32(m_XML_TOK_PI):
  4922. if !(_reportProcessingInstruction(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) {
  4923. return int32(_XML_ERROR_NO_MEMORY)
  4924. }
  4925. case int32(m_XML_TOK_COMMENT):
  4926. if !(_reportComment(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) {
  4927. return int32(_XML_ERROR_NO_MEMORY)
  4928. }
  4929. default:
  4930. /* All of the tokens produced by XmlContentTok() have their own
  4931. * explicit cases, so this default is not strictly necessary.
  4932. * However it is a useful safety net, so we retain the code and
  4933. * simply exclude it from the coverage tests.
  4934. *
  4935. * LCOV_EXCL_START
  4936. */
  4937. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4938. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4939. }
  4940. break
  4941. /* LCOV_EXCL_STOP */
  4942. }
  4943. v11 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4944. *(*uintptr)(unsafe.Pointer(bp)) = v11
  4945. *(*uintptr)(unsafe.Pointer(eventPP)) = v11
  4946. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4947. case int32(_XML_SUSPENDED):
  4948. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4949. return int32(_XML_ERROR_NONE)
  4950. case int32(_XML_FINISHED):
  4951. return int32(_XML_ERROR_ABORTED)
  4952. default:
  4953. }
  4954. goto _1
  4955. _1:
  4956. }
  4957. /* not reached */
  4958. return r
  4959. }
  4960. // C documentation
  4961. //
  4962. // /* This function does not call free() on the allocated memory, merely
  4963. // * moving it to the parser's m_freeBindingList where it can be freed or
  4964. // * reused as appropriate.
  4965. // */
  4966. func _freeBindings(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  4967. var b uintptr
  4968. _ = b
  4969. for bindings != 0 {
  4970. b = bindings
  4971. /* m_startNamespaceDeclHandler will have been called for this
  4972. * binding in addBindings(), so call the end handler now.
  4973. */
  4974. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  4975. (*(*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)
  4976. }
  4977. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  4978. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  4979. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  4980. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  4981. }
  4982. }
  4983. // C documentation
  4984. //
  4985. // /* Precondition: all arguments must be non-NULL;
  4986. // Purpose:
  4987. // - normalize attributes
  4988. // - check attributes for well-formedness
  4989. // - generate namespace aware attribute names (URI, prefix)
  4990. // - build list of attributes for startElementHandler
  4991. // - default attributes
  4992. // - process namespace declarations (check and report them)
  4993. // - generate namespace aware element name (URI, prefix)
  4994. // */
  4995. func _storeAtts(tls *libc.TLS, parser TXML_Parser, enc uintptr, attStr uintptr, tagNamePtr uintptr, bindingsPtr uintptr, account _XML_Account) (r _XML_Error) {
  4996. bp := tls.Alloc(80)
  4997. defer tls.Free(80)
  4998. 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
  4999. var attIndex, i, j, j1, n, nDefaultAtts, nPrefixes, oldAttsSize, prefixLen, v13, v17, v2, v23, v30, v33, v38, v40, v6, v7, v8, v9 int32
  5000. var c TXML_Char
  5001. var isCdata TXML_Bool
  5002. var mask, uriHash, version, v14 uint64
  5003. var nsAttsSize uint32
  5004. var oldNsAttsPower, step, v10 uint8
  5005. var result, result1, result2 _XML_Error
  5006. var _ /* sip_key at bp+56 */ Tsipkey
  5007. var _ /* sip_state at bp+0 */ Tsiphash
  5008. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  5009. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the attribute list for the application */
  5010. attIndex = 0
  5011. nPrefixes = 0
  5012. /* lookup the element type name */
  5013. elementType = _lookup(tls, parser, dtd+40, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr, uint64(0))
  5014. if !(elementType != 0) {
  5015. name = _poolCopyString(tls, dtd+160, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr)
  5016. if !(name != 0) {
  5017. return int32(_XML_ERROR_NO_MEMORY)
  5018. }
  5019. elementType = _lookup(tls, parser, dtd+40, name, uint64(40))
  5020. if !(elementType != 0) {
  5021. return int32(_XML_ERROR_NO_MEMORY)
  5022. }
  5023. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && !(_setElementTypePrefix(tls, parser, elementType) != 0) {
  5024. return int32(_XML_ERROR_NO_MEMORY)
  5025. }
  5026. }
  5027. nDefaultAtts = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FnDefaultAtts
  5028. /* get the attributes from the tokenizer */
  5029. 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)
  5030. /* Detect and prevent integer overflow */
  5031. if n > int32(m_INT_MAX)-nDefaultAtts {
  5032. return int32(_XML_ERROR_NO_MEMORY)
  5033. }
  5034. if n+nDefaultAtts > (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize {
  5035. oldAttsSize = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize
  5036. /* Detect and prevent integer overflow */
  5037. if nDefaultAtts > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_INIT_ATTS_SIZE) || n > int32(m_INT_MAX)-(nDefaultAtts+int32(m_INIT_ATTS_SIZE)) {
  5038. return int32(_XML_ERROR_NO_MEMORY)
  5039. }
  5040. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = n + nDefaultAtts + int32(m_INIT_ATTS_SIZE)
  5041. /* Detect and prevent integer overflow.
  5042. * The preprocessor guard addresses the "always false" warning
  5043. * from -Wtype-limits on platforms where
  5044. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5045. 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))
  5046. if temp == libc.UintptrFromInt32(0) {
  5047. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = oldAttsSize
  5048. return int32(_XML_ERROR_NO_MEMORY)
  5049. }
  5050. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts = temp
  5051. if n > oldAttsSize {
  5052. (*(*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)
  5053. }
  5054. }
  5055. appAtts = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts
  5056. i = 0
  5057. for {
  5058. if !(i < n) {
  5059. break
  5060. }
  5061. currAtt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32
  5062. /* add the name and value to the attribute list */
  5063. 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)))
  5064. if !(attId != 0) {
  5065. return int32(_XML_ERROR_NO_MEMORY)
  5066. }
  5067. /* Detect duplicate attributes by their QNames. This does not work when
  5068. namespace processing is turned on and different prefixes for the same
  5069. namespace are used. For this case we have a check further down.
  5070. */
  5071. if *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) != 0 {
  5072. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  5073. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).Fname
  5074. }
  5075. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5076. }
  5077. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(1)
  5078. v2 = attIndex
  5079. attIndex++
  5080. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v2)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname
  5081. if !((*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).Fnormalized != 0) {
  5082. isCdata = libc.Uint8FromInt32(1)
  5083. /* figure out whether declared as other than CDATA */
  5084. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized != 0 {
  5085. j = 0
  5086. for {
  5087. if !(j < nDefaultAtts) {
  5088. break
  5089. }
  5090. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*24))).Fid {
  5091. isCdata = (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*24))).FisCdata
  5092. break
  5093. }
  5094. goto _3
  5095. _3:
  5096. ;
  5097. j++
  5098. }
  5099. }
  5100. /* normalize the attribute value */
  5101. 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, account)
  5102. if result != 0 {
  5103. return result
  5104. }
  5105. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5106. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5107. } else {
  5108. /* the value did not need normalizing */
  5109. *(*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)
  5110. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) == uintptr(0) {
  5111. return int32(_XML_ERROR_NO_MEMORY)
  5112. }
  5113. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5114. }
  5115. /* handle prefixed attribute names */
  5116. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix != 0 {
  5117. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0 {
  5118. /* deal with namespace declarations here */
  5119. result1 = _addBinding(tls, parser, (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix, attId, *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)), bindingsPtr)
  5120. if result1 != 0 {
  5121. return result1
  5122. }
  5123. attIndex--
  5124. } else {
  5125. /* deal with other prefixed names later */
  5126. attIndex++
  5127. nPrefixes++
  5128. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(2)
  5129. }
  5130. } else {
  5131. attIndex++
  5132. }
  5133. goto _1
  5134. _1:
  5135. ;
  5136. i++
  5137. }
  5138. /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */
  5139. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = attIndex
  5140. 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 {
  5141. i = 0
  5142. for {
  5143. if !(i < attIndex) {
  5144. break
  5145. }
  5146. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) == (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FidAtt)).Fname {
  5147. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = i
  5148. break
  5149. }
  5150. goto _4
  5151. _4:
  5152. ;
  5153. i += int32(2)
  5154. }
  5155. } else {
  5156. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = -int32(1)
  5157. }
  5158. /* do attribute defaulting */
  5159. i = 0
  5160. for {
  5161. if !(i < nDefaultAtts) {
  5162. break
  5163. }
  5164. da = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(i)*24
  5165. 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 {
  5166. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fprefix != 0 {
  5167. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fxmlns != 0 {
  5168. 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)
  5169. if result2 != 0 {
  5170. return result2
  5171. }
  5172. } else {
  5173. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(2)
  5174. nPrefixes++
  5175. v6 = attIndex
  5176. attIndex++
  5177. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v6)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5178. v7 = attIndex
  5179. attIndex++
  5180. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v7)*8)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5181. }
  5182. } else {
  5183. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(1)
  5184. v8 = attIndex
  5185. attIndex++
  5186. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v8)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5187. v9 = attIndex
  5188. attIndex++
  5189. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v9)*8)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5190. }
  5191. }
  5192. goto _5
  5193. _5:
  5194. ;
  5195. i++
  5196. }
  5197. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = uintptr(0)
  5198. /* expand prefixed attribute names, check for duplicates,
  5199. and clear flags that say whether attributes were specified */
  5200. i = 0
  5201. if nPrefixes != 0 { /* hash table index */
  5202. version = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion
  5203. /* Detect and prevent invalid shift */
  5204. if uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) >= libc.Uint64FromInt64(4)*libc.Uint64FromInt32(8) {
  5205. return int32(_XML_ERROR_NO_MEMORY)
  5206. }
  5207. nsAttsSize = uint32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5208. oldNsAttsPower = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5209. /* size of hash table must be at least 2 * (# of prefixed attributes) */
  5210. if nPrefixes<<int32(1)>>(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower != 0 {
  5211. /* hash table size must also be a power of 2 and >= 8 */
  5212. for {
  5213. v11 = parser + 760
  5214. v10 = *(*uint8)(unsafe.Pointer(v11))
  5215. *(*uint8)(unsafe.Pointer(v11))++
  5216. if !(nPrefixes>>v10 != 0) {
  5217. break
  5218. }
  5219. }
  5220. if libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) < int32(3) {
  5221. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(3)
  5222. }
  5223. /* Detect and prevent invalid shift */
  5224. if uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) >= libc.Uint64FromInt64(4)*libc.Uint64FromInt32(8) {
  5225. /* Restore actual size of memory in m_nsAtts */
  5226. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5227. return int32(_XML_ERROR_NO_MEMORY)
  5228. }
  5229. nsAttsSize = uint32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5230. /* Detect and prevent integer overflow.
  5231. * The preprocessor guard addresses the "always false" warning
  5232. * from -Wtype-limits on platforms where
  5233. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5234. 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, uint64(nsAttsSize)*libc.Uint64FromInt64(24))
  5235. if !(temp1 != 0) {
  5236. /* Restore actual size of memory in m_nsAtts */
  5237. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5238. return int32(_XML_ERROR_NO_MEMORY)
  5239. }
  5240. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = temp1
  5241. version = uint64(0) /* force re-initialization of m_nsAtts hash table */
  5242. }
  5243. /* using a version flag saves us from initializing m_nsAtts every time */
  5244. if !(version != 0) { /* initialize version flags when version wraps around */
  5245. version = uint64(m_INIT_ATTS_VERSION)
  5246. j1 = libc.Int32FromUint32(nsAttsSize)
  5247. for {
  5248. if !(j1 != 0) {
  5249. break
  5250. }
  5251. j1--
  5252. v13 = j1
  5253. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(v13)*24))).Fversion = version
  5254. goto _12
  5255. _12:
  5256. }
  5257. }
  5258. version--
  5259. v14 = version
  5260. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = v14
  5261. /* expand prefixed names and check for duplicates */
  5262. for {
  5263. if !(i < attIndex) {
  5264. break
  5265. }
  5266. s = *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8))
  5267. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1))))) == int32(2) {
  5268. _copy_salt_to_sipkey(tls, parser, bp+56)
  5269. _sip24_init(tls, bp, bp+56)
  5270. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = uint8(0) /* clear flag */
  5271. id = _lookup(tls, parser, dtd+80, s, uint64(0))
  5272. if !(id != 0) || !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  5273. /* This code is walking through the appAtts array, dealing
  5274. * with (in this case) a prefixed attribute name. To be in
  5275. * the array, the attribute must have already been bound, so
  5276. * has to have passed through the hash table lookup once
  5277. * already. That implies that an entry for it already
  5278. * exists, so the lookup above will return a pointer to
  5279. * already allocated memory. There is no opportunaity for
  5280. * the allocator to fail, so the condition above cannot be
  5281. * fulfilled.
  5282. *
  5283. * Since it is difficult to be certain that the above
  5284. * analysis is complete, we retain the test and merely
  5285. * remove the code from coverage tests.
  5286. */
  5287. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  5288. }
  5289. b = (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fbinding
  5290. if !(b != 0) {
  5291. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5292. }
  5293. j1 = 0
  5294. for {
  5295. if !(j1 < (*TBINDING)(unsafe.Pointer(b)).FuriLen) {
  5296. break
  5297. }
  5298. c = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(j1)))
  5299. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5300. v17 = 0
  5301. } else {
  5302. v19 = parser + 784 + 24
  5303. v18 = *(*uintptr)(unsafe.Pointer(v19))
  5304. *(*uintptr)(unsafe.Pointer(v19))++
  5305. *(*TXML_Char)(unsafe.Pointer(v18)) = c
  5306. v17 = libc.Int32FromInt32(1)
  5307. }
  5308. if !(v17 != 0) {
  5309. return int32(_XML_ERROR_NO_MEMORY)
  5310. }
  5311. goto _16
  5312. _16:
  5313. ;
  5314. j1++
  5315. }
  5316. _sip24_update(tls, bp, (*TBINDING)(unsafe.Pointer(b)).Furi, libc.Uint64FromInt32((*TBINDING)(unsafe.Pointer(b)).FuriLen)*uint64(1))
  5317. for {
  5318. v20 = s
  5319. s++
  5320. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(v20))) != int32(m_ASCII_COLON)) {
  5321. break
  5322. }
  5323. }
  5324. _sip24_update(tls, bp, s, _keylen(tls, s)*uint64(1))
  5325. for { /* copies null terminator */
  5326. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5327. v23 = 0
  5328. } else {
  5329. v25 = parser + 784 + 24
  5330. v24 = *(*uintptr)(unsafe.Pointer(v25))
  5331. *(*uintptr)(unsafe.Pointer(v25))++
  5332. *(*TXML_Char)(unsafe.Pointer(v24)) = *(*TXML_Char)(unsafe.Pointer(s))
  5333. v23 = libc.Int32FromInt32(1)
  5334. }
  5335. if !(v23 != 0) {
  5336. return int32(_XML_ERROR_NO_MEMORY)
  5337. }
  5338. goto _22
  5339. _22:
  5340. ;
  5341. v21 = s
  5342. s++
  5343. if !(*(*TXML_Char)(unsafe.Pointer(v21)) != 0) {
  5344. break
  5345. }
  5346. }
  5347. uriHash = _sip24_final(tls, bp)
  5348. /* Check hash table for duplicate of expanded name (uriName).
  5349. Derived from code in lookup(parser, HASH_TABLE *table, ...).
  5350. */
  5351. step = uint8(0)
  5352. mask = uint64(nsAttsSize - uint32(1))
  5353. j1 = libc.Int32FromUint64(uriHash & mask) /* index into hash table */
  5354. for (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fversion == version {
  5355. /* for speed we compare stored hash values first */
  5356. if uriHash == (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fhash {
  5357. s1 = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5358. s2 = (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).FuriName
  5359. /* s1 is null terminated, but not s2 */
  5360. for {
  5361. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s2))) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) != 0) {
  5362. break
  5363. }
  5364. goto _26
  5365. _26:
  5366. ;
  5367. s1++
  5368. s2++
  5369. }
  5370. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  5371. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5372. }
  5373. }
  5374. if !(step != 0) {
  5375. step = uint8(uriHash & ^mask >> (libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  5376. }
  5377. if j1 < libc.Int32FromUint8(step) {
  5378. j1 = int32(uint32(j1) + (nsAttsSize - uint32(step)))
  5379. } else {
  5380. j1 -= libc.Int32FromUint8(step)
  5381. }
  5382. }
  5383. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 { /* append namespace separator and prefix */
  5384. *(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fptr + uintptr(-libc.Int32FromInt32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5385. s = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fname
  5386. for {
  5387. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5388. v30 = 0
  5389. } else {
  5390. v32 = parser + 784 + 24
  5391. v31 = *(*uintptr)(unsafe.Pointer(v32))
  5392. *(*uintptr)(unsafe.Pointer(v32))++
  5393. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s))
  5394. v30 = libc.Int32FromInt32(1)
  5395. }
  5396. if !(v30 != 0) {
  5397. return int32(_XML_ERROR_NO_MEMORY)
  5398. }
  5399. goto _29
  5400. _29:
  5401. ;
  5402. v28 = s
  5403. s++
  5404. if !(*(*TXML_Char)(unsafe.Pointer(v28)) != 0) {
  5405. break
  5406. }
  5407. }
  5408. }
  5409. /* store expanded name in attribute list */
  5410. s = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5411. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5412. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) = s
  5413. /* fill empty slot with new version, uriName and hash value */
  5414. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fversion = version
  5415. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fhash = uriHash
  5416. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).FuriName = s
  5417. nPrefixes--
  5418. v33 = nPrefixes
  5419. if !(v33 != 0) {
  5420. i += int32(2)
  5421. break
  5422. }
  5423. } else { /* not prefixed */
  5424. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = uint8(0)
  5425. } /* clear flag */
  5426. goto _15
  5427. _15:
  5428. ;
  5429. i += int32(2)
  5430. }
  5431. }
  5432. /* clear flags for the remaining attributes */
  5433. for {
  5434. if !(i < attIndex) {
  5435. break
  5436. }
  5437. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) + uintptr(-libc.Int32FromInt32(1)))) = uint8(0)
  5438. goto _34
  5439. _34:
  5440. ;
  5441. i += int32(2)
  5442. }
  5443. binding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5444. for {
  5445. if !(binding != 0) {
  5446. break
  5447. }
  5448. *(*TXML_Char)(unsafe.Pointer((*Tattribute_id)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).FattId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(0)
  5449. goto _35
  5450. _35:
  5451. ;
  5452. binding = (*TBINDING)(unsafe.Pointer(binding)).FnextTagBinding
  5453. }
  5454. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  5455. return int32(_XML_ERROR_NONE)
  5456. }
  5457. /* expand the element type name */
  5458. if (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix != 0 {
  5459. binding = (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix)).Fbinding
  5460. if !(binding != 0) {
  5461. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5462. }
  5463. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5464. for {
  5465. v36 = localPart
  5466. localPart++
  5467. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(v36))) != int32(m_ASCII_COLON)) {
  5468. break
  5469. }
  5470. }
  5471. } else {
  5472. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  5473. binding = (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding
  5474. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5475. } else {
  5476. return int32(_XML_ERROR_NONE)
  5477. }
  5478. }
  5479. prefixLen = 0
  5480. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname != 0 {
  5481. for {
  5482. v38 = prefixLen
  5483. prefixLen++
  5484. if !(*(*TXML_Char)(unsafe.Pointer((*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname + uintptr(v38))) != 0) {
  5485. break
  5486. }
  5487. goto _37
  5488. _37:
  5489. } /* prefixLen includes null terminator */
  5490. }
  5491. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FlocalPart = localPart
  5492. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FuriLen = (*TBINDING)(unsafe.Pointer(binding)).FuriLen
  5493. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fprefix = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname
  5494. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FprefixLen = prefixLen
  5495. i = 0
  5496. for {
  5497. v40 = i
  5498. i++
  5499. if !(*(*TXML_Char)(unsafe.Pointer(localPart + uintptr(v40))) != 0) {
  5500. break
  5501. }
  5502. goto _39
  5503. _39:
  5504. } /* i includes null terminator */
  5505. /* Detect and prevent integer overflow */
  5506. if (*TBINDING)(unsafe.Pointer(binding)).FuriLen > int32(m_INT_MAX)-prefixLen || i > int32(m_INT_MAX)-((*TBINDING)(unsafe.Pointer(binding)).FuriLen+prefixLen) {
  5507. return int32(_XML_ERROR_NO_MEMORY)
  5508. }
  5509. n = i + (*TBINDING)(unsafe.Pointer(binding)).FuriLen + prefixLen
  5510. if n > (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc {
  5511. /* Detect and prevent integer overflow */
  5512. if n > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5513. return int32(_XML_ERROR_NO_MEMORY)
  5514. }
  5515. /* Detect and prevent integer overflow.
  5516. * The preprocessor guard addresses the "always false" warning
  5517. * from -Wtype-limits on platforms where
  5518. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5519. 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))
  5520. if !(uri != 0) {
  5521. return int32(_XML_ERROR_NO_MEMORY)
  5522. }
  5523. (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc = n + int32(m_EXPAND_SPARE)
  5524. libc.Xmemcpy(tls, uri, (*TBINDING)(unsafe.Pointer(binding)).Furi, libc.Uint64FromInt32((*TBINDING)(unsafe.Pointer(binding)).FuriLen)*uint64(1))
  5525. p = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  5526. for {
  5527. if !(p != 0) {
  5528. break
  5529. }
  5530. if (*TTAG)(unsafe.Pointer(p)).Fname.Fstr == (*TBINDING)(unsafe.Pointer(binding)).Furi {
  5531. (*TTAG)(unsafe.Pointer(p)).Fname.Fstr = uri
  5532. }
  5533. goto _41
  5534. _41:
  5535. ;
  5536. p = (*TTAG)(unsafe.Pointer(p)).Fparent
  5537. }
  5538. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(binding)).Furi)
  5539. (*TBINDING)(unsafe.Pointer(binding)).Furi = uri
  5540. }
  5541. /* if m_namespaceSeparator != '\0' then uri includes it already */
  5542. uri = (*TBINDING)(unsafe.Pointer(binding)).Furi + uintptr((*TBINDING)(unsafe.Pointer(binding)).FuriLen)
  5543. libc.Xmemcpy(tls, uri, localPart, libc.Uint64FromInt32(i)*uint64(1))
  5544. /* we always have a namespace separator between localPart and prefix */
  5545. if prefixLen != 0 {
  5546. uri += uintptr(i - int32(1))
  5547. *(*TXML_Char)(unsafe.Pointer(uri)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator /* replace null terminator */
  5548. libc.Xmemcpy(tls, uri+uintptr(1), (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname, libc.Uint64FromInt32(prefixLen)*uint64(1))
  5549. }
  5550. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr = (*TBINDING)(unsafe.Pointer(binding)).Furi
  5551. return int32(_XML_ERROR_NONE)
  5552. }
  5553. func _is_rfc3986_uri_char(tls *libc.TLS, candidate TXML_Char) (r TXML_Bool) {
  5554. // For the RFC 3986 ANBF grammar see
  5555. // https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
  5556. switch libc.Int32FromUint8(candidate) {
  5557. // From rule "ALPHA" (uppercase half)
  5558. case int32('A'):
  5559. fallthrough
  5560. case int32('B'):
  5561. fallthrough
  5562. case int32('C'):
  5563. fallthrough
  5564. case int32('D'):
  5565. fallthrough
  5566. case int32('E'):
  5567. fallthrough
  5568. case int32('F'):
  5569. fallthrough
  5570. case int32('G'):
  5571. fallthrough
  5572. case int32('H'):
  5573. fallthrough
  5574. case int32('I'):
  5575. fallthrough
  5576. case int32('J'):
  5577. fallthrough
  5578. case int32('K'):
  5579. fallthrough
  5580. case int32('L'):
  5581. fallthrough
  5582. case int32('M'):
  5583. fallthrough
  5584. case int32('N'):
  5585. fallthrough
  5586. case int32('O'):
  5587. fallthrough
  5588. case int32('P'):
  5589. fallthrough
  5590. case int32('Q'):
  5591. fallthrough
  5592. case int32('R'):
  5593. fallthrough
  5594. case int32('S'):
  5595. fallthrough
  5596. case int32('T'):
  5597. fallthrough
  5598. case int32('U'):
  5599. fallthrough
  5600. case int32('V'):
  5601. fallthrough
  5602. case int32('W'):
  5603. fallthrough
  5604. case int32('X'):
  5605. fallthrough
  5606. case int32('Y'):
  5607. fallthrough
  5608. case int32('Z'):
  5609. // From rule "ALPHA" (lowercase half)
  5610. fallthrough
  5611. case int32('a'):
  5612. fallthrough
  5613. case int32('b'):
  5614. fallthrough
  5615. case int32('c'):
  5616. fallthrough
  5617. case int32('d'):
  5618. fallthrough
  5619. case int32('e'):
  5620. fallthrough
  5621. case int32('f'):
  5622. fallthrough
  5623. case int32('g'):
  5624. fallthrough
  5625. case int32('h'):
  5626. fallthrough
  5627. case int32('i'):
  5628. fallthrough
  5629. case int32('j'):
  5630. fallthrough
  5631. case int32('k'):
  5632. fallthrough
  5633. case int32('l'):
  5634. fallthrough
  5635. case int32('m'):
  5636. fallthrough
  5637. case int32('n'):
  5638. fallthrough
  5639. case int32('o'):
  5640. fallthrough
  5641. case int32('p'):
  5642. fallthrough
  5643. case int32('q'):
  5644. fallthrough
  5645. case int32('r'):
  5646. fallthrough
  5647. case int32('s'):
  5648. fallthrough
  5649. case int32('t'):
  5650. fallthrough
  5651. case int32('u'):
  5652. fallthrough
  5653. case int32('v'):
  5654. fallthrough
  5655. case int32('w'):
  5656. fallthrough
  5657. case int32('x'):
  5658. fallthrough
  5659. case int32('y'):
  5660. fallthrough
  5661. case int32('z'):
  5662. // From rule "DIGIT"
  5663. fallthrough
  5664. case int32('0'):
  5665. fallthrough
  5666. case int32('1'):
  5667. fallthrough
  5668. case int32('2'):
  5669. fallthrough
  5670. case int32('3'):
  5671. fallthrough
  5672. case int32('4'):
  5673. fallthrough
  5674. case int32('5'):
  5675. fallthrough
  5676. case int32('6'):
  5677. fallthrough
  5678. case int32('7'):
  5679. fallthrough
  5680. case int32('8'):
  5681. fallthrough
  5682. case int32('9'):
  5683. // From rule "pct-encoded"
  5684. fallthrough
  5685. case int32('%'):
  5686. // From rule "unreserved"
  5687. fallthrough
  5688. case int32('-'):
  5689. fallthrough
  5690. case int32('.'):
  5691. fallthrough
  5692. case int32('_'):
  5693. fallthrough
  5694. case int32('~'):
  5695. // From rule "gen-delims"
  5696. fallthrough
  5697. case int32(':'):
  5698. fallthrough
  5699. case int32('/'):
  5700. fallthrough
  5701. case int32('?'):
  5702. fallthrough
  5703. case int32('#'):
  5704. fallthrough
  5705. case int32('['):
  5706. fallthrough
  5707. case int32(']'):
  5708. fallthrough
  5709. case int32('@'):
  5710. // From rule "sub-delims"
  5711. fallthrough
  5712. case int32('!'):
  5713. fallthrough
  5714. case int32('$'):
  5715. fallthrough
  5716. case int32('&'):
  5717. fallthrough
  5718. case int32('\''):
  5719. fallthrough
  5720. case int32('('):
  5721. fallthrough
  5722. case int32(')'):
  5723. fallthrough
  5724. case int32('*'):
  5725. fallthrough
  5726. case int32('+'):
  5727. fallthrough
  5728. case int32(','):
  5729. fallthrough
  5730. case int32(';'):
  5731. fallthrough
  5732. case int32('='):
  5733. return libc.Uint8FromInt32(1)
  5734. default:
  5735. return libc.Uint8FromInt32(0)
  5736. }
  5737. return r
  5738. }
  5739. // C documentation
  5740. //
  5741. // /* addBinding() overwrites the value of prefix->binding without checking.
  5742. // Therefore one must keep track of the old value outside of addBinding().
  5743. // */
  5744. func _addBinding(tls *libc.TLS, parser TXML_Parser, prefix uintptr, attId uintptr, uri uintptr, bindingsPtr uintptr) (r _XML_Error) {
  5745. var b, temp, v3 uintptr
  5746. var isXML, isXMLNS, mustBeXML TXML_Bool
  5747. var len1, v2 int32
  5748. _, _, _, _, _, _, _, _ = b, isXML, isXMLNS, len1, mustBeXML, temp, v2, v3
  5749. mustBeXML = libc.Uint8FromInt32(0)
  5750. isXML = libc.Uint8FromInt32(1)
  5751. isXMLNS = libc.Uint8FromInt32(1)
  5752. /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */
  5753. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 {
  5754. return int32(_XML_ERROR_UNDECLARING_PREFIX)
  5755. }
  5756. 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) {
  5757. /* Not allowed to bind xmlns */
  5758. 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') {
  5759. return int32(_XML_ERROR_RESERVED_PREFIX_XMLNS)
  5760. }
  5761. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32('\000') {
  5762. mustBeXML = libc.Uint8FromInt32(1)
  5763. }
  5764. }
  5765. len1 = 0
  5766. for {
  5767. if !(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1))) != 0) {
  5768. break
  5769. }
  5770. if isXML != 0 && (len1 > _xmlLen || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != libc.Int32FromUint8(_xmlNamespace[len1])) {
  5771. isXML = libc.Uint8FromInt32(0)
  5772. }
  5773. if !(mustBeXML != 0) && isXMLNS != 0 && (len1 > _xmlnsLen || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != libc.Int32FromUint8(_xmlnsNamespace[len1])) {
  5774. isXMLNS = libc.Uint8FromInt32(0)
  5775. }
  5776. // NOTE: While Expat does not validate namespace URIs against RFC 3986
  5777. // today (and is not REQUIRED to do so with regard to the XML 1.0
  5778. // namespaces specification) we have to at least make sure, that
  5779. // the application on top of Expat (that is likely splitting expanded
  5780. // element names ("qualified names") of form
  5781. // "[uri sep] local [sep prefix] '\0'" back into 1, 2 or 3 pieces
  5782. // in its element handler code) cannot be confused by an attacker
  5783. // putting additional namespace separator characters into namespace
  5784. // declarations. That would be ambiguous and not to be expected.
  5785. //
  5786. // While the HTML API docs of function XML_ParserCreateNS have been
  5787. // advising against use of a namespace separator character that can
  5788. // appear in a URI for >20 years now, some widespread applications
  5789. // are using URI characters (':' (colon) in particular) for a
  5790. // namespace separator, in practice. To keep these applications
  5791. // functional, we only reject namespaces URIs containing the
  5792. // application-chosen namespace separator if the chosen separator
  5793. // is a non-URI character with regard to RFC 3986.
  5794. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) == libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator) && !(_is_rfc3986_uri_char(tls, *(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != 0) {
  5795. return int32(_XML_ERROR_SYNTAX)
  5796. }
  5797. goto _1
  5798. _1:
  5799. ;
  5800. len1++
  5801. }
  5802. isXML = libc.BoolUint8(isXML != 0 && len1 == _xmlLen)
  5803. isXMLNS = libc.BoolUint8(isXMLNS != 0 && len1 == _xmlnsLen)
  5804. if libc.Int32FromUint8(mustBeXML) != libc.Int32FromUint8(isXML) {
  5805. if mustBeXML != 0 {
  5806. v2 = int32(_XML_ERROR_RESERVED_PREFIX_XML)
  5807. } else {
  5808. v2 = int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  5809. }
  5810. return v2
  5811. }
  5812. if isXMLNS != 0 {
  5813. return int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  5814. }
  5815. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  5816. len1++
  5817. }
  5818. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList != 0 {
  5819. b = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  5820. if len1 > (*TBINDING)(unsafe.Pointer(b)).FuriAlloc {
  5821. /* Detect and prevent integer overflow */
  5822. if len1 > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5823. return int32(_XML_ERROR_NO_MEMORY)
  5824. }
  5825. /* Detect and prevent integer overflow.
  5826. * The preprocessor guard addresses the "always false" warning
  5827. * from -Wtype-limits on platforms where
  5828. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5829. 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)))
  5830. if temp == libc.UintptrFromInt32(0) {
  5831. return int32(_XML_ERROR_NO_MEMORY)
  5832. }
  5833. (*TBINDING)(unsafe.Pointer(b)).Furi = temp
  5834. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  5835. }
  5836. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  5837. } else {
  5838. b = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(48))
  5839. if !(b != 0) {
  5840. return int32(_XML_ERROR_NO_MEMORY)
  5841. }
  5842. /* Detect and prevent integer overflow */
  5843. if len1 > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5844. return int32(_XML_ERROR_NO_MEMORY)
  5845. }
  5846. /* Detect and prevent integer overflow.
  5847. * The preprocessor guard addresses the "always false" warning
  5848. * from -Wtype-limits on platforms where
  5849. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5850. (*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)))
  5851. if !((*TBINDING)(unsafe.Pointer(b)).Furi != 0) {
  5852. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  5853. return int32(_XML_ERROR_NO_MEMORY)
  5854. }
  5855. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  5856. }
  5857. (*TBINDING)(unsafe.Pointer(b)).FuriLen = len1
  5858. libc.Xmemcpy(tls, (*TBINDING)(unsafe.Pointer(b)).Furi, uri, libc.Uint64FromInt32(len1)*uint64(1))
  5859. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  5860. *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(len1-int32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5861. }
  5862. (*TBINDING)(unsafe.Pointer(b)).Fprefix = prefix
  5863. (*TBINDING)(unsafe.Pointer(b)).FattId = attId
  5864. (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding = (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding
  5865. /* NULL binding when default namespace undeclared */
  5866. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && prefix == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+304 {
  5867. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = libc.UintptrFromInt32(0)
  5868. } else {
  5869. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = b
  5870. }
  5871. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5872. *(*uintptr)(unsafe.Pointer(bindingsPtr)) = b
  5873. /* if attId == NULL then we are not starting a namespace scope */
  5874. if attId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler != 0 {
  5875. if (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0 {
  5876. v3 = uri
  5877. } else {
  5878. v3 = uintptr(0)
  5879. }
  5880. (*(*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)
  5881. }
  5882. return int32(_XML_ERROR_NONE)
  5883. }
  5884. // "http://www.w3.org/XML/1998/namespace"
  5885. var _xmlNamespace = [37]TXML_Char{
  5886. 0: uint8(m_ASCII_h),
  5887. 1: uint8(m_ASCII_t),
  5888. 2: uint8(m_ASCII_t),
  5889. 3: uint8(m_ASCII_p),
  5890. 4: uint8(m_ASCII_COLON),
  5891. 5: uint8(m_ASCII_SLASH),
  5892. 6: uint8(m_ASCII_SLASH),
  5893. 7: uint8(m_ASCII_w),
  5894. 8: uint8(m_ASCII_w),
  5895. 9: uint8(m_ASCII_w),
  5896. 10: uint8(m_ASCII_PERIOD),
  5897. 11: uint8(m_ASCII_w),
  5898. 12: uint8(m_ASCII_3),
  5899. 13: uint8(m_ASCII_PERIOD),
  5900. 14: uint8(m_ASCII_o),
  5901. 15: uint8(m_ASCII_r),
  5902. 16: uint8(m_ASCII_g),
  5903. 17: uint8(m_ASCII_SLASH),
  5904. 18: uint8(m_ASCII_X),
  5905. 19: uint8(m_ASCII_M),
  5906. 20: uint8(m_ASCII_L),
  5907. 21: uint8(m_ASCII_SLASH),
  5908. 22: uint8(m_ASCII_1),
  5909. 23: uint8(m_ASCII_9),
  5910. 24: uint8(m_ASCII_9),
  5911. 25: uint8(m_ASCII_8),
  5912. 26: uint8(m_ASCII_SLASH),
  5913. 27: uint8(m_ASCII_n),
  5914. 28: uint8(m_ASCII_a),
  5915. 29: uint8(m_ASCII_m),
  5916. 30: uint8(m_ASCII_e),
  5917. 31: uint8(m_ASCII_s),
  5918. 32: uint8(m_ASCII_p),
  5919. 33: uint8(m_ASCII_a),
  5920. 34: uint8(m_ASCII_c),
  5921. 35: uint8(m_ASCII_e),
  5922. }
  5923. var _xmlLen = libc.Int32FromUint64(libc.Uint64FromInt32(libc.Int32FromInt64(37))/libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  5924. // "http://www.w3.org/2000/xmlns/"
  5925. var _xmlnsNamespace = [30]TXML_Char{
  5926. 0: uint8(m_ASCII_h),
  5927. 1: uint8(m_ASCII_t),
  5928. 2: uint8(m_ASCII_t),
  5929. 3: uint8(m_ASCII_p),
  5930. 4: uint8(m_ASCII_COLON),
  5931. 5: uint8(m_ASCII_SLASH),
  5932. 6: uint8(m_ASCII_SLASH),
  5933. 7: uint8(m_ASCII_w),
  5934. 8: uint8(m_ASCII_w),
  5935. 9: uint8(m_ASCII_w),
  5936. 10: uint8(m_ASCII_PERIOD),
  5937. 11: uint8(m_ASCII_w),
  5938. 12: uint8(m_ASCII_3),
  5939. 13: uint8(m_ASCII_PERIOD),
  5940. 14: uint8(m_ASCII_o),
  5941. 15: uint8(m_ASCII_r),
  5942. 16: uint8(m_ASCII_g),
  5943. 17: uint8(m_ASCII_SLASH),
  5944. 18: uint8(m_ASCII_2),
  5945. 19: uint8(m_ASCII_0),
  5946. 20: uint8(m_ASCII_0),
  5947. 21: uint8(m_ASCII_0),
  5948. 22: uint8(m_ASCII_SLASH),
  5949. 23: uint8(m_ASCII_x),
  5950. 24: uint8(m_ASCII_m),
  5951. 25: uint8(m_ASCII_l),
  5952. 26: uint8(m_ASCII_n),
  5953. 27: uint8(m_ASCII_s),
  5954. 28: uint8(m_ASCII_SLASH),
  5955. }
  5956. var _xmlnsLen = libc.Int32FromUint64(libc.Uint64FromInt32(libc.Int32FromInt64(30))/libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  5957. // C documentation
  5958. //
  5959. // /* The idea here is to avoid using stack for each CDATA section when
  5960. // the whole file is parsed with one call.
  5961. // */
  5962. func _cdataSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  5963. bp := tls.Alloc(16)
  5964. defer tls.Free(16)
  5965. *(*uintptr)(unsafe.Pointer(bp)) = _start
  5966. var result _XML_Error
  5967. _ = result
  5968. 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)), int32(_XML_ACCOUNT_DIRECT))
  5969. if result != int32(_XML_ERROR_NONE) {
  5970. return result
  5971. }
  5972. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  5973. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 { /* we are parsing an external entity */
  5974. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  5975. return _externalEntityContentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  5976. } else {
  5977. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  5978. return _contentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  5979. }
  5980. }
  5981. return result
  5982. }
  5983. // C documentation
  5984. //
  5985. // /* startPtr gets set to non-null if the section is closed, and to null if
  5986. // the section is not yet closed.
  5987. // */
  5988. func _doCdataSection(tls *libc.TLS, parser TXML_Parser, enc uintptr, startPtr uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool, account _XML_Account) (r _XML_Error) {
  5989. bp := tls.Alloc(32)
  5990. defer tls.Free(32)
  5991. var charDataHandler TXML_CharacterDataHandler
  5992. var convert_res _XML_Convert_Result
  5993. var eventEndPP, eventPP, v3 uintptr
  5994. var tok int32
  5995. var _ /* c at bp+16 */ TXML_Char
  5996. var _ /* dataPtr at bp+24 */ uintptr
  5997. var _ /* next at bp+8 */ uintptr
  5998. var _ /* s at bp+0 */ uintptr
  5999. _, _, _, _, _, _ = charDataHandler, convert_res, eventEndPP, eventPP, tok, v3
  6000. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  6001. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6002. eventPP = parser + 544
  6003. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6004. eventEndPP = parser + 552
  6005. } else {
  6006. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6007. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6008. }
  6009. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6010. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  6011. for {
  6012. *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(bp)) /* in case of XML_TOK_NONE or XML_TOK_PARTIAL */
  6013. 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)
  6014. if !(_accountingDiffTolerated(tls, parser, tok, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)), int32(4044), account) != 0) {
  6015. _accountingOnAbort(tls, parser)
  6016. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6017. }
  6018. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6019. switch tok {
  6020. case int32(m_XML_TOK_CDATA_SECT_CLOSE):
  6021. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler != 0 {
  6022. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  6023. } else {
  6024. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6025. (*(*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)
  6026. } else {
  6027. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6028. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6029. }
  6030. }
  6031. }
  6032. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6033. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6034. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6035. return int32(_XML_ERROR_ABORTED)
  6036. } else {
  6037. return int32(_XML_ERROR_NONE)
  6038. }
  6039. fallthrough
  6040. case int32(m_XML_TOK_DATA_NEWLINE):
  6041. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6042. *(*TXML_Char)(unsafe.Pointer(bp + 16)) = uint8(0xA)
  6043. (*(*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))
  6044. } else {
  6045. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6046. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6047. }
  6048. }
  6049. case int32(m_XML_TOK_DATA_CHARS):
  6050. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  6051. if charDataHandler != 0 {
  6052. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  6053. for {
  6054. *(*uintptr)(unsafe.Pointer(bp + 24)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  6055. 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)
  6056. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6057. (*(*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)))
  6058. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  6059. break
  6060. }
  6061. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6062. goto _2
  6063. _2:
  6064. }
  6065. } else {
  6066. (*(*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)))))
  6067. }
  6068. } else {
  6069. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6070. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6071. }
  6072. }
  6073. case m_XML_TOK_INVALID:
  6074. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6075. return int32(_XML_ERROR_INVALID_TOKEN)
  6076. case -int32(2):
  6077. if haveMore != 0 {
  6078. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6079. return int32(_XML_ERROR_NONE)
  6080. }
  6081. return int32(_XML_ERROR_PARTIAL_CHAR)
  6082. case -int32(1):
  6083. fallthrough
  6084. case -int32(4):
  6085. if haveMore != 0 {
  6086. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6087. return int32(_XML_ERROR_NONE)
  6088. }
  6089. return int32(_XML_ERROR_UNCLOSED_CDATA_SECTION)
  6090. default:
  6091. /* Every token returned by XmlCdataSectionTok() has its own
  6092. * explicit case, so this default case will never be executed.
  6093. * We retain it as a safety net and exclude it from the coverage
  6094. * statistics.
  6095. *
  6096. * LCOV_EXCL_START
  6097. */
  6098. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6099. return int32(_XML_ERROR_UNEXPECTED_STATE)
  6100. /* LCOV_EXCL_STOP */
  6101. }
  6102. v3 = *(*uintptr)(unsafe.Pointer(bp + 8))
  6103. *(*uintptr)(unsafe.Pointer(bp)) = v3
  6104. *(*uintptr)(unsafe.Pointer(eventPP)) = v3
  6105. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  6106. case int32(_XML_SUSPENDED):
  6107. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6108. return int32(_XML_ERROR_NONE)
  6109. case int32(_XML_FINISHED):
  6110. return int32(_XML_ERROR_ABORTED)
  6111. default:
  6112. }
  6113. goto _1
  6114. _1:
  6115. }
  6116. /* not reached */
  6117. return r
  6118. }
  6119. // C documentation
  6120. //
  6121. // /* The idea here is to avoid using stack for each IGNORE section when
  6122. // the whole file is parsed with one call.
  6123. // */
  6124. func _ignoreSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  6125. bp := tls.Alloc(16)
  6126. defer tls.Free(16)
  6127. *(*uintptr)(unsafe.Pointer(bp)) = _start
  6128. var result _XML_Error
  6129. _ = result
  6130. 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)))
  6131. if result != int32(_XML_ERROR_NONE) {
  6132. return result
  6133. }
  6134. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6135. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6136. return _prologProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  6137. }
  6138. return result
  6139. }
  6140. // C documentation
  6141. //
  6142. // /* startPtr gets set to non-null is the section is closed, and to null
  6143. // if the section is not yet closed.
  6144. // */
  6145. func _doIgnoreSection(tls *libc.TLS, parser TXML_Parser, enc uintptr, startPtr uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool) (r _XML_Error) {
  6146. bp := tls.Alloc(16)
  6147. defer tls.Free(16)
  6148. var eventEndPP, eventPP, s uintptr
  6149. var tok int32
  6150. var _ /* next at bp+0 */ uintptr
  6151. _, _, _, _ = eventEndPP, eventPP, s, tok
  6152. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  6153. s = *(*uintptr)(unsafe.Pointer(startPtr))
  6154. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6155. eventPP = parser + 544
  6156. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6157. eventEndPP = parser + 552
  6158. } else {
  6159. /* It's not entirely clear, but it seems the following two lines
  6160. * of code cannot be executed. The only occasions on which 'enc'
  6161. * is not 'encoding' are when this function is called
  6162. * from the internal entity processing, and IGNORE sections are an
  6163. * error in internal entities.
  6164. *
  6165. * Since it really isn't clear that this is true, we keep the code
  6166. * and just remove it from our coverage tests.
  6167. *
  6168. * LCOV_EXCL_START
  6169. */
  6170. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6171. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6172. /* LCOV_EXCL_STOP */
  6173. }
  6174. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6175. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  6176. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 3*8))})))(tls, enc, s, end, bp)
  6177. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4196), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6178. _accountingOnAbort(tls, parser)
  6179. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6180. }
  6181. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6182. switch tok {
  6183. case int32(m_XML_TOK_IGNORE_SECT):
  6184. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6185. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6186. }
  6187. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6188. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6189. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6190. return int32(_XML_ERROR_ABORTED)
  6191. } else {
  6192. return int32(_XML_ERROR_NONE)
  6193. }
  6194. fallthrough
  6195. case m_XML_TOK_INVALID:
  6196. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6197. return int32(_XML_ERROR_INVALID_TOKEN)
  6198. case -int32(2):
  6199. if haveMore != 0 {
  6200. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6201. return int32(_XML_ERROR_NONE)
  6202. }
  6203. return int32(_XML_ERROR_PARTIAL_CHAR)
  6204. case -int32(1):
  6205. fallthrough
  6206. case -int32(4):
  6207. if haveMore != 0 {
  6208. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6209. return int32(_XML_ERROR_NONE)
  6210. }
  6211. return int32(_XML_ERROR_SYNTAX) /* XML_ERROR_UNCLOSED_IGNORE_SECTION */
  6212. default:
  6213. /* All of the tokens that XmlIgnoreSectionTok() returns have
  6214. * explicit cases to handle them, so this default case is never
  6215. * executed. We keep it as a safety net anyway, and remove it
  6216. * from our test coverage statistics.
  6217. *
  6218. * LCOV_EXCL_START
  6219. */
  6220. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6221. return int32(_XML_ERROR_UNEXPECTED_STATE)
  6222. /* LCOV_EXCL_STOP */
  6223. }
  6224. /* not reached */
  6225. return r
  6226. }
  6227. func _initializeEncoding(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  6228. var s uintptr
  6229. var v1 func(*libc.TLS, uintptr, uintptr, uintptr) int32
  6230. _, _ = s, v1
  6231. s = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName
  6232. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6233. v1 = XXmlInitEncodingNS
  6234. } else {
  6235. v1 = XXmlInitEncoding
  6236. }
  6237. if v1(tls, parser+296, parser+288, s) != 0 {
  6238. return int32(_XML_ERROR_NONE)
  6239. }
  6240. return _handleUnknownEncoding(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName)
  6241. }
  6242. func _processXmlDecl(tls *libc.TLS, parser TXML_Parser, isGeneralTextEntity int32, s uintptr, next uintptr) (r _XML_Error) {
  6243. bp := tls.Alloc(48)
  6244. defer tls.Free(48)
  6245. var result _XML_Error
  6246. var storedEncName, storedversion uintptr
  6247. var v1 func(*libc.TLS, int32, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) int32
  6248. var _ /* encodingName at bp+0 */ uintptr
  6249. var _ /* newEncoding at bp+8 */ uintptr
  6250. var _ /* standalone at bp+32 */ int32
  6251. var _ /* version at bp+16 */ uintptr
  6252. var _ /* versionend at bp+24 */ uintptr
  6253. _, _, _, _ = result, storedEncName, storedversion, v1
  6254. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  6255. storedEncName = libc.UintptrFromInt32(0)
  6256. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  6257. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  6258. *(*uintptr)(unsafe.Pointer(bp + 24)) = libc.UintptrFromInt32(0)
  6259. storedversion = libc.UintptrFromInt32(0)
  6260. *(*int32)(unsafe.Pointer(bp + 32)) = -int32(1)
  6261. if !(_accountingDiffTolerated(tls, parser, int32(m_XML_TOK_XML_DECL), s, next, int32(4288), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6262. _accountingOnAbort(tls, parser)
  6263. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6264. }
  6265. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6266. v1 = XXmlParseXmlDeclNS
  6267. } else {
  6268. v1 = XXmlParseXmlDecl
  6269. }
  6270. 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) {
  6271. if isGeneralTextEntity != 0 {
  6272. return int32(_XML_ERROR_TEXT_DECL)
  6273. } else {
  6274. return int32(_XML_ERROR_XML_DECL)
  6275. }
  6276. }
  6277. if !(isGeneralTextEntity != 0) && *(*int32)(unsafe.Pointer(bp + 32)) == int32(1) {
  6278. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).Fstandalone = libc.Uint8FromInt32(1)
  6279. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing == int32(_XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) {
  6280. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  6281. }
  6282. }
  6283. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler != 0 {
  6284. if *(*uintptr)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) {
  6285. 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)))))
  6286. if !(storedEncName != 0) {
  6287. return int32(_XML_ERROR_NO_MEMORY)
  6288. }
  6289. (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fptr
  6290. }
  6291. if *(*uintptr)(unsafe.Pointer(bp + 16)) != 0 {
  6292. 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))
  6293. if !(storedversion != 0) {
  6294. return int32(_XML_ERROR_NO_MEMORY)
  6295. }
  6296. }
  6297. (*(*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)))
  6298. } else {
  6299. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6300. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, next)
  6301. }
  6302. }
  6303. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName == libc.UintptrFromInt32(0) {
  6304. if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 {
  6305. /* Check that the specified encoding does not conflict with what
  6306. * the parser has already deduced. Do we have the same number
  6307. * of bytes in the smallest representation of a character? If
  6308. * this is UTF-16, is it the same endianness?
  6309. */
  6310. 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 {
  6311. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  6312. return int32(_XML_ERROR_INCORRECT_ENCODING)
  6313. }
  6314. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = *(*uintptr)(unsafe.Pointer(bp + 8))
  6315. } else {
  6316. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6317. if !(storedEncName != 0) {
  6318. 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)))))
  6319. if !(storedEncName != 0) {
  6320. return int32(_XML_ERROR_NO_MEMORY)
  6321. }
  6322. }
  6323. result = _handleUnknownEncoding(tls, parser, storedEncName)
  6324. _poolClear(tls, parser+832)
  6325. if result == int32(_XML_ERROR_UNKNOWN_ENCODING) {
  6326. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  6327. }
  6328. return result
  6329. }
  6330. }
  6331. }
  6332. if storedEncName != 0 || storedversion != 0 {
  6333. _poolClear(tls, parser+832)
  6334. }
  6335. return int32(_XML_ERROR_NONE)
  6336. }
  6337. func _handleUnknownEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Error) {
  6338. bp := tls.Alloc(1056)
  6339. defer tls.Free(1056)
  6340. var enc uintptr
  6341. var i int32
  6342. var v2 func(*libc.TLS, uintptr, uintptr, TCONVERTER, uintptr) uintptr
  6343. var _ /* info at bp+0 */ TXML_Encoding
  6344. _, _, _ = enc, i, v2
  6345. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler != 0 {
  6346. i = 0
  6347. for {
  6348. if !(i < int32(256)) {
  6349. break
  6350. }
  6351. *(*int32)(unsafe.Pointer(bp + uintptr(i)*4)) = -int32(1)
  6352. goto _1
  6353. _1:
  6354. ;
  6355. i++
  6356. }
  6357. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert = libc.UintptrFromInt32(0)
  6358. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata = libc.UintptrFromInt32(0)
  6359. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease = libc.UintptrFromInt32(0)
  6360. 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 {
  6361. (*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)))
  6362. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem != 0) {
  6363. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != 0 {
  6364. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6365. }
  6366. return int32(_XML_ERROR_NO_MEMORY)
  6367. }
  6368. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6369. v2 = XXmlInitUnknownEncodingNS
  6370. } else {
  6371. v2 = XXmlInitUnknownEncoding
  6372. }
  6373. enc = v2(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem, bp, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6374. if enc != 0 {
  6375. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata
  6376. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease
  6377. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = enc
  6378. return int32(_XML_ERROR_NONE)
  6379. }
  6380. }
  6381. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != libc.UintptrFromInt32(0) {
  6382. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6383. }
  6384. }
  6385. return int32(_XML_ERROR_UNKNOWN_ENCODING)
  6386. }
  6387. func _prologInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6388. var result _XML_Error
  6389. _ = result
  6390. result = _initializeEncoding(tls, parser)
  6391. if result != int32(_XML_ERROR_NONE) {
  6392. return result
  6393. }
  6394. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6395. return _prologProcessor(tls, parser, s, end, nextPtr)
  6396. }
  6397. func _externalParEntInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6398. var result _XML_Error
  6399. _ = result
  6400. result = _initializeEncoding(tls, parser)
  6401. if result != int32(_XML_ERROR_NONE) {
  6402. return result
  6403. }
  6404. /* we know now that XML_Parse(Buffer) has been called,
  6405. so we consider the external parameter entity read */
  6406. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).FparamEntityRead = libc.Uint8FromInt32(1)
  6407. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue != 0 {
  6408. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueInitProcessor)
  6409. return _entityValueInitProcessor(tls, parser, s, end, nextPtr)
  6410. } else {
  6411. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntProcessor)
  6412. return _externalParEntProcessor(tls, parser, s, end, nextPtr)
  6413. }
  6414. return r
  6415. }
  6416. func _entityValueInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6417. bp := tls.Alloc(16)
  6418. defer tls.Free(16)
  6419. var result _XML_Error
  6420. var start uintptr
  6421. var tok int32
  6422. var _ /* next at bp+0 */ uintptr
  6423. _, _, _ = result, start, tok
  6424. start = s
  6425. *(*uintptr)(unsafe.Pointer(bp)) = start
  6426. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6427. for {
  6428. 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)
  6429. /* Note: Except for XML_TOK_BOM below, these bytes are accounted later in:
  6430. - storeEntityValue
  6431. - processXmlDecl
  6432. */
  6433. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  6434. if tok <= 0 {
  6435. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6436. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6437. return int32(_XML_ERROR_NONE)
  6438. }
  6439. switch tok {
  6440. case m_XML_TOK_INVALID:
  6441. return int32(_XML_ERROR_INVALID_TOKEN)
  6442. case -int32(1):
  6443. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6444. case -int32(2):
  6445. return int32(_XML_ERROR_PARTIAL_CHAR)
  6446. case -int32(4): /* start == end */
  6447. fallthrough
  6448. default:
  6449. break
  6450. }
  6451. /* found end of entity value - can store it now */
  6452. return _storeEntityValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, int32(_XML_ACCOUNT_DIRECT))
  6453. } else {
  6454. if tok == int32(m_XML_TOK_XML_DECL) {
  6455. result = _processXmlDecl(tls, parser, 0, start, *(*uintptr)(unsafe.Pointer(bp)))
  6456. if result != int32(_XML_ERROR_NONE) {
  6457. return result
  6458. }
  6459. /* At this point, m_parsingStatus.parsing cannot be XML_SUSPENDED. For
  6460. * that to happen, a parameter entity parsing handler must have attempted
  6461. * to suspend the parser, which fails and raises an error. The parser can
  6462. * be aborted, but can't be suspended.
  6463. */
  6464. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6465. return int32(_XML_ERROR_ABORTED)
  6466. }
  6467. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6468. /* stop scanning for text declaration - we found one */
  6469. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueProcessor)
  6470. return _entityValueProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, nextPtr)
  6471. } else {
  6472. if tok == int32(m_XML_TOK_BOM) && *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  6473. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4495), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6474. _accountingOnAbort(tls, parser)
  6475. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6476. }
  6477. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6478. return int32(_XML_ERROR_NONE)
  6479. } else {
  6480. if tok == int32(m_XML_TOK_INSTANCE_START) {
  6481. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6482. return int32(_XML_ERROR_SYNTAX)
  6483. }
  6484. }
  6485. }
  6486. }
  6487. start = *(*uintptr)(unsafe.Pointer(bp))
  6488. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6489. goto _1
  6490. _1:
  6491. }
  6492. return r
  6493. }
  6494. func _externalParEntProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6495. bp := tls.Alloc(16)
  6496. defer tls.Free(16)
  6497. var tok int32
  6498. var _ /* next at bp+0 */ uintptr
  6499. _ = tok
  6500. *(*uintptr)(unsafe.Pointer(bp)) = s
  6501. 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)
  6502. if tok <= 0 {
  6503. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6504. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6505. return int32(_XML_ERROR_NONE)
  6506. }
  6507. switch tok {
  6508. case m_XML_TOK_INVALID:
  6509. return int32(_XML_ERROR_INVALID_TOKEN)
  6510. case -int32(1):
  6511. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6512. case -int32(2):
  6513. return int32(_XML_ERROR_PARTIAL_CHAR)
  6514. case -int32(4): /* start == end */
  6515. fallthrough
  6516. default:
  6517. break
  6518. }
  6519. } else {
  6520. if tok == int32(m_XML_TOK_BOM) {
  6521. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4548), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6522. _accountingOnAbort(tls, parser)
  6523. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6524. }
  6525. s = *(*uintptr)(unsafe.Pointer(bp))
  6526. 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)
  6527. }
  6528. }
  6529. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6530. 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), int32(_XML_ACCOUNT_DIRECT))
  6531. }
  6532. func _entityValueProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6533. bp := tls.Alloc(16)
  6534. defer tls.Free(16)
  6535. var enc, start uintptr
  6536. var tok int32
  6537. var _ /* next at bp+0 */ uintptr
  6538. _, _, _ = enc, start, tok
  6539. start = s
  6540. *(*uintptr)(unsafe.Pointer(bp)) = s
  6541. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6542. for {
  6543. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, start, end, bp)
  6544. /* Note: These bytes are accounted later in:
  6545. - storeEntityValue
  6546. */
  6547. if tok <= 0 {
  6548. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6549. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6550. return int32(_XML_ERROR_NONE)
  6551. }
  6552. switch tok {
  6553. case m_XML_TOK_INVALID:
  6554. return int32(_XML_ERROR_INVALID_TOKEN)
  6555. case -int32(1):
  6556. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6557. case -int32(2):
  6558. return int32(_XML_ERROR_PARTIAL_CHAR)
  6559. case -int32(4): /* start == end */
  6560. fallthrough
  6561. default:
  6562. break
  6563. }
  6564. /* found end of entity value - can store it now */
  6565. return _storeEntityValue(tls, parser, enc, s, end, int32(_XML_ACCOUNT_DIRECT))
  6566. }
  6567. start = *(*uintptr)(unsafe.Pointer(bp))
  6568. goto _1
  6569. _1:
  6570. }
  6571. return r
  6572. }
  6573. func _prologProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6574. bp := tls.Alloc(16)
  6575. defer tls.Free(16)
  6576. var tok int32
  6577. var _ /* next at bp+0 */ uintptr
  6578. _ = tok
  6579. *(*uintptr)(unsafe.Pointer(bp)) = s
  6580. 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)
  6581. 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), int32(_XML_ACCOUNT_DIRECT))
  6582. }
  6583. 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, account _XML_Account) (r _XML_Error) {
  6584. bp := tls.Alloc(16)
  6585. defer tls.Free(16)
  6586. *(*uintptr)(unsafe.Pointer(bp)) = _next
  6587. 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
  6588. var betweenDecl, hadParamEntityRefs, hadParamEntityRefs1, handleDefault TXML_Bool
  6589. var myindex, myindex1, role, v66, v69, v73, v76, v82, v84, v85 int32
  6590. var nameLen, v88 Tsize_t
  6591. var quant _XML_Content_Quant
  6592. var result, result1, result2, result3, result4, result5 _XML_Error
  6593. var v72, v79, v83 bool
  6594. var v81 uint32
  6595. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  6596. /* save one level of indirection */
  6597. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  6598. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6599. eventPP = parser + 544
  6600. eventEndPP = parser + 552
  6601. } else {
  6602. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6603. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6604. }
  6605. for {
  6606. handleDefault = libc.Uint8FromInt32(1)
  6607. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6608. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6609. if tok <= 0 {
  6610. if haveMore != 0 && tok != m_XML_TOK_INVALID {
  6611. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6612. return int32(_XML_ERROR_NONE)
  6613. }
  6614. switch tok {
  6615. case m_XML_TOK_INVALID:
  6616. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6617. return int32(_XML_ERROR_INVALID_TOKEN)
  6618. case -int32(1):
  6619. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6620. case -int32(2):
  6621. return int32(_XML_ERROR_PARTIAL_CHAR)
  6622. case -int32(m_XML_TOK_PROLOG_S):
  6623. tok = -tok
  6624. case -int32(4):
  6625. /* for internal PE NOT referenced between declarations */
  6626. if enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding && !((*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities)).FbetweenDecl != 0) {
  6627. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6628. return int32(_XML_ERROR_NONE)
  6629. }
  6630. /* WFC: PE Between Declarations - must check that PE contains
  6631. complete markup, not only for external PEs, but also for
  6632. internal PEs if the reference occurs between declarations.
  6633. */
  6634. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6635. 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) {
  6636. return int32(_XML_ERROR_INCOMPLETE_PE)
  6637. }
  6638. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6639. return int32(_XML_ERROR_NONE)
  6640. }
  6641. return int32(_XML_ERROR_NO_ELEMENTS)
  6642. default:
  6643. tok = -tok
  6644. *(*uintptr)(unsafe.Pointer(bp)) = end
  6645. break
  6646. }
  6647. }
  6648. 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)
  6649. switch role {
  6650. case int32(_XML_ROLE_INSTANCE_START): // bytes accounted in contentProcessor
  6651. fallthrough
  6652. case int32(_XML_ROLE_XML_DECL): // bytes accounted in processXmlDecl
  6653. fallthrough
  6654. case int32(_XML_ROLE_TEXT_DECL): // bytes accounted in processXmlDecl
  6655. default:
  6656. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4717), account) != 0) {
  6657. _accountingOnAbort(tls, parser)
  6658. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6659. }
  6660. }
  6661. switch role {
  6662. case int32(_XML_ROLE_XML_DECL):
  6663. goto _2
  6664. case int32(_XML_ROLE_DOCTYPE_NAME):
  6665. goto _3
  6666. case int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET):
  6667. goto _4
  6668. case int32(_XML_ROLE_TEXT_DECL):
  6669. goto _5
  6670. case int32(_XML_ROLE_DOCTYPE_PUBLIC_ID):
  6671. goto _6
  6672. case int32(_XML_ROLE_ENTITY_PUBLIC_ID):
  6673. goto _7
  6674. case int32(_XML_ROLE_DOCTYPE_CLOSE):
  6675. goto _8
  6676. case int32(_XML_ROLE_INSTANCE_START):
  6677. goto _9
  6678. case int32(_XML_ROLE_ATTLIST_ELEMENT_NAME):
  6679. goto _10
  6680. case int32(_XML_ROLE_ATTRIBUTE_NAME):
  6681. goto _11
  6682. case int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA):
  6683. goto _12
  6684. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ID):
  6685. goto _13
  6686. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREF):
  6687. goto _14
  6688. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREFS):
  6689. goto _15
  6690. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITY):
  6691. goto _16
  6692. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITIES):
  6693. goto _17
  6694. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN):
  6695. goto _18
  6696. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS):
  6697. goto _19
  6698. case int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE):
  6699. goto _20
  6700. case int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE):
  6701. goto _21
  6702. case int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE):
  6703. goto _22
  6704. case int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE):
  6705. goto _23
  6706. case int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE):
  6707. goto _24
  6708. case int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE):
  6709. goto _25
  6710. case int32(_XML_ROLE_ENTITY_VALUE):
  6711. goto _26
  6712. case int32(_XML_ROLE_DOCTYPE_SYSTEM_ID):
  6713. goto _27
  6714. case int32(_XML_ROLE_ENTITY_SYSTEM_ID):
  6715. goto _28
  6716. case int32(_XML_ROLE_ENTITY_COMPLETE):
  6717. goto _29
  6718. case int32(_XML_ROLE_ENTITY_NOTATION_NAME):
  6719. goto _30
  6720. case int32(_XML_ROLE_GENERAL_ENTITY_NAME):
  6721. goto _31
  6722. case int32(_XML_ROLE_PARAM_ENTITY_NAME):
  6723. goto _32
  6724. case int32(_XML_ROLE_NOTATION_NAME):
  6725. goto _33
  6726. case int32(_XML_ROLE_NOTATION_PUBLIC_ID):
  6727. goto _34
  6728. case int32(_XML_ROLE_NOTATION_SYSTEM_ID):
  6729. goto _35
  6730. case int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID):
  6731. goto _36
  6732. case int32(_XML_ROLE_ERROR):
  6733. goto _37
  6734. case int32(_XML_ROLE_IGNORE_SECT):
  6735. goto _38
  6736. case int32(_XML_ROLE_GROUP_OPEN):
  6737. goto _39
  6738. case int32(_XML_ROLE_GROUP_SEQUENCE):
  6739. goto _40
  6740. case int32(_XML_ROLE_GROUP_CHOICE):
  6741. goto _41
  6742. case int32(_XML_ROLE_INNER_PARAM_ENTITY_REF):
  6743. goto _42
  6744. case int32(_XML_ROLE_PARAM_ENTITY_REF):
  6745. goto _43
  6746. case int32(_XML_ROLE_ELEMENT_NAME):
  6747. goto _44
  6748. case int32(_XML_ROLE_CONTENT_EMPTY):
  6749. goto _45
  6750. case int32(_XML_ROLE_CONTENT_ANY):
  6751. goto _46
  6752. case int32(_XML_ROLE_CONTENT_PCDATA):
  6753. goto _47
  6754. case int32(_XML_ROLE_CONTENT_ELEMENT):
  6755. goto _48
  6756. case int32(_XML_ROLE_CONTENT_ELEMENT_OPT):
  6757. goto _49
  6758. case int32(_XML_ROLE_CONTENT_ELEMENT_REP):
  6759. goto _50
  6760. case int32(_XML_ROLE_CONTENT_ELEMENT_PLUS):
  6761. goto _51
  6762. case int32(_XML_ROLE_GROUP_CLOSE):
  6763. goto _52
  6764. case int32(_XML_ROLE_GROUP_CLOSE_OPT):
  6765. goto _53
  6766. case int32(_XML_ROLE_GROUP_CLOSE_REP):
  6767. goto _54
  6768. case int32(_XML_ROLE_GROUP_CLOSE_PLUS):
  6769. goto _55
  6770. case int32(_XML_ROLE_PI):
  6771. goto _56
  6772. case int32(_XML_ROLE_COMMENT):
  6773. goto _57
  6774. case int32(_XML_ROLE_NONE):
  6775. goto _58
  6776. case int32(_XML_ROLE_DOCTYPE_NONE):
  6777. goto _59
  6778. case int32(_XML_ROLE_ENTITY_NONE):
  6779. goto _60
  6780. case int32(_XML_ROLE_NOTATION_NONE):
  6781. goto _61
  6782. case int32(_XML_ROLE_ATTLIST_NONE):
  6783. goto _62
  6784. case int32(_XML_ROLE_ELEMENT_NONE):
  6785. goto _63
  6786. }
  6787. goto _64
  6788. _2:
  6789. ;
  6790. result = _processXmlDecl(tls, parser, 0, s, *(*uintptr)(unsafe.Pointer(bp)))
  6791. if result != int32(_XML_ERROR_NONE) {
  6792. return result
  6793. }
  6794. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6795. handleDefault = libc.Uint8FromInt32(0)
  6796. goto _64
  6797. _3:
  6798. ;
  6799. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6800. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = _poolStoreString(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6801. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0) {
  6802. return int32(_XML_ERROR_NO_MEMORY)
  6803. }
  6804. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6805. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  6806. handleDefault = libc.Uint8FromInt32(0)
  6807. }
  6808. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0) /* always initialize to NULL */
  6809. goto _64
  6810. _4:
  6811. ;
  6812. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6813. (*(*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))
  6814. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  6815. _poolClear(tls, parser+784)
  6816. handleDefault = libc.Uint8FromInt32(0)
  6817. }
  6818. goto _64
  6819. _5:
  6820. ;
  6821. result1 = _processXmlDecl(tls, parser, int32(1), s, *(*uintptr)(unsafe.Pointer(bp)))
  6822. if result1 != int32(_XML_ERROR_NONE) {
  6823. return result1
  6824. }
  6825. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6826. handleDefault = libc.Uint8FromInt32(0)
  6827. goto _64
  6828. _6:
  6829. ;
  6830. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  6831. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6832. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  6833. return int32(_XML_ERROR_NO_MEMORY)
  6834. }
  6835. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6836. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6837. 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) {
  6838. return int32(_XML_ERROR_PUBLICID)
  6839. }
  6840. pubId = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6841. if !(pubId != 0) {
  6842. return int32(_XML_ERROR_NO_MEMORY)
  6843. }
  6844. _normalizePublicId(tls, pubId)
  6845. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6846. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = pubId
  6847. handleDefault = libc.Uint8FromInt32(0)
  6848. goto alreadyChecked
  6849. }
  6850. /* fall through */
  6851. _7:
  6852. ;
  6853. 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) {
  6854. return int32(_XML_ERROR_PUBLICID)
  6855. }
  6856. goto alreadyChecked
  6857. alreadyChecked:
  6858. ;
  6859. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  6860. tem = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6861. if !(tem != 0) {
  6862. return int32(_XML_ERROR_NO_MEMORY)
  6863. }
  6864. _normalizePublicId(tls, tem)
  6865. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = tem
  6866. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  6867. /* Don't suppress the default handler if we fell through from
  6868. * the XML_ROLE_DOCTYPE_PUBLIC_ID case.
  6869. */
  6870. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_PUBLIC_ID) {
  6871. handleDefault = libc.Uint8FromInt32(0)
  6872. }
  6873. }
  6874. goto _64
  6875. _8:
  6876. ;
  6877. if libc.Int32FromUint8(allowClosingDoctype) != libc.Int32FromUint8(libc.Uint8FromInt32(1)) {
  6878. /* Must not close doctype from within expanded parameter entities */
  6879. return int32(_XML_ERROR_INVALID_TOKEN)
  6880. }
  6881. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0 {
  6882. (*(*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)
  6883. _poolClear(tls, parser+784)
  6884. handleDefault = libc.Uint8FromInt32(0)
  6885. }
  6886. /* parser->m_doctypeSysid will be non-NULL in the case of a previous
  6887. XML_ROLE_DOCTYPE_SYSTEM_ID, even if parser->m_startDoctypeDeclHandler
  6888. was not set, indicating an external subset
  6889. */
  6890. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0 || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6891. hadParamEntityRefs = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  6892. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6893. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  6894. entity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6895. if !(entity != 0) {
  6896. /* The external subset name "#" will have already been
  6897. * inserted into the hash table at the start of the
  6898. * external entity parsing, so no allocation will happen
  6899. * and lookup() cannot fail.
  6900. */
  6901. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  6902. }
  6903. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6904. (*TENTITY)(unsafe.Pointer(entity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  6905. }
  6906. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  6907. 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) {
  6908. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  6909. }
  6910. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  6911. 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) {
  6912. return int32(_XML_ERROR_NOT_STANDALONE)
  6913. }
  6914. } else {
  6915. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0) {
  6916. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs
  6917. }
  6918. }
  6919. /* end of DTD - no need to update dtd->keepProcessing */
  6920. }
  6921. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  6922. }
  6923. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler != 0 {
  6924. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  6925. handleDefault = libc.Uint8FromInt32(0)
  6926. }
  6927. goto _64
  6928. _9:
  6929. ;
  6930. /* if there is no DOCTYPE declaration then now is the
  6931. last chance to read the foreign DTD
  6932. */
  6933. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6934. hadParamEntityRefs1 = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  6935. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6936. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  6937. entity1 = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6938. if !(entity1 != 0) {
  6939. return int32(_XML_ERROR_NO_MEMORY)
  6940. }
  6941. (*TENTITY)(unsafe.Pointer(entity1)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  6942. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  6943. 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) {
  6944. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  6945. }
  6946. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  6947. 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) {
  6948. return int32(_XML_ERROR_NOT_STANDALONE)
  6949. }
  6950. } else {
  6951. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs1
  6952. }
  6953. /* end of DTD - no need to update dtd->keepProcessing */
  6954. }
  6955. }
  6956. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  6957. return _contentProcessor(tls, parser, s, end, nextPtr)
  6958. _10:
  6959. ;
  6960. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6961. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  6962. return int32(_XML_ERROR_NO_MEMORY)
  6963. }
  6964. goto checkAttListDeclHandler
  6965. _11:
  6966. ;
  6967. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = _getAttributeId(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6968. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId != 0) {
  6969. return int32(_XML_ERROR_NO_MEMORY)
  6970. }
  6971. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  6972. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  6973. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  6974. goto checkAttListDeclHandler
  6975. _12:
  6976. ;
  6977. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(1)
  6978. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeCDATA))
  6979. goto checkAttListDeclHandler
  6980. _13:
  6981. ;
  6982. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(1)
  6983. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeID))
  6984. goto checkAttListDeclHandler
  6985. _14:
  6986. ;
  6987. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREF))
  6988. goto checkAttListDeclHandler
  6989. _15:
  6990. ;
  6991. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREFS))
  6992. goto checkAttListDeclHandler
  6993. _16:
  6994. ;
  6995. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITY))
  6996. goto checkAttListDeclHandler
  6997. _17:
  6998. ;
  6999. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITIES))
  7000. goto checkAttListDeclHandler
  7001. _18:
  7002. ;
  7003. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKEN))
  7004. goto checkAttListDeclHandler
  7005. _19:
  7006. ;
  7007. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKENS))
  7008. goto checkAttListDeclHandler
  7009. checkAttListDeclHandler:
  7010. ;
  7011. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7012. handleDefault = libc.Uint8FromInt32(0)
  7013. }
  7014. goto _64
  7015. _21:
  7016. ;
  7017. _20:
  7018. ;
  7019. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7020. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7021. prefix = uintptr(unsafe.Pointer(&_enumValueSep))
  7022. } else {
  7023. if role == int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE) {
  7024. v65 = uintptr(unsafe.Pointer(&_notationPrefix))
  7025. } else {
  7026. v65 = uintptr(unsafe.Pointer(&_enumValueStart))
  7027. }
  7028. prefix = v65
  7029. }
  7030. if !(_poolAppendString(tls, parser+784, prefix) != 0) {
  7031. return int32(_XML_ERROR_NO_MEMORY)
  7032. }
  7033. if !(_poolAppend(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7034. return int32(_XML_ERROR_NO_MEMORY)
  7035. }
  7036. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7037. handleDefault = libc.Uint8FromInt32(0)
  7038. }
  7039. goto _64
  7040. _23:
  7041. ;
  7042. _22:
  7043. ;
  7044. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7045. 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) {
  7046. return int32(_XML_ERROR_NO_MEMORY)
  7047. }
  7048. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7049. 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) {
  7050. /* Enumerated or Notation type */
  7051. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7052. v66 = 0
  7053. } else {
  7054. v68 = parser + 784 + 24
  7055. v67 = *(*uintptr)(unsafe.Pointer(v68))
  7056. *(*uintptr)(unsafe.Pointer(v68))++
  7057. *(*TXML_Char)(unsafe.Pointer(v67)) = uint8(m_ASCII_RPAREN)
  7058. v66 = libc.Int32FromInt32(1)
  7059. }
  7060. if v72 = !(v66 != 0); !v72 {
  7061. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7062. v69 = 0
  7063. } else {
  7064. v71 = parser + 784 + 24
  7065. v70 = *(*uintptr)(unsafe.Pointer(v71))
  7066. *(*uintptr)(unsafe.Pointer(v71))++
  7067. *(*TXML_Char)(unsafe.Pointer(v70)) = uint8('\000')
  7068. v69 = libc.Int32FromInt32(1)
  7069. }
  7070. }
  7071. if v72 || !(v69 != 0) {
  7072. return int32(_XML_ERROR_NO_MEMORY)
  7073. }
  7074. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7075. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7076. }
  7077. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7078. (*(*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)))
  7079. handleDefault = libc.Uint8FromInt32(0)
  7080. }
  7081. }
  7082. _poolClear(tls, parser+784)
  7083. goto _64
  7084. _25:
  7085. ;
  7086. _24:
  7087. ;
  7088. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7089. 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, int32(_XML_ACCOUNT_NONE))
  7090. if result2 != 0 {
  7091. return result2
  7092. }
  7093. attVal = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7094. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7095. /* ID attributes aren't allowed to have a default */
  7096. 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) {
  7097. return int32(_XML_ERROR_NO_MEMORY)
  7098. }
  7099. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7100. 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) {
  7101. /* Enumerated or Notation type */
  7102. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7103. v73 = 0
  7104. } else {
  7105. v75 = parser + 784 + 24
  7106. v74 = *(*uintptr)(unsafe.Pointer(v75))
  7107. *(*uintptr)(unsafe.Pointer(v75))++
  7108. *(*TXML_Char)(unsafe.Pointer(v74)) = uint8(m_ASCII_RPAREN)
  7109. v73 = libc.Int32FromInt32(1)
  7110. }
  7111. if v79 = !(v73 != 0); !v79 {
  7112. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7113. v76 = 0
  7114. } else {
  7115. v78 = parser + 784 + 24
  7116. v77 = *(*uintptr)(unsafe.Pointer(v78))
  7117. *(*uintptr)(unsafe.Pointer(v78))++
  7118. *(*TXML_Char)(unsafe.Pointer(v77)) = uint8('\000')
  7119. v76 = libc.Int32FromInt32(1)
  7120. }
  7121. }
  7122. if v79 || !(v76 != 0) {
  7123. return int32(_XML_ERROR_NO_MEMORY)
  7124. }
  7125. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7126. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7127. }
  7128. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7129. (*(*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)))
  7130. _poolClear(tls, parser+784)
  7131. handleDefault = libc.Uint8FromInt32(0)
  7132. }
  7133. }
  7134. goto _64
  7135. _26:
  7136. ;
  7137. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7138. result3 = _storeEntityValue(tls, parser, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), int32(_XML_ACCOUNT_NONE))
  7139. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7140. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextPtr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart
  7141. (*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))
  7142. (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fptr
  7143. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7144. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7145. (*(*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))
  7146. handleDefault = libc.Uint8FromInt32(0)
  7147. }
  7148. } else {
  7149. (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart
  7150. }
  7151. if result3 != int32(_XML_ERROR_NONE) {
  7152. return result3
  7153. }
  7154. }
  7155. goto _64
  7156. _27:
  7157. ;
  7158. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  7159. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7160. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7161. (*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))
  7162. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid == libc.UintptrFromInt32(0) {
  7163. return int32(_XML_ERROR_NO_MEMORY)
  7164. }
  7165. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7166. handleDefault = libc.Uint8FromInt32(0)
  7167. } else {
  7168. /* use externalSubsetName to make parser->m_doctypeSysid non-NULL
  7169. for the case where no parser->m_startDoctypeDeclHandler is set */
  7170. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = uintptr(unsafe.Pointer(&_externalSubsetName))
  7171. }
  7172. 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) {
  7173. return int32(_XML_ERROR_NOT_STANDALONE)
  7174. }
  7175. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7176. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  7177. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7178. return int32(_XML_ERROR_NO_MEMORY)
  7179. }
  7180. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7181. }
  7182. /* fall through */
  7183. _28:
  7184. ;
  7185. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7186. (*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))
  7187. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId != 0) {
  7188. return int32(_XML_ERROR_NO_MEMORY)
  7189. }
  7190. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  7191. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7192. /* Don't suppress the default handler if we fell through from
  7193. * the XML_ROLE_DOCTYPE_SYSTEM_ID case.
  7194. */
  7195. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_SYSTEM_ID) {
  7196. handleDefault = libc.Uint8FromInt32(0)
  7197. }
  7198. }
  7199. goto _64
  7200. _29:
  7201. ;
  7202. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7203. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7204. (*(*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))
  7205. handleDefault = libc.Uint8FromInt32(0)
  7206. }
  7207. goto _64
  7208. _30:
  7209. ;
  7210. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7211. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7212. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation != 0) {
  7213. return int32(_XML_ERROR_NO_MEMORY)
  7214. }
  7215. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7216. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler != 0 {
  7217. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7218. (*(*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)
  7219. handleDefault = libc.Uint8FromInt32(0)
  7220. } else {
  7221. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7222. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7223. (*(*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)
  7224. handleDefault = libc.Uint8FromInt32(0)
  7225. }
  7226. }
  7227. }
  7228. goto _64
  7229. _31:
  7230. ;
  7231. 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 {
  7232. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7233. goto _64
  7234. }
  7235. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7236. name = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7237. if !(name != 0) {
  7238. return int32(_XML_ERROR_NO_MEMORY)
  7239. }
  7240. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd, name, uint64(64))
  7241. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7242. return int32(_XML_ERROR_NO_MEMORY)
  7243. }
  7244. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name {
  7245. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7246. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7247. } else {
  7248. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7249. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7250. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(0)
  7251. /* if we have a parent parser or are reading an internal parameter
  7252. entity, then the entity declaration is not considered "internal"
  7253. */
  7254. (*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))
  7255. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7256. handleDefault = libc.Uint8FromInt32(0)
  7257. }
  7258. }
  7259. } else {
  7260. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7261. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7262. }
  7263. goto _64
  7264. _32:
  7265. ;
  7266. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7267. name1 = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7268. if !(name1 != 0) {
  7269. return int32(_XML_ERROR_NO_MEMORY)
  7270. }
  7271. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, name1, uint64(64))
  7272. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7273. return int32(_XML_ERROR_NO_MEMORY)
  7274. }
  7275. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name1 {
  7276. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7277. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7278. } else {
  7279. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7280. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7281. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(1)
  7282. /* if we have a parent parser or are reading an internal parameter
  7283. entity, then the entity declaration is not considered "internal"
  7284. */
  7285. (*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))
  7286. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7287. handleDefault = libc.Uint8FromInt32(0)
  7288. }
  7289. }
  7290. } else {
  7291. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7292. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7293. }
  7294. goto _64
  7295. _33:
  7296. ;
  7297. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  7298. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  7299. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7300. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = _poolStoreString(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7301. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0) {
  7302. return int32(_XML_ERROR_NO_MEMORY)
  7303. }
  7304. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7305. handleDefault = libc.Uint8FromInt32(0)
  7306. }
  7307. goto _64
  7308. _34:
  7309. ;
  7310. 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) {
  7311. return int32(_XML_ERROR_PUBLICID)
  7312. }
  7313. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 { /* means m_notationDeclHandler != NULL */
  7314. tem1 = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7315. if !(tem1 != 0) {
  7316. return int32(_XML_ERROR_NO_MEMORY)
  7317. }
  7318. _normalizePublicId(tls, tem1)
  7319. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = tem1
  7320. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7321. handleDefault = libc.Uint8FromInt32(0)
  7322. }
  7323. goto _64
  7324. _35:
  7325. ;
  7326. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7327. systemId = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7328. if !(systemId != 0) {
  7329. return int32(_XML_ERROR_NO_MEMORY)
  7330. }
  7331. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7332. (*(*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)
  7333. handleDefault = libc.Uint8FromInt32(0)
  7334. }
  7335. _poolClear(tls, parser+784)
  7336. goto _64
  7337. _36:
  7338. ;
  7339. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7340. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7341. (*(*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)
  7342. handleDefault = libc.Uint8FromInt32(0)
  7343. }
  7344. _poolClear(tls, parser+784)
  7345. goto _64
  7346. _37:
  7347. ;
  7348. switch tok {
  7349. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  7350. /* PE references in internal subset are
  7351. not allowed within declarations. */
  7352. return int32(_XML_ERROR_PARAM_ENTITY_REF)
  7353. case int32(m_XML_TOK_XML_DECL):
  7354. return int32(_XML_ERROR_MISPLACED_XML_PI)
  7355. default:
  7356. return int32(_XML_ERROR_SYNTAX)
  7357. }
  7358. _38:
  7359. ;
  7360. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7361. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7362. }
  7363. handleDefault = libc.Uint8FromInt32(0)
  7364. result4 = _doIgnoreSection(tls, parser, enc, bp, end, nextPtr, haveMore)
  7365. if result4 != int32(_XML_ERROR_NONE) {
  7366. return result4
  7367. } else {
  7368. if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) {
  7369. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_ignoreSectionProcessor)
  7370. return result4
  7371. }
  7372. }
  7373. goto _64
  7374. _39:
  7375. ;
  7376. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize {
  7377. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize != 0 {
  7378. /* Detect and prevent integer overflow */
  7379. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromUint32(2) {
  7380. return int32(_XML_ERROR_NO_MEMORY)
  7381. }
  7382. p80 = parser + 888
  7383. *(*uint32)(unsafe.Pointer(p80)) *= uint32(2)
  7384. 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))))
  7385. if new_connector == libc.UintptrFromInt32(0) {
  7386. *(*uint32)(unsafe.Pointer(parser + 888)) /= uint32(2)
  7387. return int32(_XML_ERROR_NO_MEMORY)
  7388. }
  7389. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = new_connector
  7390. if (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0 {
  7391. /* Detect and prevent integer overflow.
  7392. * The preprocessor guard addresses the "always false" warning
  7393. * from -Wtype-limits on platforms where
  7394. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  7395. 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))
  7396. if new_scaff_index == libc.UintptrFromInt32(0) {
  7397. return int32(_XML_ERROR_NO_MEMORY)
  7398. }
  7399. (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex = new_scaff_index
  7400. }
  7401. } else {
  7402. v81 = libc.Uint32FromInt32(32)
  7403. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = v81
  7404. (*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))
  7405. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector != 0) {
  7406. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  7407. return int32(_XML_ERROR_NO_MEMORY)
  7408. }
  7409. }
  7410. }
  7411. *(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = uint8(0)
  7412. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7413. myindex = _nextScaffoldPart(tls, parser)
  7414. if myindex < 0 {
  7415. return int32(_XML_ERROR_NO_MEMORY)
  7416. }
  7417. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel)*4)) = myindex
  7418. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel++
  7419. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex)*32))).Ftype1 = int32(_XML_CTYPE_SEQ)
  7420. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7421. handleDefault = libc.Uint8FromInt32(0)
  7422. }
  7423. }
  7424. goto _64
  7425. _40:
  7426. ;
  7427. 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) {
  7428. return int32(_XML_ERROR_SYNTAX)
  7429. }
  7430. *(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = uint8(m_ASCII_COMMA)
  7431. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7432. handleDefault = libc.Uint8FromInt32(0)
  7433. }
  7434. goto _64
  7435. _41:
  7436. ;
  7437. 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) {
  7438. return int32(_XML_ERROR_SYNTAX)
  7439. }
  7440. 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) {
  7441. (*(*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)
  7442. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7443. handleDefault = libc.Uint8FromInt32(0)
  7444. }
  7445. }
  7446. *(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = uint8(m_ASCII_PIPE)
  7447. goto _64
  7448. _43:
  7449. ;
  7450. _42:
  7451. ;
  7452. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7453. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0) {
  7454. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7455. } else {
  7456. name2 = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7457. if !(name2 != 0) {
  7458. return int32(_XML_ERROR_NO_MEMORY)
  7459. }
  7460. entity2 = _lookup(tls, parser, dtd+264, name2, uint64(0))
  7461. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7462. /* first, determine if a check for an existing declaration is needed;
  7463. if yes, check that the entity exists, and that it is internal,
  7464. otherwise call the skipped entity handler
  7465. */
  7466. if v83 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v83 {
  7467. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  7468. v82 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  7469. } else {
  7470. v82 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  7471. }
  7472. }
  7473. if v83 && v82 != 0 {
  7474. if !(entity2 != 0) {
  7475. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  7476. } else {
  7477. if !((*TENTITY)(unsafe.Pointer(entity2)).Fis_internal != 0) {
  7478. /* It's hard to exhaustively search the code to be sure,
  7479. * but there doesn't seem to be a way of executing the
  7480. * following line. There are two cases:
  7481. *
  7482. * If 'standalone' is false, the DTD must have no
  7483. * parameter entities or we wouldn't have passed the outer
  7484. * 'if' statement. That means the only entity in the hash
  7485. * table is the external subset name "#" which cannot be
  7486. * given as a parameter entity name in XML syntax, so the
  7487. * lookup must have returned NULL and we don't even reach
  7488. * the test for an internal entity.
  7489. *
  7490. * If 'standalone' is true, it does not seem to be
  7491. * possible to create entities taking this code path that
  7492. * are not internal entities, so fail the test above.
  7493. *
  7494. * Because this analysis is very uncertain, the code is
  7495. * being left in place and merely removed from the
  7496. * coverage test statistics.
  7497. */
  7498. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE) /* LCOV_EXCL_LINE */
  7499. }
  7500. }
  7501. } else {
  7502. if !(entity2 != 0) {
  7503. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7504. /* cannot report skipped entities in declarations */
  7505. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  7506. (*(*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))
  7507. handleDefault = libc.Uint8FromInt32(0)
  7508. }
  7509. goto _64
  7510. }
  7511. }
  7512. if (*TENTITY)(unsafe.Pointer(entity2)).Fopen != 0 {
  7513. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  7514. }
  7515. if (*TENTITY)(unsafe.Pointer(entity2)).FtextPtr != 0 {
  7516. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) {
  7517. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  7518. } else {
  7519. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  7520. }
  7521. betweenDecl = libc.Uint8FromInt32(v84)
  7522. result5 = _processInternalEntity(tls, parser, entity2, betweenDecl)
  7523. if result5 != int32(_XML_ERROR_NONE) {
  7524. return result5
  7525. }
  7526. handleDefault = libc.Uint8FromInt32(0)
  7527. goto _64
  7528. }
  7529. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  7530. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  7531. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(1)
  7532. _entityTrackingOnOpen(tls, parser, entity2, int32(5439))
  7533. 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) {
  7534. _entityTrackingOnClose(tls, parser, entity2, int32(5443))
  7535. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7536. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  7537. }
  7538. _entityTrackingOnClose(tls, parser, entity2, int32(5447))
  7539. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7540. handleDefault = libc.Uint8FromInt32(0)
  7541. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  7542. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7543. goto _64
  7544. }
  7545. } else {
  7546. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7547. goto _64
  7548. }
  7549. }
  7550. 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) {
  7551. return int32(_XML_ERROR_NOT_STANDALONE)
  7552. }
  7553. goto _64
  7554. /* Element declaration stuff */
  7555. _44:
  7556. ;
  7557. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7558. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7559. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  7560. return int32(_XML_ERROR_NO_MEMORY)
  7561. }
  7562. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel = 0
  7563. (*TDTD)(unsafe.Pointer(dtd)).FscaffCount = uint32(0)
  7564. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(1)
  7565. handleDefault = libc.Uint8FromInt32(0)
  7566. }
  7567. goto _64
  7568. _46:
  7569. ;
  7570. _45:
  7571. ;
  7572. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7573. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7574. content = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(32))
  7575. if !(content != 0) {
  7576. return int32(_XML_ERROR_NO_MEMORY)
  7577. }
  7578. (*TXML_Content)(unsafe.Pointer(content)).Fquant = int32(_XML_CQUANT_NONE)
  7579. (*TXML_Content)(unsafe.Pointer(content)).Fname = libc.UintptrFromInt32(0)
  7580. (*TXML_Content)(unsafe.Pointer(content)).Fnumchildren = uint32(0)
  7581. (*TXML_Content)(unsafe.Pointer(content)).Fchildren = libc.UintptrFromInt32(0)
  7582. if role == int32(_XML_ROLE_CONTENT_ANY) {
  7583. v85 = int32(_XML_CTYPE_ANY)
  7584. } else {
  7585. v85 = int32(_XML_CTYPE_EMPTY)
  7586. }
  7587. (*TXML_Content)(unsafe.Pointer(content)).Ftype1 = v85
  7588. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7589. (*(*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)
  7590. handleDefault = libc.Uint8FromInt32(0)
  7591. }
  7592. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7593. }
  7594. goto _64
  7595. _47:
  7596. ;
  7597. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7598. (*(*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)
  7599. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7600. handleDefault = libc.Uint8FromInt32(0)
  7601. }
  7602. }
  7603. goto _64
  7604. _48:
  7605. ;
  7606. quant = int32(_XML_CQUANT_NONE)
  7607. goto elementContent
  7608. _49:
  7609. ;
  7610. quant = int32(_XML_CQUANT_OPT)
  7611. goto elementContent
  7612. _50:
  7613. ;
  7614. quant = int32(_XML_CQUANT_REP)
  7615. goto elementContent
  7616. _51:
  7617. ;
  7618. quant = int32(_XML_CQUANT_PLUS)
  7619. goto elementContent
  7620. elementContent:
  7621. ;
  7622. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7623. if quant == int32(_XML_CQUANT_NONE) {
  7624. v86 = *(*uintptr)(unsafe.Pointer(bp))
  7625. } else {
  7626. v86 = *(*uintptr)(unsafe.Pointer(bp)) - uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  7627. }
  7628. nxt = v86
  7629. myindex1 = _nextScaffoldPart(tls, parser)
  7630. if myindex1 < 0 {
  7631. return int32(_XML_ERROR_NO_MEMORY)
  7632. }
  7633. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Ftype1 = int32(_XML_CTYPE_NAME)
  7634. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Fquant = quant
  7635. el = _getElementType(tls, parser, enc, s, nxt)
  7636. if !(el != 0) {
  7637. return int32(_XML_ERROR_NO_MEMORY)
  7638. }
  7639. name3 = (*TELEMENT_TYPE)(unsafe.Pointer(el)).Fname
  7640. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Fname = name3
  7641. nameLen = uint64(0)
  7642. for {
  7643. v88 = nameLen
  7644. nameLen++
  7645. if !(*(*TXML_Char)(unsafe.Pointer(name3 + uintptr(v88))) != 0) {
  7646. break
  7647. }
  7648. goto _87
  7649. _87:
  7650. }
  7651. /* Detect and prevent integer overflow */
  7652. if nameLen > uint64(uint32(0xffffffff)-(*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen) {
  7653. return int32(_XML_ERROR_NO_MEMORY)
  7654. }
  7655. *(*uint32)(unsafe.Pointer(dtd + 336)) += uint32(nameLen)
  7656. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7657. handleDefault = libc.Uint8FromInt32(0)
  7658. }
  7659. }
  7660. goto _64
  7661. _52:
  7662. ;
  7663. quant = int32(_XML_CQUANT_NONE)
  7664. goto closeGroup
  7665. _53:
  7666. ;
  7667. quant = int32(_XML_CQUANT_OPT)
  7668. goto closeGroup
  7669. _54:
  7670. ;
  7671. quant = int32(_XML_CQUANT_REP)
  7672. goto closeGroup
  7673. _55:
  7674. ;
  7675. quant = int32(_XML_CQUANT_PLUS)
  7676. goto closeGroup
  7677. closeGroup:
  7678. ;
  7679. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7680. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7681. handleDefault = libc.Uint8FromInt32(0)
  7682. }
  7683. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel--
  7684. (*(*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
  7685. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel == 0 {
  7686. if !(handleDefault != 0) {
  7687. model = _build_model(tls, parser)
  7688. if !(model != 0) {
  7689. return int32(_XML_ERROR_NO_MEMORY)
  7690. }
  7691. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7692. (*(*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)
  7693. }
  7694. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7695. (*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen = uint32(0)
  7696. }
  7697. }
  7698. goto _64
  7699. /* End element declaration stuff */
  7700. _56:
  7701. ;
  7702. if !(_reportProcessingInstruction(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7703. return int32(_XML_ERROR_NO_MEMORY)
  7704. }
  7705. handleDefault = libc.Uint8FromInt32(0)
  7706. goto _64
  7707. _57:
  7708. ;
  7709. if !(_reportComment(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7710. return int32(_XML_ERROR_NO_MEMORY)
  7711. }
  7712. handleDefault = libc.Uint8FromInt32(0)
  7713. goto _64
  7714. _58:
  7715. ;
  7716. switch tok {
  7717. case int32(m_XML_TOK_BOM):
  7718. handleDefault = libc.Uint8FromInt32(0)
  7719. break
  7720. }
  7721. goto _64
  7722. _59:
  7723. ;
  7724. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7725. handleDefault = libc.Uint8FromInt32(0)
  7726. }
  7727. goto _64
  7728. _60:
  7729. ;
  7730. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7731. handleDefault = libc.Uint8FromInt32(0)
  7732. }
  7733. goto _64
  7734. _61:
  7735. ;
  7736. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7737. handleDefault = libc.Uint8FromInt32(0)
  7738. }
  7739. goto _64
  7740. _62:
  7741. ;
  7742. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7743. handleDefault = libc.Uint8FromInt32(0)
  7744. }
  7745. goto _64
  7746. _63:
  7747. ;
  7748. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7749. handleDefault = libc.Uint8FromInt32(0)
  7750. }
  7751. goto _64
  7752. _64:
  7753. ; /* end of big switch */
  7754. if handleDefault != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7755. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7756. }
  7757. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  7758. case int32(_XML_SUSPENDED):
  7759. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7760. return int32(_XML_ERROR_NONE)
  7761. case int32(_XML_FINISHED):
  7762. return int32(_XML_ERROR_ABORTED)
  7763. default:
  7764. s = *(*uintptr)(unsafe.Pointer(bp))
  7765. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, s, end, bp)
  7766. }
  7767. goto _1
  7768. _1:
  7769. }
  7770. /* not reached */
  7771. return r
  7772. }
  7773. var _externalSubsetName = [2]TXML_Char{
  7774. 0: uint8(m_ASCII_HASH),
  7775. }
  7776. var _atypeCDATA = [6]TXML_Char{
  7777. 0: uint8(m_ASCII_C),
  7778. 1: uint8(m_ASCII_D),
  7779. 2: uint8(m_ASCII_A),
  7780. 3: uint8(m_ASCII_T),
  7781. 4: uint8(m_ASCII_A),
  7782. }
  7783. var _atypeID = [3]TXML_Char{
  7784. 0: uint8(m_ASCII_I),
  7785. 1: uint8(m_ASCII_D),
  7786. }
  7787. var _atypeIDREF = [6]TXML_Char{
  7788. 0: uint8(m_ASCII_I),
  7789. 1: uint8(m_ASCII_D),
  7790. 2: uint8(m_ASCII_R),
  7791. 3: uint8(m_ASCII_E),
  7792. 4: uint8(m_ASCII_F),
  7793. }
  7794. var _atypeIDREFS = [7]TXML_Char{
  7795. 0: uint8(m_ASCII_I),
  7796. 1: uint8(m_ASCII_D),
  7797. 2: uint8(m_ASCII_R),
  7798. 3: uint8(m_ASCII_E),
  7799. 4: uint8(m_ASCII_F),
  7800. 5: uint8(m_ASCII_S),
  7801. }
  7802. var _atypeENTITY = [7]TXML_Char{
  7803. 0: uint8(m_ASCII_E),
  7804. 1: uint8(m_ASCII_N),
  7805. 2: uint8(m_ASCII_T),
  7806. 3: uint8(m_ASCII_I),
  7807. 4: uint8(m_ASCII_T),
  7808. 5: uint8(m_ASCII_Y),
  7809. }
  7810. var _atypeENTITIES = [9]TXML_Char{
  7811. 0: uint8(m_ASCII_E),
  7812. 1: uint8(m_ASCII_N),
  7813. 2: uint8(m_ASCII_T),
  7814. 3: uint8(m_ASCII_I),
  7815. 4: uint8(m_ASCII_T),
  7816. 5: uint8(m_ASCII_I),
  7817. 6: uint8(m_ASCII_E),
  7818. 7: uint8(m_ASCII_S),
  7819. }
  7820. var _atypeNMTOKEN = [8]TXML_Char{
  7821. 0: uint8(m_ASCII_N),
  7822. 1: uint8(m_ASCII_M),
  7823. 2: uint8(m_ASCII_T),
  7824. 3: uint8(m_ASCII_O),
  7825. 4: uint8(m_ASCII_K),
  7826. 5: uint8(m_ASCII_E),
  7827. 6: uint8(m_ASCII_N),
  7828. }
  7829. var _atypeNMTOKENS = [9]TXML_Char{
  7830. 0: uint8(m_ASCII_N),
  7831. 1: uint8(m_ASCII_M),
  7832. 2: uint8(m_ASCII_T),
  7833. 3: uint8(m_ASCII_O),
  7834. 4: uint8(m_ASCII_K),
  7835. 5: uint8(m_ASCII_E),
  7836. 6: uint8(m_ASCII_N),
  7837. 7: uint8(m_ASCII_S),
  7838. }
  7839. var _notationPrefix = [10]TXML_Char{
  7840. 0: uint8(m_ASCII_N),
  7841. 1: uint8(m_ASCII_O),
  7842. 2: uint8(m_ASCII_T),
  7843. 3: uint8(m_ASCII_A),
  7844. 4: uint8(m_ASCII_T),
  7845. 5: uint8(m_ASCII_I),
  7846. 6: uint8(m_ASCII_O),
  7847. 7: uint8(m_ASCII_N),
  7848. 8: uint8(m_ASCII_LPAREN),
  7849. }
  7850. var _enumValueSep = [2]TXML_Char{
  7851. 0: uint8(m_ASCII_PIPE),
  7852. }
  7853. var _enumValueStart = [2]TXML_Char{
  7854. 0: uint8(m_ASCII_LPAREN),
  7855. }
  7856. func _epilogProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  7857. bp := tls.Alloc(16)
  7858. defer tls.Free(16)
  7859. var tok int32
  7860. var v2 uintptr
  7861. var _ /* next at bp+0 */ uintptr
  7862. _, _ = tok, v2
  7863. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  7864. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = s
  7865. for {
  7866. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  7867. 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)
  7868. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(5652), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  7869. _accountingOnAbort(tls, parser)
  7870. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  7871. }
  7872. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  7873. switch tok {
  7874. /* report partial linebreak - it might be the last token */
  7875. case -int32(m_XML_TOK_PROLOG_S):
  7876. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7877. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  7878. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  7879. return int32(_XML_ERROR_ABORTED)
  7880. }
  7881. }
  7882. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7883. return int32(_XML_ERROR_NONE)
  7884. case -int32(4):
  7885. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7886. return int32(_XML_ERROR_NONE)
  7887. case int32(m_XML_TOK_PROLOG_S):
  7888. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7889. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  7890. }
  7891. case int32(m_XML_TOK_PI):
  7892. if !(_reportProcessingInstruction(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7893. return int32(_XML_ERROR_NO_MEMORY)
  7894. }
  7895. case int32(m_XML_TOK_COMMENT):
  7896. if !(_reportComment(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7897. return int32(_XML_ERROR_NO_MEMORY)
  7898. }
  7899. case m_XML_TOK_INVALID:
  7900. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  7901. return int32(_XML_ERROR_INVALID_TOKEN)
  7902. case -int32(1):
  7903. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  7904. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7905. return int32(_XML_ERROR_NONE)
  7906. }
  7907. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  7908. case -int32(2):
  7909. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  7910. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7911. return int32(_XML_ERROR_NONE)
  7912. }
  7913. return int32(_XML_ERROR_PARTIAL_CHAR)
  7914. default:
  7915. return int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT)
  7916. }
  7917. v2 = *(*uintptr)(unsafe.Pointer(bp))
  7918. s = v2
  7919. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v2
  7920. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  7921. case int32(_XML_SUSPENDED):
  7922. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7923. return int32(_XML_ERROR_NONE)
  7924. case int32(_XML_FINISHED):
  7925. return int32(_XML_ERROR_ABORTED)
  7926. default:
  7927. }
  7928. goto _1
  7929. _1:
  7930. }
  7931. return r
  7932. }
  7933. func _processInternalEntity(tls *libc.TLS, parser TXML_Parser, entity uintptr, betweenDecl TXML_Bool) (r _XML_Error) {
  7934. bp := tls.Alloc(16)
  7935. defer tls.Free(16)
  7936. var openEntity, textEnd, textStart uintptr
  7937. var result _XML_Error
  7938. var tok int32
  7939. var _ /* next at bp+0 */ uintptr
  7940. _, _, _, _, _ = openEntity, result, textEnd, textStart, tok
  7941. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities != 0 {
  7942. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  7943. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  7944. } else {
  7945. openEntity = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(40))
  7946. if !(openEntity != 0) {
  7947. return int32(_XML_ERROR_NO_MEMORY)
  7948. }
  7949. }
  7950. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  7951. _entityTrackingOnOpen(tls, parser, entity, int32(5732))
  7952. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = 0
  7953. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  7954. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = openEntity
  7955. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity = entity
  7956. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FstartTagLevel = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel
  7957. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FbetweenDecl = betweenDecl
  7958. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventPtr = libc.UintptrFromInt32(0)
  7959. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventEndPtr = libc.UintptrFromInt32(0)
  7960. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr
  7961. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  7962. /* Set a safe default value in case 'next' does not get set */
  7963. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  7964. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  7965. 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)
  7966. 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), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  7967. } else {
  7968. result = _doContent(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, textStart, textEnd, bp, libc.Uint8FromInt32(0), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  7969. }
  7970. if result == int32(_XML_ERROR_NONE) {
  7971. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  7972. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(textStart))
  7973. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_internalEntityProcessor)
  7974. } else {
  7975. _entityTrackingOnClose(tls, parser, entity, int32(5766))
  7976. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  7977. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  7978. /* put openEntity back in list of free instances */
  7979. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  7980. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  7981. }
  7982. }
  7983. return result
  7984. }
  7985. func _internalEntityProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  7986. bp := tls.Alloc(16)
  7987. defer tls.Free(16)
  7988. var entity, openEntity, textEnd, textStart uintptr
  7989. var result _XML_Error
  7990. var tok, tok1, v1 int32
  7991. var _ /* next at bp+0 */ uintptr
  7992. _, _, _, _, _, _, _, _ = entity, openEntity, result, textEnd, textStart, tok, tok1, v1
  7993. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  7994. if !(openEntity != 0) {
  7995. return int32(_XML_ERROR_UNEXPECTED_STATE)
  7996. }
  7997. entity = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity
  7998. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).Fprocessed)
  7999. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  8000. /* Set a safe default value in case 'next' does not get set */
  8001. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  8002. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  8003. 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)
  8004. 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), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8005. } else {
  8006. result = _doContent(tls, parser, (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FstartTagLevel, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, textStart, textEnd, bp, libc.Uint8FromInt32(0), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8007. }
  8008. if result != int32(_XML_ERROR_NONE) {
  8009. return result
  8010. }
  8011. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8012. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64((*TENTITY)(unsafe.Pointer(entity)).FtextPtr))
  8013. return result
  8014. }
  8015. _entityTrackingOnClose(tls, parser, entity, int32(5817))
  8016. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8017. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  8018. /* put openEntity back in list of free instances */
  8019. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  8020. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  8021. // If there are more open entities we want to stop right here and have the
  8022. // upcoming call to XML_ResumeParser continue with entity content, or it would
  8023. // be ignored altogether.
  8024. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != libc.UintptrFromInt32(0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8025. return int32(_XML_ERROR_NONE)
  8026. }
  8027. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  8028. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  8029. 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)
  8030. 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), int32(_XML_ACCOUNT_DIRECT))
  8031. } else {
  8032. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  8033. /* see externalEntityContentProcessor vs contentProcessor */
  8034. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  8035. v1 = int32(1)
  8036. } else {
  8037. v1 = 0
  8038. }
  8039. result = _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)), int32(_XML_ACCOUNT_DIRECT))
  8040. if result == int32(_XML_ERROR_NONE) {
  8041. if !(_storeRawNames(tls, parser) != 0) {
  8042. return int32(_XML_ERROR_NO_MEMORY)
  8043. }
  8044. }
  8045. return result
  8046. }
  8047. return r
  8048. }
  8049. func _errorProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8050. _ = s
  8051. _ = end
  8052. _ = nextPtr
  8053. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  8054. }
  8055. func _storeAttributeValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, isCdata TXML_Bool, ptr uintptr, end uintptr, pool uintptr, account _XML_Account) (r _XML_Error) {
  8056. var result _XML_Error
  8057. var v1 int32
  8058. var v2, v3 uintptr
  8059. _, _, _, _ = result, v1, v2, v3
  8060. result = _appendAttributeValue(tls, parser, enc, isCdata, ptr, end, pool, account)
  8061. if result != 0 {
  8062. return result
  8063. }
  8064. 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) {
  8065. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr--
  8066. }
  8067. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8068. v1 = 0
  8069. } else {
  8070. v3 = pool + 24
  8071. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8072. *(*uintptr)(unsafe.Pointer(v3))++
  8073. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8('\000')
  8074. v1 = libc.Int32FromInt32(1)
  8075. }
  8076. if !(v1 != 0) {
  8077. return int32(_XML_ERROR_NO_MEMORY)
  8078. }
  8079. return int32(_XML_ERROR_NONE)
  8080. }
  8081. func _appendAttributeValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, isCdata TXML_Bool, ptr uintptr, end uintptr, pool uintptr, account _XML_Account) (r _XML_Error) {
  8082. bp := tls.Alloc(16)
  8083. defer tls.Free(16)
  8084. var checkEntityDecl uint8
  8085. var dtd, entity, name, textEnd, v10, v11, v4, v5, v7, v8 uintptr
  8086. var i, n, tok, v12, v3, v6, v9 int32
  8087. var result _XML_Error
  8088. var v13 bool
  8089. var _ /* buf at bp+8 */ [4]TXML_Char
  8090. var _ /* ch at bp+12 */ TXML_Char
  8091. var _ /* next at bp+0 */ uintptr
  8092. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = checkEntityDecl, dtd, entity, i, n, name, result, textEnd, tok, v10, v11, v12, v13, v3, v4, v5, v6, v7, v8, v9
  8093. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  8094. for {
  8095. *(*uintptr)(unsafe.Pointer(bp)) = ptr /* XmlAttributeValueTok doesn't always set the last arg */
  8096. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 32))})))(tls, enc, ptr, end, bp)
  8097. if !(_accountingDiffTolerated(tls, parser, tok, ptr, *(*uintptr)(unsafe.Pointer(bp)), int32(5896), account) != 0) {
  8098. _accountingOnAbort(tls, parser)
  8099. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8100. }
  8101. switch tok {
  8102. case -int32(4):
  8103. return int32(_XML_ERROR_NONE)
  8104. case m_XML_TOK_INVALID:
  8105. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8106. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8107. }
  8108. return int32(_XML_ERROR_INVALID_TOKEN)
  8109. case -int32(1):
  8110. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8111. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8112. }
  8113. return int32(_XML_ERROR_INVALID_TOKEN)
  8114. case int32(m_XML_TOK_CHAR_REF):
  8115. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, ptr)
  8116. if n < 0 {
  8117. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8118. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8119. }
  8120. return int32(_XML_ERROR_BAD_CHAR_REF)
  8121. }
  8122. 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)) {
  8123. break
  8124. }
  8125. n = XXmlUtf8Encode(tls, n, bp+8)
  8126. /* The XmlEncode() functions can never return 0 here. That
  8127. * error return happens if the code point passed in is either
  8128. * negative or greater than or equal to 0x110000. The
  8129. * XmlCharRefNumber() functions will all return a number
  8130. * strictly less than 0x110000 or a negative value if an error
  8131. * occurred. The negative value is intercepted above, so
  8132. * XmlEncode() is never passed a value it might return an
  8133. * error for.
  8134. */
  8135. i = 0
  8136. for {
  8137. if !(i < n) {
  8138. break
  8139. }
  8140. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8141. v3 = 0
  8142. } else {
  8143. v5 = pool + 24
  8144. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8145. *(*uintptr)(unsafe.Pointer(v5))++
  8146. *(*TXML_Char)(unsafe.Pointer(v4)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 8)))[i]
  8147. v3 = libc.Int32FromInt32(1)
  8148. }
  8149. if !(v3 != 0) {
  8150. return int32(_XML_ERROR_NO_MEMORY)
  8151. }
  8152. goto _2
  8153. _2:
  8154. ;
  8155. i++
  8156. }
  8157. case int32(m_XML_TOK_DATA_CHARS):
  8158. if !(_poolAppend(tls, pool, enc, ptr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8159. return int32(_XML_ERROR_NO_MEMORY)
  8160. }
  8161. case -int32(3):
  8162. *(*uintptr)(unsafe.Pointer(bp)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  8163. /* fall through */
  8164. fallthrough
  8165. case int32(m_XML_TOK_ATTRIBUTE_VALUE_S):
  8166. fallthrough
  8167. case int32(m_XML_TOK_DATA_NEWLINE):
  8168. 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)) {
  8169. break
  8170. }
  8171. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8172. v6 = 0
  8173. } else {
  8174. v8 = pool + 24
  8175. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8176. *(*uintptr)(unsafe.Pointer(v8))++
  8177. *(*TXML_Char)(unsafe.Pointer(v7)) = uint8(0x20)
  8178. v6 = libc.Int32FromInt32(1)
  8179. }
  8180. if !(v6 != 0) {
  8181. return int32(_XML_ERROR_NO_MEMORY)
  8182. }
  8183. case int32(m_XML_TOK_ENTITY_REF):
  8184. *(*TXML_Char)(unsafe.Pointer(bp + 12)) = 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)))
  8185. if *(*TXML_Char)(unsafe.Pointer(bp + 12)) != 0 {
  8186. /* NOTE: We are replacing 4-6 characters original input for 1 character
  8187. * so there is no amplification and hence recording without
  8188. * protection. */
  8189. _accountingDiffTolerated(tls, parser, tok, bp+12, bp+12+uintptr(1), int32(5965), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8190. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8191. v9 = 0
  8192. } else {
  8193. v11 = pool + 24
  8194. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8195. *(*uintptr)(unsafe.Pointer(v11))++
  8196. *(*TXML_Char)(unsafe.Pointer(v10)) = *(*TXML_Char)(unsafe.Pointer(bp + 12))
  8197. v9 = libc.Int32FromInt32(1)
  8198. }
  8199. if !(v9 != 0) {
  8200. return int32(_XML_ERROR_NO_MEMORY)
  8201. }
  8202. break
  8203. }
  8204. name = _poolStoreString(tls, parser+832, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  8205. if !(name != 0) {
  8206. return int32(_XML_ERROR_NO_MEMORY)
  8207. }
  8208. entity = _lookup(tls, parser, dtd, name, uint64(0))
  8209. (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fstart
  8210. /* First, determine if a check for an existing declaration is needed;
  8211. if yes, check that the entity exists, and that it is internal.
  8212. */
  8213. if pool == dtd+160 { /* are we called from prolog? */
  8214. if v13 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v13 {
  8215. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  8216. v12 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  8217. } else {
  8218. v12 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  8219. }
  8220. }
  8221. checkEntityDecl = libc.BoolUint8(v13 && v12 != 0)
  8222. } else { /* if (pool == &parser->m_tempPool): we are called from content */
  8223. checkEntityDecl = libc.BoolUint8(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0)
  8224. }
  8225. if checkEntityDecl != 0 {
  8226. if !(entity != 0) {
  8227. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  8228. } else {
  8229. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  8230. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  8231. }
  8232. }
  8233. } else {
  8234. if !(entity != 0) {
  8235. /* Cannot report skipped entity here - see comments on
  8236. parser->m_skippedEntityHandler.
  8237. if (parser->m_skippedEntityHandler)
  8238. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  8239. */
  8240. /* Cannot call the default handler because this would be
  8241. out of sync with the call to the startElementHandler.
  8242. if ((pool == &parser->m_tempPool) && parser->m_defaultHandler)
  8243. reportDefault(parser, enc, ptr, next);
  8244. */
  8245. break
  8246. }
  8247. }
  8248. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  8249. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8250. /* It does not appear that this line can be executed.
  8251. *
  8252. * The "if (entity->open)" check catches recursive entity
  8253. * definitions. In order to be called with an open
  8254. * entity, it must have gone through this code before and
  8255. * been through the recursive call to
  8256. * appendAttributeValue() some lines below. That call
  8257. * sets the local encoding ("enc") to the parser's
  8258. * internal encoding (internal_utf8 or internal_utf16),
  8259. * which can never be the same as the principle encoding.
  8260. * It doesn't appear there is another code path that gets
  8261. * here with entity->open being TRUE.
  8262. *
  8263. * Since it is not certain that this logic is watertight,
  8264. * we keep the line and merely exclude it from coverage
  8265. * tests.
  8266. */
  8267. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr /* LCOV_EXCL_LINE */
  8268. }
  8269. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  8270. }
  8271. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  8272. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8273. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8274. }
  8275. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  8276. }
  8277. if !((*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0) {
  8278. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8279. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8280. }
  8281. return int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF)
  8282. } else {
  8283. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  8284. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8285. _entityTrackingOnOpen(tls, parser, entity, int32(6046))
  8286. result = _appendAttributeValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, isCdata, (*TENTITY)(unsafe.Pointer(entity)).FtextPtr, textEnd, pool, int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8287. _entityTrackingOnClose(tls, parser, entity, int32(6053))
  8288. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8289. if result != 0 {
  8290. return result
  8291. }
  8292. }
  8293. default:
  8294. /* The only token returned by XmlAttributeValueTok() that does
  8295. * not have an explicit case here is XML_TOK_PARTIAL_CHAR.
  8296. * Getting that would require an entity name to contain an
  8297. * incomplete XML character (e.g. \xE2\x82); however previous
  8298. * tokenisers will have already recognised and rejected such
  8299. * names before XmlAttributeValueTok() gets a look-in. This
  8300. * default case should be retained as a safety net, but the code
  8301. * excluded from coverage tests.
  8302. *
  8303. * LCOV_EXCL_START
  8304. */
  8305. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8306. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8307. }
  8308. return int32(_XML_ERROR_UNEXPECTED_STATE)
  8309. /* LCOV_EXCL_STOP */
  8310. }
  8311. ptr = *(*uintptr)(unsafe.Pointer(bp))
  8312. goto _1
  8313. _1:
  8314. }
  8315. /* not reached */
  8316. return r
  8317. }
  8318. func _storeEntityValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, entityTextPtr uintptr, entityTextEnd uintptr, account _XML_Account) (r _XML_Error) {
  8319. bp := tls.Alloc(16)
  8320. defer tls.Free(16)
  8321. var dtd, entity, name, pool, v2, v3, v5, v6 uintptr
  8322. var i, n, oldInEntityValue, tok int32
  8323. var result _XML_Error
  8324. var _ /* buf at bp+8 */ [4]TXML_Char
  8325. var _ /* next at bp+0 */ uintptr
  8326. _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, entity, i, n, name, oldInEntityValue, pool, result, tok, v2, v3, v5, v6
  8327. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  8328. pool = dtd + 208
  8329. result = int32(_XML_ERROR_NONE)
  8330. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  8331. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = int32(1)
  8332. /* never return Null for the value argument in EntityDeclHandler,
  8333. since this would indicate an external entity; therefore we
  8334. have to make sure that entityValuePool.start is not null */
  8335. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0) {
  8336. if !(_poolGrow(tls, pool) != 0) {
  8337. return int32(_XML_ERROR_NO_MEMORY)
  8338. }
  8339. }
  8340. for {
  8341. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr /* XmlEntityValueTok doesn't always set the last arg */
  8342. 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)
  8343. if !(_accountingDiffTolerated(tls, parser, tok, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp)), int32(6109), account) != 0) {
  8344. _accountingOnAbort(tls, parser)
  8345. result = int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8346. goto endEntityValue
  8347. }
  8348. switch tok {
  8349. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  8350. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8351. name = _poolStoreString(tls, parser+784, enc, entityTextPtr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  8352. if !(name != 0) {
  8353. result = int32(_XML_ERROR_NO_MEMORY)
  8354. goto endEntityValue
  8355. }
  8356. entity = _lookup(tls, parser, dtd+264, name, uint64(0))
  8357. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  8358. if !(entity != 0) {
  8359. /* not a well-formedness error - see XML 1.0: WFC Entity Declared */
  8360. /* cannot report skipped entity here - see comments on
  8361. parser->m_skippedEntityHandler
  8362. if (parser->m_skippedEntityHandler)
  8363. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  8364. */
  8365. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8366. goto endEntityValue
  8367. }
  8368. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  8369. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8370. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8371. }
  8372. result = int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  8373. goto endEntityValue
  8374. }
  8375. if (*TENTITY)(unsafe.Pointer(entity)).FsystemId != 0 {
  8376. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  8377. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  8378. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8379. _entityTrackingOnOpen(tls, parser, entity, int32(6152))
  8380. 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) {
  8381. _entityTrackingOnClose(tls, parser, entity, int32(6156))
  8382. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8383. result = int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  8384. goto endEntityValue
  8385. }
  8386. _entityTrackingOnClose(tls, parser, entity, int32(6161))
  8387. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8388. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  8389. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8390. }
  8391. } else {
  8392. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8393. }
  8394. } else {
  8395. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8396. _entityTrackingOnOpen(tls, parser, entity, int32(6169))
  8397. 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), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8398. _entityTrackingOnClose(tls, parser, entity, int32(6174))
  8399. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8400. if result != 0 {
  8401. goto endEntityValue
  8402. }
  8403. }
  8404. break
  8405. }
  8406. /* In the internal subset, PE references are not legal
  8407. within markup declarations, e.g entity values in this case. */
  8408. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8409. result = int32(_XML_ERROR_PARAM_ENTITY_REF)
  8410. goto endEntityValue
  8411. case -int32(4):
  8412. result = int32(_XML_ERROR_NONE)
  8413. goto endEntityValue
  8414. case int32(m_XML_TOK_ENTITY_REF):
  8415. fallthrough
  8416. case int32(m_XML_TOK_DATA_CHARS):
  8417. if !(_poolAppend(tls, pool, enc, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8418. result = int32(_XML_ERROR_NO_MEMORY)
  8419. goto endEntityValue
  8420. }
  8421. case -int32(3):
  8422. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  8423. /* fall through */
  8424. fallthrough
  8425. case int32(m_XML_TOK_DATA_NEWLINE):
  8426. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  8427. result = int32(_XML_ERROR_NO_MEMORY)
  8428. goto endEntityValue
  8429. }
  8430. v3 = pool + 24
  8431. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8432. *(*uintptr)(unsafe.Pointer(v3))++
  8433. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(0xA)
  8434. case int32(m_XML_TOK_CHAR_REF):
  8435. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, entityTextPtr)
  8436. if n < 0 {
  8437. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8438. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8439. }
  8440. result = int32(_XML_ERROR_BAD_CHAR_REF)
  8441. goto endEntityValue
  8442. }
  8443. n = XXmlUtf8Encode(tls, n, bp+8)
  8444. /* The XmlEncode() functions can never return 0 here. That
  8445. * error return happens if the code point passed in is either
  8446. * negative or greater than or equal to 0x110000. The
  8447. * XmlCharRefNumber() functions will all return a number
  8448. * strictly less than 0x110000 or a negative value if an error
  8449. * occurred. The negative value is intercepted above, so
  8450. * XmlEncode() is never passed a value it might return an
  8451. * error for.
  8452. */
  8453. i = 0
  8454. for {
  8455. if !(i < n) {
  8456. break
  8457. }
  8458. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  8459. result = int32(_XML_ERROR_NO_MEMORY)
  8460. goto endEntityValue
  8461. }
  8462. v6 = pool + 24
  8463. v5 = *(*uintptr)(unsafe.Pointer(v6))
  8464. *(*uintptr)(unsafe.Pointer(v6))++
  8465. *(*TXML_Char)(unsafe.Pointer(v5)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 8)))[i]
  8466. goto _4
  8467. _4:
  8468. ;
  8469. i++
  8470. }
  8471. case -int32(1):
  8472. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8473. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8474. }
  8475. result = int32(_XML_ERROR_INVALID_TOKEN)
  8476. goto endEntityValue
  8477. case m_XML_TOK_INVALID:
  8478. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8479. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8480. }
  8481. result = int32(_XML_ERROR_INVALID_TOKEN)
  8482. goto endEntityValue
  8483. default:
  8484. /* This default case should be unnecessary -- all the tokens
  8485. * that XmlEntityValueTok() can return have their own explicit
  8486. * cases -- but should be retained for safety. We do however
  8487. * exclude it from the coverage statistics.
  8488. *
  8489. * LCOV_EXCL_START
  8490. */
  8491. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8492. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8493. }
  8494. result = int32(_XML_ERROR_UNEXPECTED_STATE)
  8495. goto endEntityValue
  8496. /* LCOV_EXCL_STOP */
  8497. }
  8498. entityTextPtr = *(*uintptr)(unsafe.Pointer(bp))
  8499. goto _1
  8500. _1:
  8501. }
  8502. goto endEntityValue
  8503. endEntityValue:
  8504. ;
  8505. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  8506. return result
  8507. }
  8508. func _normalizeLines(tls *libc.TLS, s uintptr) {
  8509. var p, v2, v3, v4, v5 uintptr
  8510. _, _, _, _, _ = p, v2, v3, v4, v5
  8511. for {
  8512. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  8513. return
  8514. }
  8515. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8516. break
  8517. }
  8518. goto _1
  8519. _1:
  8520. ;
  8521. s++
  8522. }
  8523. p = s
  8524. for cond := true; cond; cond = *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  8525. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8526. v2 = p
  8527. p++
  8528. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(0xA)
  8529. s++
  8530. v3 = s
  8531. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(v3))) == int32(0xA) {
  8532. s++
  8533. }
  8534. } else {
  8535. v4 = p
  8536. p++
  8537. v5 = s
  8538. s++
  8539. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(v5))
  8540. }
  8541. }
  8542. *(*TXML_Char)(unsafe.Pointer(p)) = uint8('\000')
  8543. }
  8544. func _reportProcessingInstruction(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8545. var data, target, tem uintptr
  8546. _, _, _ = data, target, tem
  8547. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler != 0) {
  8548. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8549. _reportDefault(tls, parser, enc, start, end)
  8550. }
  8551. return int32(1)
  8552. }
  8553. start += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar * int32(2))
  8554. tem = start + uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, start))
  8555. target = _poolStoreString(tls, parser+784, enc, start, tem)
  8556. if !(target != 0) {
  8557. return 0
  8558. }
  8559. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  8560. 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)))
  8561. if !(data != 0) {
  8562. return 0
  8563. }
  8564. _normalizeLines(tls, data)
  8565. (*(*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)
  8566. _poolClear(tls, parser+784)
  8567. return int32(1)
  8568. }
  8569. func _reportComment(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8570. var data uintptr
  8571. _ = data
  8572. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler != 0) {
  8573. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8574. _reportDefault(tls, parser, enc, start, end)
  8575. }
  8576. return int32(1)
  8577. }
  8578. data = _poolStoreString(tls, parser+784, enc, start+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(4)), end-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(3)))
  8579. if !(data != 0) {
  8580. return 0
  8581. }
  8582. _normalizeLines(tls, data)
  8583. (*(*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)
  8584. _poolClear(tls, parser+784)
  8585. return int32(1)
  8586. }
  8587. func _reportDefault(tls *libc.TLS, parser TXML_Parser, enc uintptr, _s uintptr, end uintptr) {
  8588. bp := tls.Alloc(16)
  8589. defer tls.Free(16)
  8590. *(*uintptr)(unsafe.Pointer(bp)) = _s
  8591. var convert_res _XML_Convert_Result
  8592. var eventEndPP, eventPP uintptr
  8593. var _ /* dataPtr at bp+8 */ uintptr
  8594. _, _, _ = convert_res, eventEndPP, eventPP
  8595. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  8596. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8597. eventPP = parser + 544
  8598. eventEndPP = parser + 552
  8599. } else {
  8600. /* To get here, two things must be true; the parser must be
  8601. * using a character encoding that is not the same as the
  8602. * encoding passed in, and the encoding passed in must need
  8603. * conversion to the internal format (UTF-8 unless XML_UNICODE
  8604. * is defined). The only occasions on which the encoding passed
  8605. * in is not the same as the parser's encoding are when it is
  8606. * the internal encoding (e.g. a previously defined parameter
  8607. * entity, already converted to internal format). This by
  8608. * definition doesn't need conversion, so the whole branch never
  8609. * gets executed.
  8610. *
  8611. * For safety's sake we don't delete these lines and merely
  8612. * exclude them from coverage statistics.
  8613. *
  8614. * LCOV_EXCL_START
  8615. */
  8616. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8617. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  8618. /* LCOV_EXCL_STOP */
  8619. }
  8620. for cond := true; cond; cond = convert_res != int32(_XML_CONVERT_COMPLETED) && convert_res != int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  8621. *(*uintptr)(unsafe.Pointer(bp + 8)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  8622. 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)
  8623. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8624. (*(*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)))
  8625. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8626. }
  8627. } else {
  8628. (*(*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)))))
  8629. }
  8630. }
  8631. func _defineAttribute(tls *libc.TLS, type1 uintptr, attId uintptr, isCdata TXML_Bool, isId TXML_Bool, value uintptr, parser TXML_Parser) (r int32) {
  8632. var att, temp uintptr
  8633. var count, i int32
  8634. _, _, _, _ = att, count, i, temp
  8635. if value != 0 || isId != 0 {
  8636. i = 0
  8637. for {
  8638. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts) {
  8639. break
  8640. }
  8641. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr(i)*24))).Fid {
  8642. return int32(1)
  8643. }
  8644. goto _1
  8645. _1:
  8646. ;
  8647. i++
  8648. }
  8649. if isId != 0 && !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt != 0) && !((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0) {
  8650. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt = attId
  8651. }
  8652. }
  8653. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts == (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts {
  8654. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts == 0 {
  8655. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = int32(8)
  8656. (*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))
  8657. if !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts != 0) {
  8658. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = 0
  8659. return 0
  8660. }
  8661. } else {
  8662. /* Detect and prevent integer overflow */
  8663. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts > libc.Int32FromInt32(m_INT_MAX)/libc.Int32FromInt32(2) {
  8664. return 0
  8665. }
  8666. count = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts * int32(2)
  8667. /* Detect and prevent integer overflow.
  8668. * The preprocessor guard addresses the "always false" warning
  8669. * from -Wtype-limits on platforms where
  8670. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  8671. 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))
  8672. if temp == libc.UintptrFromInt32(0) {
  8673. return 0
  8674. }
  8675. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = count
  8676. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts = temp
  8677. }
  8678. }
  8679. att = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts)*24
  8680. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fid = attId
  8681. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fvalue = value
  8682. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).FisCdata = isCdata
  8683. if !(isCdata != 0) {
  8684. (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized = libc.Uint8FromInt32(1)
  8685. }
  8686. *(*int32)(unsafe.Pointer(type1 + 24)) += int32(1)
  8687. return int32(1)
  8688. }
  8689. func _setElementTypePrefix(tls *libc.TLS, parser TXML_Parser, elementType uintptr) (r int32) {
  8690. var dtd, name, prefix, s, v4, v5, v7, v8 uintptr
  8691. var v3, v6 int32
  8692. _, _, _, _, _, _, _, _, _, _ = dtd, name, prefix, s, v3, v4, v5, v6, v7, v8
  8693. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8694. name = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8695. for {
  8696. if !(*(*TXML_Char)(unsafe.Pointer(name)) != 0) {
  8697. break
  8698. }
  8699. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_COLON) {
  8700. s = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8701. for {
  8702. if !(s != name) {
  8703. break
  8704. }
  8705. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8706. v3 = 0
  8707. } else {
  8708. v5 = dtd + 160 + 24
  8709. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8710. *(*uintptr)(unsafe.Pointer(v5))++
  8711. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  8712. v3 = libc.Int32FromInt32(1)
  8713. }
  8714. if !(v3 != 0) {
  8715. return 0
  8716. }
  8717. goto _2
  8718. _2:
  8719. ;
  8720. s++
  8721. }
  8722. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8723. v6 = 0
  8724. } else {
  8725. v8 = dtd + 160 + 24
  8726. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8727. *(*uintptr)(unsafe.Pointer(v8))++
  8728. *(*TXML_Char)(unsafe.Pointer(v7)) = uint8('\000')
  8729. v6 = libc.Int32FromInt32(1)
  8730. }
  8731. if !(v6 != 0) {
  8732. return 0
  8733. }
  8734. prefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart, uint64(16))
  8735. if !(prefix != 0) {
  8736. return 0
  8737. }
  8738. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart {
  8739. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8740. } else {
  8741. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8742. }
  8743. (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix = prefix
  8744. break
  8745. }
  8746. goto _1
  8747. _1:
  8748. ;
  8749. name++
  8750. }
  8751. return int32(1)
  8752. }
  8753. func _getAttributeId(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r uintptr) {
  8754. var dtd, id, name, v10, v11, v2, v3, v7, v8 uintptr
  8755. var i, j, v1, v6, v9 int32
  8756. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, i, id, j, name, v1, v10, v11, v2, v3, v6, v7, v8, v9
  8757. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8758. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8759. v1 = 0
  8760. } else {
  8761. v3 = dtd + 160 + 24
  8762. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8763. *(*uintptr)(unsafe.Pointer(v3))++
  8764. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8('\000')
  8765. v1 = libc.Int32FromInt32(1)
  8766. }
  8767. if !(v1 != 0) {
  8768. return libc.UintptrFromInt32(0)
  8769. }
  8770. name = _poolStoreString(tls, dtd+160, enc, start, end)
  8771. if !(name != 0) {
  8772. return libc.UintptrFromInt32(0)
  8773. }
  8774. /* skip quotation mark - its storage will be re-used (like in name[-1]) */
  8775. name++
  8776. id = _lookup(tls, parser, dtd+80, name, uint64(24))
  8777. if !(id != 0) {
  8778. return libc.UintptrFromInt32(0)
  8779. }
  8780. if (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fname != name {
  8781. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8782. } else {
  8783. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8784. if !!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  8785. 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)) {
  8786. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') {
  8787. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = dtd + 304
  8788. } else {
  8789. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+120, name+uintptr(6), uint64(16))
  8790. }
  8791. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fxmlns = libc.Uint8FromInt32(1)
  8792. } else {
  8793. i = 0
  8794. for {
  8795. if !(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i))) != 0) {
  8796. break
  8797. }
  8798. /* attributes without prefix are *not* in the default namespace */
  8799. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i)))) == int32(m_ASCII_COLON) {
  8800. j = 0
  8801. for {
  8802. if !(j < i) {
  8803. break
  8804. }
  8805. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8806. v6 = 0
  8807. } else {
  8808. v8 = dtd + 160 + 24
  8809. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8810. *(*uintptr)(unsafe.Pointer(v8))++
  8811. *(*TXML_Char)(unsafe.Pointer(v7)) = *(*TXML_Char)(unsafe.Pointer(name + uintptr(j)))
  8812. v6 = libc.Int32FromInt32(1)
  8813. }
  8814. if !(v6 != 0) {
  8815. return libc.UintptrFromInt32(0)
  8816. }
  8817. goto _5
  8818. _5:
  8819. ;
  8820. j++
  8821. }
  8822. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8823. v9 = 0
  8824. } else {
  8825. v11 = dtd + 160 + 24
  8826. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8827. *(*uintptr)(unsafe.Pointer(v11))++
  8828. *(*TXML_Char)(unsafe.Pointer(v10)) = uint8('\000')
  8829. v9 = libc.Int32FromInt32(1)
  8830. }
  8831. if !(v9 != 0) {
  8832. return libc.UintptrFromInt32(0)
  8833. }
  8834. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart, uint64(16))
  8835. if !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  8836. return libc.UintptrFromInt32(0)
  8837. }
  8838. if (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart {
  8839. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8840. } else {
  8841. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8842. }
  8843. break
  8844. }
  8845. goto _4
  8846. _4:
  8847. ;
  8848. i++
  8849. }
  8850. }
  8851. }
  8852. }
  8853. return id
  8854. }
  8855. func _getContext(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  8856. bp := tls.Alloc(16)
  8857. defer tls.Free(16)
  8858. 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
  8859. var i, i1, len1, len11, v1, v14, v17, v21, v25, v30, v33, v5, v9 int32
  8860. var needSep TXML_Bool
  8861. var v12, v28 bool
  8862. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  8863. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  8864. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8865. needSep = libc.Uint8FromInt32(0)
  8866. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  8867. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8868. v1 = 0
  8869. } else {
  8870. v3 = parser + 784 + 24
  8871. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8872. *(*uintptr)(unsafe.Pointer(v3))++
  8873. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(m_ASCII_EQUALS)
  8874. v1 = libc.Int32FromInt32(1)
  8875. }
  8876. if !(v1 != 0) {
  8877. return libc.UintptrFromInt32(0)
  8878. }
  8879. len1 = (*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).FuriLen
  8880. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  8881. len1--
  8882. }
  8883. i = 0
  8884. for {
  8885. if !(i < len1) {
  8886. break
  8887. }
  8888. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8889. v5 = 0
  8890. } else {
  8891. v7 = parser + 784 + 24
  8892. v6 = *(*uintptr)(unsafe.Pointer(v7))
  8893. *(*uintptr)(unsafe.Pointer(v7))++
  8894. *(*TXML_Char)(unsafe.Pointer(v6)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).Furi + uintptr(i)))
  8895. v5 = libc.Int32FromInt32(1)
  8896. }
  8897. if !(v5 != 0) {
  8898. /* Because of memory caching, I don't believe this line can be
  8899. * executed.
  8900. *
  8901. * This is part of a loop copying the default prefix binding
  8902. * URI into the parser's temporary string pool. Previously,
  8903. * that URI was copied into the same string pool, with a
  8904. * terminating NUL character, as part of setContext(). When
  8905. * the pool was cleared, that leaves a block definitely big
  8906. * enough to hold the URI on the free block list of the pool.
  8907. * The URI copy in getContext() therefore cannot run out of
  8908. * memory.
  8909. *
  8910. * If the pool is used between the setContext() and
  8911. * getContext() calls, the worst it can do is leave a bigger
  8912. * block on the front of the free list. Given that this is
  8913. * all somewhat inobvious and program logic can be changed, we
  8914. * don't delete the line but we do exclude it from the test
  8915. * coverage statistics.
  8916. */
  8917. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  8918. }
  8919. goto _4
  8920. _4:
  8921. ;
  8922. i++
  8923. }
  8924. needSep = libc.Uint8FromInt32(1)
  8925. }
  8926. _hashTableIterInit(tls, bp, dtd+120)
  8927. for {
  8928. prefix = _hashTableIterNext(tls, bp)
  8929. if !(prefix != 0) {
  8930. break
  8931. }
  8932. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0) {
  8933. /* This test appears to be (justifiable) paranoia. There does
  8934. * not seem to be a way of injecting a prefix without a binding
  8935. * that doesn't get errored long before this function is called.
  8936. * The test should remain for safety's sake, so we instead
  8937. * exclude the following line from the coverage statistics.
  8938. */
  8939. goto _8 /* LCOV_EXCL_LINE */
  8940. }
  8941. if v12 = needSep != 0; v12 {
  8942. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8943. v9 = 0
  8944. } else {
  8945. v11 = parser + 784 + 24
  8946. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8947. *(*uintptr)(unsafe.Pointer(v11))++
  8948. *(*TXML_Char)(unsafe.Pointer(v10)) = uint8(m_ASCII_FF)
  8949. v9 = libc.Int32FromInt32(1)
  8950. }
  8951. }
  8952. if v12 && !(v9 != 0) {
  8953. return libc.UintptrFromInt32(0)
  8954. }
  8955. s = (*TPREFIX)(unsafe.Pointer(prefix)).Fname
  8956. for {
  8957. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  8958. break
  8959. }
  8960. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8961. v14 = 0
  8962. } else {
  8963. v16 = parser + 784 + 24
  8964. v15 = *(*uintptr)(unsafe.Pointer(v16))
  8965. *(*uintptr)(unsafe.Pointer(v16))++
  8966. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  8967. v14 = libc.Int32FromInt32(1)
  8968. }
  8969. if !(v14 != 0) {
  8970. return libc.UintptrFromInt32(0)
  8971. }
  8972. goto _13
  8973. _13:
  8974. ;
  8975. s++
  8976. }
  8977. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8978. v17 = 0
  8979. } else {
  8980. v19 = parser + 784 + 24
  8981. v18 = *(*uintptr)(unsafe.Pointer(v19))
  8982. *(*uintptr)(unsafe.Pointer(v19))++
  8983. *(*TXML_Char)(unsafe.Pointer(v18)) = uint8(m_ASCII_EQUALS)
  8984. v17 = libc.Int32FromInt32(1)
  8985. }
  8986. if !(v17 != 0) {
  8987. return libc.UintptrFromInt32(0)
  8988. }
  8989. len11 = (*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).FuriLen
  8990. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  8991. len11--
  8992. }
  8993. i1 = 0
  8994. for {
  8995. if !(i1 < len11) {
  8996. break
  8997. }
  8998. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8999. v21 = 0
  9000. } else {
  9001. v23 = parser + 784 + 24
  9002. v22 = *(*uintptr)(unsafe.Pointer(v23))
  9003. *(*uintptr)(unsafe.Pointer(v23))++
  9004. *(*TXML_Char)(unsafe.Pointer(v22)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).Furi + uintptr(i1)))
  9005. v21 = libc.Int32FromInt32(1)
  9006. }
  9007. if !(v21 != 0) {
  9008. return libc.UintptrFromInt32(0)
  9009. }
  9010. goto _20
  9011. _20:
  9012. ;
  9013. i1++
  9014. }
  9015. needSep = libc.Uint8FromInt32(1)
  9016. goto _8
  9017. _8:
  9018. }
  9019. _hashTableIterInit(tls, bp, dtd)
  9020. for {
  9021. e = _hashTableIterNext(tls, bp)
  9022. if !(e != 0) {
  9023. break
  9024. }
  9025. if !((*TENTITY)(unsafe.Pointer(e)).Fopen != 0) {
  9026. goto _24
  9027. }
  9028. if v28 = needSep != 0; v28 {
  9029. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9030. v25 = 0
  9031. } else {
  9032. v27 = parser + 784 + 24
  9033. v26 = *(*uintptr)(unsafe.Pointer(v27))
  9034. *(*uintptr)(unsafe.Pointer(v27))++
  9035. *(*TXML_Char)(unsafe.Pointer(v26)) = uint8(m_ASCII_FF)
  9036. v25 = libc.Int32FromInt32(1)
  9037. }
  9038. }
  9039. if v28 && !(v25 != 0) {
  9040. return libc.UintptrFromInt32(0)
  9041. }
  9042. s1 = (*TENTITY)(unsafe.Pointer(e)).Fname
  9043. for {
  9044. if !(*(*TXML_Char)(unsafe.Pointer(s1)) != 0) {
  9045. break
  9046. }
  9047. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9048. v30 = 0
  9049. } else {
  9050. v32 = parser + 784 + 24
  9051. v31 = *(*uintptr)(unsafe.Pointer(v32))
  9052. *(*uintptr)(unsafe.Pointer(v32))++
  9053. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s1))
  9054. v30 = libc.Int32FromInt32(1)
  9055. }
  9056. if !(v30 != 0) {
  9057. return uintptr(0)
  9058. }
  9059. goto _29
  9060. _29:
  9061. ;
  9062. s1++
  9063. }
  9064. needSep = libc.Uint8FromInt32(1)
  9065. goto _24
  9066. _24:
  9067. }
  9068. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9069. v33 = 0
  9070. } else {
  9071. v35 = parser + 784 + 24
  9072. v34 = *(*uintptr)(unsafe.Pointer(v35))
  9073. *(*uintptr)(unsafe.Pointer(v35))++
  9074. *(*TXML_Char)(unsafe.Pointer(v34)) = uint8('\000')
  9075. v33 = libc.Int32FromInt32(1)
  9076. }
  9077. if !(v33 != 0) {
  9078. return libc.UintptrFromInt32(0)
  9079. }
  9080. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  9081. }
  9082. func _setContext(tls *libc.TLS, parser TXML_Parser, context uintptr) (r TXML_Bool) {
  9083. var dtd, e, prefix, s, v10, v12, v13, v15, v16, v2, v3, v5, v6, v9 uintptr
  9084. var v1, v11, v14, v4, v8 int32
  9085. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, e, prefix, s, v1, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v8, v9
  9086. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  9087. s = context
  9088. for libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  9089. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_FF) || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  9090. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9091. v1 = 0
  9092. } else {
  9093. v3 = parser + 784 + 24
  9094. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9095. *(*uintptr)(unsafe.Pointer(v3))++
  9096. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8('\000')
  9097. v1 = libc.Int32FromInt32(1)
  9098. }
  9099. if !(v1 != 0) {
  9100. return libc.Uint8FromInt32(0)
  9101. }
  9102. e = _lookup(tls, parser, dtd, (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, uint64(0))
  9103. if e != 0 {
  9104. (*TENTITY)(unsafe.Pointer(e)).Fopen = libc.Uint8FromInt32(1)
  9105. }
  9106. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) != int32('\000') {
  9107. s++
  9108. }
  9109. context = s
  9110. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  9111. } else {
  9112. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_EQUALS) {
  9113. if int64((*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart) == 0 {
  9114. prefix = dtd + 304
  9115. } else {
  9116. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9117. v4 = 0
  9118. } else {
  9119. v6 = parser + 784 + 24
  9120. v5 = *(*uintptr)(unsafe.Pointer(v6))
  9121. *(*uintptr)(unsafe.Pointer(v6))++
  9122. *(*TXML_Char)(unsafe.Pointer(v5)) = uint8('\000')
  9123. v4 = libc.Int32FromInt32(1)
  9124. }
  9125. if !(v4 != 0) {
  9126. return libc.Uint8FromInt32(0)
  9127. }
  9128. prefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, uint64(16))
  9129. if !(prefix != 0) {
  9130. return libc.Uint8FromInt32(0)
  9131. }
  9132. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart {
  9133. (*TPREFIX)(unsafe.Pointer(prefix)).Fname = _poolCopyString(tls, dtd+160, (*TPREFIX)(unsafe.Pointer(prefix)).Fname)
  9134. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0) {
  9135. return libc.Uint8FromInt32(0)
  9136. }
  9137. }
  9138. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  9139. }
  9140. context = s + uintptr(1)
  9141. for {
  9142. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32(m_ASCII_FF) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000')) {
  9143. break
  9144. }
  9145. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9146. v8 = 0
  9147. } else {
  9148. v10 = parser + 784 + 24
  9149. v9 = *(*uintptr)(unsafe.Pointer(v10))
  9150. *(*uintptr)(unsafe.Pointer(v10))++
  9151. *(*TXML_Char)(unsafe.Pointer(v9)) = *(*TXML_Char)(unsafe.Pointer(context))
  9152. v8 = libc.Int32FromInt32(1)
  9153. }
  9154. if !(v8 != 0) {
  9155. return libc.Uint8FromInt32(0)
  9156. }
  9157. goto _7
  9158. _7:
  9159. ;
  9160. context++
  9161. }
  9162. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9163. v11 = 0
  9164. } else {
  9165. v13 = parser + 784 + 24
  9166. v12 = *(*uintptr)(unsafe.Pointer(v13))
  9167. *(*uintptr)(unsafe.Pointer(v13))++
  9168. *(*TXML_Char)(unsafe.Pointer(v12)) = uint8('\000')
  9169. v11 = libc.Int32FromInt32(1)
  9170. }
  9171. if !(v11 != 0) {
  9172. return libc.Uint8FromInt32(0)
  9173. }
  9174. if _addBinding(tls, parser, prefix, libc.UintptrFromInt32(0), (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, parser+704) != int32(_XML_ERROR_NONE) {
  9175. return libc.Uint8FromInt32(0)
  9176. }
  9177. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  9178. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  9179. context++
  9180. }
  9181. s = context
  9182. } else {
  9183. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9184. v14 = 0
  9185. } else {
  9186. v16 = parser + 784 + 24
  9187. v15 = *(*uintptr)(unsafe.Pointer(v16))
  9188. *(*uintptr)(unsafe.Pointer(v16))++
  9189. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  9190. v14 = libc.Int32FromInt32(1)
  9191. }
  9192. if !(v14 != 0) {
  9193. return libc.Uint8FromInt32(0)
  9194. }
  9195. s++
  9196. }
  9197. }
  9198. }
  9199. return libc.Uint8FromInt32(1)
  9200. }
  9201. func _normalizePublicId(tls *libc.TLS, publicId uintptr) {
  9202. var p, s, v2, v3 uintptr
  9203. _, _, _, _ = p, s, v2, v3
  9204. p = publicId
  9205. s = publicId
  9206. for {
  9207. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9208. break
  9209. }
  9210. switch libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) {
  9211. case int32(0x20):
  9212. fallthrough
  9213. case int32(0xD):
  9214. fallthrough
  9215. case int32(0xA):
  9216. if p != publicId && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) != int32(0x20) {
  9217. v2 = p
  9218. p++
  9219. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(0x20)
  9220. }
  9221. default:
  9222. v3 = p
  9223. p++
  9224. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  9225. }
  9226. goto _1
  9227. _1:
  9228. ;
  9229. s++
  9230. }
  9231. if p != publicId && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  9232. p--
  9233. }
  9234. *(*TXML_Char)(unsafe.Pointer(p)) = uint8('\000')
  9235. }
  9236. func _dtdCreate(tls *libc.TLS, ms uintptr) (r uintptr) {
  9237. var p uintptr
  9238. _ = p
  9239. p = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Fmalloc_fcn})))(tls, uint64(360))
  9240. if p == libc.UintptrFromInt32(0) {
  9241. return p
  9242. }
  9243. _poolInit(tls, p+160, ms)
  9244. _poolInit(tls, p+208, ms)
  9245. _hashTableInit(tls, p, ms)
  9246. _hashTableInit(tls, p+40, ms)
  9247. _hashTableInit(tls, p+80, ms)
  9248. _hashTableInit(tls, p+120, ms)
  9249. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  9250. _hashTableInit(tls, p+264, ms)
  9251. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  9252. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  9253. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  9254. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  9255. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  9256. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  9257. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  9258. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  9259. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  9260. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  9261. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  9262. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  9263. return p
  9264. }
  9265. func _dtdReset(tls *libc.TLS, p uintptr, ms uintptr) {
  9266. bp := tls.Alloc(16)
  9267. defer tls.Free(16)
  9268. var e uintptr
  9269. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9270. _ = e
  9271. _hashTableIterInit(tls, bp, p+40)
  9272. for {
  9273. e = _hashTableIterNext(tls, bp)
  9274. if !(e != 0) {
  9275. break
  9276. }
  9277. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  9278. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  9279. }
  9280. goto _1
  9281. _1:
  9282. }
  9283. _hashTableClear(tls, p)
  9284. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  9285. _hashTableClear(tls, p+264)
  9286. _hashTableClear(tls, p+40)
  9287. _hashTableClear(tls, p+80)
  9288. _hashTableClear(tls, p+120)
  9289. _poolClear(tls, p+160)
  9290. _poolClear(tls, p+208)
  9291. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  9292. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  9293. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  9294. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  9295. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  9296. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  9297. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  9298. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  9299. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  9300. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  9301. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  9302. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  9303. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  9304. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  9305. }
  9306. func _dtdDestroy(tls *libc.TLS, p uintptr, isDocEntity TXML_Bool, ms uintptr) {
  9307. bp := tls.Alloc(16)
  9308. defer tls.Free(16)
  9309. var e uintptr
  9310. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9311. _ = e
  9312. _hashTableIterInit(tls, bp, p+40)
  9313. for {
  9314. e = _hashTableIterNext(tls, bp)
  9315. if !(e != 0) {
  9316. break
  9317. }
  9318. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  9319. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  9320. }
  9321. goto _1
  9322. _1:
  9323. }
  9324. _hashTableDestroy(tls, p)
  9325. _hashTableDestroy(tls, p+264)
  9326. _hashTableDestroy(tls, p+40)
  9327. _hashTableDestroy(tls, p+80)
  9328. _hashTableDestroy(tls, p+120)
  9329. _poolDestroy(tls, p+160)
  9330. _poolDestroy(tls, p+208)
  9331. if isDocEntity != 0 {
  9332. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  9333. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  9334. }
  9335. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, p)
  9336. }
  9337. // C documentation
  9338. //
  9339. // /* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise.
  9340. // The new DTD has already been initialized.
  9341. // */
  9342. func _dtdCopy(tls *libc.TLS, oldParser TXML_Parser, newDtd uintptr, oldDtd uintptr, ms uintptr) (r int32) {
  9343. bp := tls.Alloc(16)
  9344. defer tls.Free(16)
  9345. var i, v3, v7 int32
  9346. var name, name1, name2, newA, newE, oldA, oldE, oldP, v4, v5 uintptr
  9347. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9348. _, _, _, _, _, _, _, _, _, _, _, _, _ = i, name, name1, name2, newA, newE, oldA, oldE, oldP, v3, v4, v5, v7
  9349. /* Copy the prefix table. */
  9350. _hashTableIterInit(tls, bp, oldDtd+120)
  9351. for {
  9352. oldP = _hashTableIterNext(tls, bp)
  9353. if !(oldP != 0) {
  9354. break
  9355. }
  9356. name = _poolCopyString(tls, newDtd+160, (*TPREFIX)(unsafe.Pointer(oldP)).Fname)
  9357. if !(name != 0) {
  9358. return 0
  9359. }
  9360. if !(_lookup(tls, oldParser, newDtd+120, name, uint64(16)) != 0) {
  9361. return 0
  9362. }
  9363. goto _1
  9364. _1:
  9365. }
  9366. _hashTableIterInit(tls, bp, oldDtd+80)
  9367. /* Copy the attribute id table. */
  9368. for {
  9369. oldA = _hashTableIterNext(tls, bp)
  9370. if !(oldA != 0) {
  9371. break
  9372. }
  9373. /* Remember to allocate the scratch byte before the name. */
  9374. if (*TSTRING_POOL)(unsafe.Pointer(newDtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(newDtd+160)).Fend && !(_poolGrow(tls, newDtd+160) != 0) {
  9375. v3 = 0
  9376. } else {
  9377. v5 = newDtd + 160 + 24
  9378. v4 = *(*uintptr)(unsafe.Pointer(v5))
  9379. *(*uintptr)(unsafe.Pointer(v5))++
  9380. *(*TXML_Char)(unsafe.Pointer(v4)) = uint8('\000')
  9381. v3 = libc.Int32FromInt32(1)
  9382. }
  9383. if !(v3 != 0) {
  9384. return 0
  9385. }
  9386. name1 = _poolCopyString(tls, newDtd+160, (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fname)
  9387. if !(name1 != 0) {
  9388. return 0
  9389. }
  9390. name1++
  9391. newA = _lookup(tls, oldParser, newDtd+80, name1, uint64(24))
  9392. if !(newA != 0) {
  9393. return 0
  9394. }
  9395. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).FmaybeTokenized = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).FmaybeTokenized
  9396. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix != 0 {
  9397. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fxmlns = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fxmlns
  9398. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix == oldDtd+304 {
  9399. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = newDtd + 304
  9400. } else {
  9401. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = _lookup(tls, oldParser, newDtd+120, (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix)).Fname, uint64(0))
  9402. }
  9403. }
  9404. goto _2
  9405. _2:
  9406. }
  9407. /* Copy the element type table. */
  9408. _hashTableIterInit(tls, bp, oldDtd+40)
  9409. for {
  9410. oldE = _hashTableIterNext(tls, bp)
  9411. if !(oldE != 0) {
  9412. break
  9413. }
  9414. name2 = _poolCopyString(tls, newDtd+160, (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fname)
  9415. if !(name2 != 0) {
  9416. return 0
  9417. }
  9418. newE = _lookup(tls, oldParser, newDtd+40, name2, uint64(40))
  9419. if !(newE != 0) {
  9420. return 0
  9421. }
  9422. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts != 0 {
  9423. (*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))
  9424. if !((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts != 0) {
  9425. return 0
  9426. }
  9427. }
  9428. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt != 0 {
  9429. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FidAtt = _lookup(tls, oldParser, newDtd+80, (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt)).Fname, uint64(0))
  9430. }
  9431. v7 = (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts
  9432. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts = v7
  9433. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FallocDefaultAtts = v7
  9434. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix != 0 {
  9435. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).Fprefix = _lookup(tls, oldParser, newDtd+120, (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix)).Fname, uint64(0))
  9436. }
  9437. i = 0
  9438. for {
  9439. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts) {
  9440. break
  9441. }
  9442. (*(*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))
  9443. (*(*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
  9444. if (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).Fvalue != 0 {
  9445. (*(*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)
  9446. if !((*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue != 0) {
  9447. return 0
  9448. }
  9449. } else {
  9450. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue = libc.UintptrFromInt32(0)
  9451. }
  9452. goto _8
  9453. _8:
  9454. ;
  9455. i++
  9456. }
  9457. goto _6
  9458. _6:
  9459. }
  9460. /* Copy the entity tables. */
  9461. if !(_copyEntityTable(tls, oldParser, newDtd, newDtd+160, oldDtd) != 0) {
  9462. return 0
  9463. }
  9464. if !(_copyEntityTable(tls, oldParser, newDtd+264, newDtd+160, oldDtd+264) != 0) {
  9465. return 0
  9466. }
  9467. (*TDTD)(unsafe.Pointer(newDtd)).FparamEntityRead = (*TDTD)(unsafe.Pointer(oldDtd)).FparamEntityRead
  9468. (*TDTD)(unsafe.Pointer(newDtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(oldDtd)).FkeepProcessing
  9469. (*TDTD)(unsafe.Pointer(newDtd)).FhasParamEntityRefs = (*TDTD)(unsafe.Pointer(oldDtd)).FhasParamEntityRefs
  9470. (*TDTD)(unsafe.Pointer(newDtd)).Fstandalone = (*TDTD)(unsafe.Pointer(oldDtd)).Fstandalone
  9471. /* Don't want deep copying for scaffolding */
  9472. (*TDTD)(unsafe.Pointer(newDtd)).Fin_eldecl = (*TDTD)(unsafe.Pointer(oldDtd)).Fin_eldecl
  9473. (*TDTD)(unsafe.Pointer(newDtd)).Fscaffold = (*TDTD)(unsafe.Pointer(oldDtd)).Fscaffold
  9474. (*TDTD)(unsafe.Pointer(newDtd)).FcontentStringLen = (*TDTD)(unsafe.Pointer(oldDtd)).FcontentStringLen
  9475. (*TDTD)(unsafe.Pointer(newDtd)).FscaffSize = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffSize
  9476. (*TDTD)(unsafe.Pointer(newDtd)).FscaffLevel = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffLevel
  9477. (*TDTD)(unsafe.Pointer(newDtd)).FscaffIndex = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffIndex
  9478. return int32(1)
  9479. }
  9480. /* End dtdCopy */
  9481. func _copyEntityTable(tls *libc.TLS, oldParser TXML_Parser, newTable uintptr, newPool uintptr, oldTable uintptr) (r int32) {
  9482. bp := tls.Alloc(16)
  9483. defer tls.Free(16)
  9484. var cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2 uintptr
  9485. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9486. _, _, _, _, _, _, _, _, _ = cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2
  9487. cachedOldBase = libc.UintptrFromInt32(0)
  9488. cachedNewBase = libc.UintptrFromInt32(0)
  9489. _hashTableIterInit(tls, bp, oldTable)
  9490. for {
  9491. oldE = _hashTableIterNext(tls, bp)
  9492. if !(oldE != 0) {
  9493. break
  9494. }
  9495. name = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fname)
  9496. if !(name != 0) {
  9497. return 0
  9498. }
  9499. newE = _lookup(tls, oldParser, newTable, name, uint64(64))
  9500. if !(newE != 0) {
  9501. return 0
  9502. }
  9503. if (*TENTITY)(unsafe.Pointer(oldE)).FsystemId != 0 {
  9504. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FsystemId)
  9505. if !(tem != 0) {
  9506. return 0
  9507. }
  9508. (*TENTITY)(unsafe.Pointer(newE)).FsystemId = tem
  9509. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase != 0 {
  9510. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase == cachedOldBase {
  9511. (*TENTITY)(unsafe.Pointer(newE)).Fbase = cachedNewBase
  9512. } else {
  9513. cachedOldBase = (*TENTITY)(unsafe.Pointer(oldE)).Fbase
  9514. tem = _poolCopyString(tls, newPool, cachedOldBase)
  9515. if !(tem != 0) {
  9516. return 0
  9517. }
  9518. v2 = tem
  9519. (*TENTITY)(unsafe.Pointer(newE)).Fbase = v2
  9520. cachedNewBase = v2
  9521. }
  9522. }
  9523. if (*TENTITY)(unsafe.Pointer(oldE)).FpublicId != 0 {
  9524. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FpublicId)
  9525. if !(tem != 0) {
  9526. return 0
  9527. }
  9528. (*TENTITY)(unsafe.Pointer(newE)).FpublicId = tem
  9529. }
  9530. } else {
  9531. tem1 = _poolCopyStringN(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FtextPtr, (*TENTITY)(unsafe.Pointer(oldE)).FtextLen)
  9532. if !(tem1 != 0) {
  9533. return 0
  9534. }
  9535. (*TENTITY)(unsafe.Pointer(newE)).FtextPtr = tem1
  9536. (*TENTITY)(unsafe.Pointer(newE)).FtextLen = (*TENTITY)(unsafe.Pointer(oldE)).FtextLen
  9537. }
  9538. if (*TENTITY)(unsafe.Pointer(oldE)).Fnotation != 0 {
  9539. tem2 = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fnotation)
  9540. if !(tem2 != 0) {
  9541. return 0
  9542. }
  9543. (*TENTITY)(unsafe.Pointer(newE)).Fnotation = tem2
  9544. }
  9545. (*TENTITY)(unsafe.Pointer(newE)).Fis_param = (*TENTITY)(unsafe.Pointer(oldE)).Fis_param
  9546. (*TENTITY)(unsafe.Pointer(newE)).Fis_internal = (*TENTITY)(unsafe.Pointer(oldE)).Fis_internal
  9547. goto _1
  9548. _1:
  9549. }
  9550. return int32(1)
  9551. }
  9552. func _keyeq(tls *libc.TLS, s1 TKEY, s2 TKEY) (r TXML_Bool) {
  9553. for {
  9554. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s2)))) {
  9555. break
  9556. }
  9557. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  9558. return libc.Uint8FromInt32(1)
  9559. }
  9560. goto _1
  9561. _1:
  9562. ;
  9563. s1++
  9564. s2++
  9565. }
  9566. return libc.Uint8FromInt32(0)
  9567. }
  9568. func _keylen(tls *libc.TLS, s TKEY) (r Tsize_t) {
  9569. var len1 Tsize_t
  9570. _ = len1
  9571. len1 = uint64(0)
  9572. for {
  9573. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9574. break
  9575. }
  9576. goto _1
  9577. _1:
  9578. ;
  9579. s++
  9580. len1++
  9581. }
  9582. return len1
  9583. }
  9584. func _copy_salt_to_sipkey(tls *libc.TLS, parser TXML_Parser, key uintptr) {
  9585. *(*Tuint64_t)(unsafe.Pointer(key)) = uint64(0)
  9586. *(*Tuint64_t)(unsafe.Pointer(key + 1*8)) = _get_hash_secret_salt(tls, parser)
  9587. }
  9588. func _hash(tls *libc.TLS, parser TXML_Parser, s TKEY) (r uint64) {
  9589. bp := tls.Alloc(80)
  9590. defer tls.Free(80)
  9591. var _ /* key at bp+56 */ Tsipkey
  9592. var _ /* state at bp+0 */ Tsiphash
  9593. _ = __ccgo_fp(_sip24_valid)
  9594. _copy_salt_to_sipkey(tls, parser, bp+56)
  9595. _sip24_init(tls, bp, bp+56)
  9596. _sip24_update(tls, bp, s, _keylen(tls, s)*uint64(1))
  9597. return _sip24_final(tls, bp)
  9598. }
  9599. func _lookup(tls *libc.TLS, parser TXML_Parser, table uintptr, name TKEY, createSize Tsize_t) (r uintptr) {
  9600. var h, mask, newHash, newMask uint64
  9601. var i, j, newSize, tsize, tsize1 Tsize_t
  9602. var newPower, step uint8
  9603. var newV uintptr
  9604. _, _, _, _, _, _, _, _, _, _, _, _ = h, i, j, mask, newHash, newMask, newPower, newSize, newV, step, tsize, tsize1
  9605. if (*THASH_TABLE)(unsafe.Pointer(table)).Fsize == uint64(0) {
  9606. if !(createSize != 0) {
  9607. return libc.UintptrFromInt32(0)
  9608. }
  9609. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = uint8(m_INIT_POWER)
  9610. /* table->size is a power of 2 */
  9611. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = libc.Uint64FromInt32(1) << libc.Int32FromInt32(m_INIT_POWER)
  9612. tsize = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize * uint64(8)
  9613. (*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)
  9614. if !((*THASH_TABLE)(unsafe.Pointer(table)).Fv != 0) {
  9615. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = uint64(0)
  9616. return libc.UintptrFromInt32(0)
  9617. }
  9618. libc.Xmemset(tls, (*THASH_TABLE)(unsafe.Pointer(table)).Fv, 0, tsize)
  9619. i = _hash(tls, parser, name) & ((*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(1))
  9620. } else {
  9621. h = _hash(tls, parser, name)
  9622. mask = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(1)
  9623. step = uint8(0)
  9624. i = h & mask
  9625. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9626. if _keyeq(tls, name, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname) != 0 {
  9627. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9628. }
  9629. if !(step != 0) {
  9630. step = uint8(h & ^mask >> (libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9631. }
  9632. if i < uint64(step) {
  9633. i += (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(step)
  9634. } else {
  9635. i -= uint64(step)
  9636. }
  9637. }
  9638. if !(createSize != 0) {
  9639. return libc.UintptrFromInt32(0)
  9640. }
  9641. /* check for overflow (table is half full) */
  9642. if (*THASH_TABLE)(unsafe.Pointer(table)).Fused>>(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-int32(1)) != 0 {
  9643. newPower = libc.Uint8FromInt32(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower) + int32(1))
  9644. /* Detect and prevent invalid shift */
  9645. if uint64(newPower) >= libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8) {
  9646. return libc.UintptrFromInt32(0)
  9647. }
  9648. newSize = libc.Uint64FromInt32(1) << newPower
  9649. newMask = newSize - uint64(1)
  9650. /* Detect and prevent integer overflow */
  9651. if newSize > libc.Uint64FromInt32(-libc.Int32FromInt32(1))/libc.Uint64FromInt64(8) {
  9652. return libc.UintptrFromInt32(0)
  9653. }
  9654. tsize1 = newSize * uint64(8)
  9655. 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)
  9656. if !(newV != 0) {
  9657. return libc.UintptrFromInt32(0)
  9658. }
  9659. libc.Xmemset(tls, newV, 0, tsize1)
  9660. i = uint64(0)
  9661. for {
  9662. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9663. break
  9664. }
  9665. if *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9666. newHash = _hash(tls, parser, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname)
  9667. j = newHash & newMask
  9668. step = uint8(0)
  9669. for *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*8)) != 0 {
  9670. if !(step != 0) {
  9671. step = uint8(newHash & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9672. }
  9673. if j < uint64(step) {
  9674. j += newSize - uint64(step)
  9675. } else {
  9676. j -= uint64(step)
  9677. }
  9678. }
  9679. *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*8)) = *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9680. }
  9681. goto _2
  9682. _2:
  9683. ;
  9684. i++
  9685. }
  9686. (*(*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)
  9687. (*THASH_TABLE)(unsafe.Pointer(table)).Fv = newV
  9688. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = newPower
  9689. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = newSize
  9690. i = h & newMask
  9691. step = uint8(0)
  9692. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9693. if !(step != 0) {
  9694. step = uint8(h & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9695. }
  9696. if i < uint64(step) {
  9697. i += newSize - uint64(step)
  9698. } else {
  9699. i -= uint64(step)
  9700. }
  9701. }
  9702. }
  9703. }
  9704. *(*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)
  9705. if !(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0) {
  9706. return libc.UintptrFromInt32(0)
  9707. }
  9708. libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)), 0, createSize)
  9709. (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname = name
  9710. (*THASH_TABLE)(unsafe.Pointer(table)).Fused++
  9711. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9712. }
  9713. func _hashTableClear(tls *libc.TLS, table uintptr) {
  9714. var i Tsize_t
  9715. _ = i
  9716. i = uint64(0)
  9717. for {
  9718. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9719. break
  9720. }
  9721. (*(*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)))
  9722. *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) = libc.UintptrFromInt32(0)
  9723. goto _1
  9724. _1:
  9725. ;
  9726. i++
  9727. }
  9728. (*THASH_TABLE)(unsafe.Pointer(table)).Fused = uint64(0)
  9729. }
  9730. func _hashTableDestroy(tls *libc.TLS, table uintptr) {
  9731. var i Tsize_t
  9732. _ = i
  9733. i = uint64(0)
  9734. for {
  9735. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9736. break
  9737. }
  9738. (*(*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)))
  9739. goto _1
  9740. _1:
  9741. ;
  9742. i++
  9743. }
  9744. (*(*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)
  9745. }
  9746. func _hashTableInit(tls *libc.TLS, p uintptr, ms uintptr) {
  9747. (*THASH_TABLE)(unsafe.Pointer(p)).Fpower = uint8(0)
  9748. (*THASH_TABLE)(unsafe.Pointer(p)).Fsize = uint64(0)
  9749. (*THASH_TABLE)(unsafe.Pointer(p)).Fused = uint64(0)
  9750. (*THASH_TABLE)(unsafe.Pointer(p)).Fv = libc.UintptrFromInt32(0)
  9751. (*THASH_TABLE)(unsafe.Pointer(p)).Fmem = ms
  9752. }
  9753. func _hashTableIterInit(tls *libc.TLS, iter uintptr, table uintptr) {
  9754. var v1 uintptr
  9755. _ = v1
  9756. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp = (*THASH_TABLE)(unsafe.Pointer(table)).Fv
  9757. if (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != 0 {
  9758. v1 = (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp + uintptr((*THASH_TABLE)(unsafe.Pointer(table)).Fsize)*8
  9759. } else {
  9760. v1 = libc.UintptrFromInt32(0)
  9761. }
  9762. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend = v1
  9763. }
  9764. func _hashTableIterNext(tls *libc.TLS, iter uintptr) (r uintptr) {
  9765. var tem, v1, v2 uintptr
  9766. _, _, _ = tem, v1, v2
  9767. for (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend {
  9768. v2 = iter
  9769. v1 = *(*uintptr)(unsafe.Pointer(v2))
  9770. *(*uintptr)(unsafe.Pointer(v2)) += 8
  9771. tem = *(*uintptr)(unsafe.Pointer(v1))
  9772. if tem != 0 {
  9773. return tem
  9774. }
  9775. }
  9776. return libc.UintptrFromInt32(0)
  9777. }
  9778. func _poolInit(tls *libc.TLS, pool uintptr, ms uintptr) {
  9779. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  9780. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = libc.UintptrFromInt32(0)
  9781. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  9782. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  9783. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  9784. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem = ms
  9785. }
  9786. func _poolClear(tls *libc.TLS, pool uintptr) {
  9787. var p, tem uintptr
  9788. _, _ = p, tem
  9789. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0) {
  9790. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9791. } else {
  9792. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9793. for p != 0 {
  9794. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9795. (*TBLOCK)(unsafe.Pointer(p)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9796. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = p
  9797. p = tem
  9798. }
  9799. }
  9800. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  9801. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  9802. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  9803. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  9804. }
  9805. func _poolDestroy(tls *libc.TLS, pool uintptr) {
  9806. var p, tem, tem1 uintptr
  9807. _, _, _ = p, tem, tem1
  9808. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9809. for p != 0 {
  9810. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9811. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  9812. p = tem
  9813. }
  9814. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9815. for p != 0 {
  9816. tem1 = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9817. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  9818. p = tem1
  9819. }
  9820. }
  9821. func _poolAppend(tls *libc.TLS, pool uintptr, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  9822. bp := tls.Alloc(16)
  9823. defer tls.Free(16)
  9824. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  9825. var convert_res _XML_Convert_Result
  9826. _ = convert_res
  9827. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  9828. return libc.UintptrFromInt32(0)
  9829. }
  9830. for {
  9831. 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)
  9832. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  9833. break
  9834. }
  9835. if !(_poolGrow(tls, pool) != 0) {
  9836. return libc.UintptrFromInt32(0)
  9837. }
  9838. goto _1
  9839. _1:
  9840. }
  9841. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9842. }
  9843. func _poolCopyString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  9844. var v1, v4, v5 uintptr
  9845. var v3 int32
  9846. _, _, _, _ = v1, v3, v4, v5
  9847. for {
  9848. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9849. v3 = 0
  9850. } else {
  9851. v5 = pool + 24
  9852. v4 = *(*uintptr)(unsafe.Pointer(v5))
  9853. *(*uintptr)(unsafe.Pointer(v5))++
  9854. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  9855. v3 = libc.Int32FromInt32(1)
  9856. }
  9857. if !(v3 != 0) {
  9858. return libc.UintptrFromInt32(0)
  9859. }
  9860. goto _2
  9861. _2:
  9862. ;
  9863. v1 = s
  9864. s++
  9865. if !(*(*TXML_Char)(unsafe.Pointer(v1)) != 0) {
  9866. break
  9867. }
  9868. }
  9869. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9870. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  9871. return s
  9872. }
  9873. func _poolCopyStringN(tls *libc.TLS, pool uintptr, s uintptr, n int32) (r uintptr) {
  9874. var v2 int32
  9875. var v3, v4 uintptr
  9876. _, _, _ = v2, v3, v4
  9877. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  9878. /* The following line is unreachable given the current usage of
  9879. * poolCopyStringN(). Currently it is called from exactly one
  9880. * place to copy the text of a simple general entity. By that
  9881. * point, the name of the entity is already stored in the pool, so
  9882. * pool->ptr cannot be NULL.
  9883. *
  9884. * If poolCopyStringN() is used elsewhere as it well might be,
  9885. * this line may well become executable again. Regardless, this
  9886. * sort of check shouldn't be removed lightly, so we just exclude
  9887. * it from the coverage statistics.
  9888. */
  9889. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  9890. }
  9891. for {
  9892. if !(n > 0) {
  9893. break
  9894. }
  9895. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9896. v2 = 0
  9897. } else {
  9898. v4 = pool + 24
  9899. v3 = *(*uintptr)(unsafe.Pointer(v4))
  9900. *(*uintptr)(unsafe.Pointer(v4))++
  9901. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  9902. v2 = libc.Int32FromInt32(1)
  9903. }
  9904. if !(v2 != 0) {
  9905. return libc.UintptrFromInt32(0)
  9906. }
  9907. goto _1
  9908. _1:
  9909. ;
  9910. n--
  9911. s++
  9912. }
  9913. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9914. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  9915. return s
  9916. }
  9917. func _poolAppendString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  9918. var v1 int32
  9919. var v2, v3 uintptr
  9920. _, _, _ = v1, v2, v3
  9921. for *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  9922. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9923. v1 = 0
  9924. } else {
  9925. v3 = pool + 24
  9926. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9927. *(*uintptr)(unsafe.Pointer(v3))++
  9928. *(*TXML_Char)(unsafe.Pointer(v2)) = *(*TXML_Char)(unsafe.Pointer(s))
  9929. v1 = libc.Int32FromInt32(1)
  9930. }
  9931. if !(v1 != 0) {
  9932. return libc.UintptrFromInt32(0)
  9933. }
  9934. s++
  9935. }
  9936. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9937. }
  9938. func _poolStoreString(tls *libc.TLS, pool uintptr, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  9939. var v1, v2 uintptr
  9940. _, _ = v1, v2
  9941. if !(_poolAppend(tls, pool, enc, ptr, end) != 0) {
  9942. return libc.UintptrFromInt32(0)
  9943. }
  9944. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9945. return libc.UintptrFromInt32(0)
  9946. }
  9947. v2 = pool + 24
  9948. v1 = *(*uintptr)(unsafe.Pointer(v2))
  9949. *(*uintptr)(unsafe.Pointer(v2))++
  9950. *(*TXML_Char)(unsafe.Pointer(v1)) = uint8(0)
  9951. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9952. }
  9953. func _poolBytesToAllocateFor(tls *libc.TLS, blockSize int32) (r Tsize_t) {
  9954. var bytesToAllocate, stretchedBlockSize int32
  9955. var stretch Tsize_t
  9956. _, _, _ = bytesToAllocate, stretch, stretchedBlockSize
  9957. /* Unprotected math would be:
  9958. ** return offsetof(BLOCK, s) + blockSize * sizeof(XML_Char);
  9959. **
  9960. ** Detect overflow, avoiding _signed_ overflow undefined behavior
  9961. ** For a + b * c we check b * c in isolation first, so that addition of a
  9962. ** on top has no chance of making us accept a small non-negative number
  9963. */
  9964. stretch = uint64(1) /* can be 4 bytes */
  9965. if blockSize <= 0 {
  9966. return uint64(0)
  9967. }
  9968. if blockSize > libc.Int32FromUint64(libc.Uint64FromInt32(m_INT_MAX)/stretch) {
  9969. return uint64(0)
  9970. }
  9971. stretchedBlockSize = blockSize * libc.Int32FromUint64(stretch)
  9972. bytesToAllocate = libc.Int32FromUint64(uint64(libc.UintptrFromInt32(0)+12) + uint64(libc.Uint32FromInt32(stretchedBlockSize)))
  9973. if bytesToAllocate < 0 {
  9974. return uint64(0)
  9975. }
  9976. return libc.Uint64FromInt32(bytesToAllocate)
  9977. return r
  9978. }
  9979. func _poolGrow(tls *libc.TLS, pool uintptr) (r TXML_Bool) {
  9980. var blockSize, blockSize1 int32
  9981. var bytesToAllocate, bytesToAllocate1 Tsize_t
  9982. var offsetInsideBlock Tptrdiff_t
  9983. var tem, tem1, temp uintptr
  9984. _, _, _, _, _, _, _, _ = blockSize, blockSize1, bytesToAllocate, bytesToAllocate1, offsetInsideBlock, tem, tem1, temp
  9985. if (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0 {
  9986. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == uintptr(0) {
  9987. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9988. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  9989. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fnext = libc.UintptrFromInt32(0)
  9990. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  9991. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  9992. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9993. return libc.Uint8FromInt32(1)
  9994. }
  9995. 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) {
  9996. tem = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  9997. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9998. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9999. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = tem
  10000. 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))
  10001. (*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))
  10002. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  10003. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  10004. return libc.Uint8FromInt32(1)
  10005. }
  10006. }
  10007. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0 && (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks+12 {
  10008. blockSize = libc.Int32FromUint32(libc.Uint32FromInt64(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)) * libc.Uint32FromUint32(2))
  10009. /* NOTE: Needs to be calculated prior to calling `realloc`
  10010. to avoid dangling pointers: */
  10011. offsetInsideBlock = int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr) - int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)
  10012. if blockSize < 0 {
  10013. /* This condition traps a situation where either more than
  10014. * INT_MAX/2 bytes have already been allocated. This isn't
  10015. * readily testable, since it is unlikely that an average
  10016. * machine will have that much memory, so we exclude it from the
  10017. * coverage statistics.
  10018. */
  10019. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  10020. }
  10021. bytesToAllocate = _poolBytesToAllocateFor(tls, blockSize)
  10022. if bytesToAllocate == uint64(0) {
  10023. return libc.Uint8FromInt32(0)
  10024. }
  10025. 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)))
  10026. if temp == libc.UintptrFromInt32(0) {
  10027. return libc.Uint8FromInt32(0)
  10028. }
  10029. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = temp
  10030. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize = blockSize
  10031. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12 + uintptr(offsetInsideBlock)
  10032. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  10033. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr(blockSize)
  10034. } else {
  10035. blockSize1 = int32(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend) - int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  10036. if blockSize1 < 0 {
  10037. /* This condition traps a situation where either more than
  10038. * INT_MAX bytes have already been allocated (which is prevented
  10039. * by various pieces of program logic, not least this one, never
  10040. * mind the unlikelihood of actually having that much memory) or
  10041. * the pool control fields have been corrupted (which could
  10042. * conceivably happen in an extremely buggy user handler
  10043. * function). Either way it isn't readily testable, so we
  10044. * exclude it from the coverage statistics.
  10045. */
  10046. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  10047. }
  10048. if blockSize1 < int32(m_INIT_BLOCK_SIZE) {
  10049. blockSize1 = int32(m_INIT_BLOCK_SIZE)
  10050. } else {
  10051. /* Detect overflow, avoiding _signed_ overflow undefined behavior */
  10052. if libc.Int32FromUint32(libc.Uint32FromInt32(blockSize1)*libc.Uint32FromUint32(2)) < 0 {
  10053. return libc.Uint8FromInt32(0)
  10054. }
  10055. blockSize1 *= int32(2)
  10056. }
  10057. bytesToAllocate1 = _poolBytesToAllocateFor(tls, blockSize1)
  10058. if bytesToAllocate1 == uint64(0) {
  10059. return libc.Uint8FromInt32(0)
  10060. }
  10061. 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)
  10062. if !(tem1 != 0) {
  10063. return libc.Uint8FromInt32(0)
  10064. }
  10065. (*TBLOCK)(unsafe.Pointer(tem1)).Fsize = blockSize1
  10066. (*TBLOCK)(unsafe.Pointer(tem1)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  10067. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = tem1
  10068. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart {
  10069. 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))
  10070. }
  10071. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = tem1 + 12 + uintptr(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  10072. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = tem1 + 12
  10073. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = tem1 + 12 + uintptr(blockSize1)
  10074. }
  10075. return libc.Uint8FromInt32(1)
  10076. }
  10077. func _nextScaffoldPart(tls *libc.TLS, parser TXML_Parser) (r int32) {
  10078. var dtd, me, parent, temp, v2 uintptr
  10079. var next, v3, v4, v5 int32
  10080. var v1 uint32
  10081. _, _, _, _, _, _, _, _, _, _ = dtd, me, next, parent, temp, v1, v2, v3, v4, v5
  10082. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  10083. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  10084. (*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))
  10085. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  10086. return -int32(1)
  10087. }
  10088. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex)) = 0
  10089. }
  10090. if (*TDTD)(unsafe.Pointer(dtd)).FscaffCount >= (*TDTD)(unsafe.Pointer(dtd)).FscaffSize {
  10091. if (*TDTD)(unsafe.Pointer(dtd)).Fscaffold != 0 {
  10092. /* Detect and prevent integer overflow */
  10093. if (*TDTD)(unsafe.Pointer(dtd)).FscaffSize > libc.Uint32FromUint32(0xffffffff)/libc.Uint32FromUint32(2) {
  10094. return -int32(1)
  10095. }
  10096. /* Detect and prevent integer overflow.
  10097. * The preprocessor guard addresses the "always false" warning
  10098. * from -Wtype-limits on platforms where
  10099. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  10100. 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))
  10101. if temp == libc.UintptrFromInt32(0) {
  10102. return -int32(1)
  10103. }
  10104. *(*uint32)(unsafe.Pointer(dtd + 340)) *= uint32(2)
  10105. } else {
  10106. 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))
  10107. if temp == libc.UintptrFromInt32(0) {
  10108. return -int32(1)
  10109. }
  10110. (*TDTD)(unsafe.Pointer(dtd)).FscaffSize = uint32(m_INIT_SCAFFOLD_ELEMENTS)
  10111. }
  10112. (*TDTD)(unsafe.Pointer(dtd)).Fscaffold = temp
  10113. }
  10114. v2 = dtd + 344
  10115. v1 = *(*uint32)(unsafe.Pointer(v2))
  10116. *(*uint32)(unsafe.Pointer(v2))++
  10117. next = libc.Int32FromUint32(v1)
  10118. me = (*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(next)*32
  10119. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel != 0 {
  10120. 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
  10121. if (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild != 0 {
  10122. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild)*32))).Fnextsib = next
  10123. }
  10124. if !((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt != 0) {
  10125. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Ffirstchild = next
  10126. }
  10127. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild = next
  10128. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt++
  10129. }
  10130. v5 = libc.Int32FromInt32(0)
  10131. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fnextsib = v5
  10132. v4 = v5
  10133. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fchildcnt = v4
  10134. v3 = v4
  10135. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Flastchild = v3
  10136. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Ffirstchild = v3
  10137. return next
  10138. }
  10139. func _build_model(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  10140. var allocsize Tsize_t
  10141. var cn, src_node int32
  10142. var dest, destLimit, dtd, jobDest, ret, src, str, v1, v4, v6 uintptr
  10143. var i uint32
  10144. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = allocsize, cn, dest, destLimit, dtd, i, jobDest, ret, src, src_node, str, v1, v4, v6
  10145. /* Function build_model transforms the existing parser->m_dtd->scaffold
  10146. * array of CONTENT_SCAFFOLD tree nodes into a new array of
  10147. * XML_Content tree nodes followed by a gapless list of zero-terminated
  10148. * strings. */
  10149. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the current string writing location */
  10150. /* Detect and prevent integer overflow.
  10151. * The preprocessor guard addresses the "always false" warning
  10152. * from -Wtype-limits on platforms where
  10153. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  10154. if uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*uint64(32) > libc.Uint64FromInt32(-libc.Int32FromInt32(1))-uint64((*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen)*uint64(1) {
  10155. return libc.UintptrFromInt32(0)
  10156. }
  10157. allocsize = uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*libc.Uint64FromInt64(32) + uint64((*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen)*libc.Uint64FromInt64(1)
  10158. ret = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, allocsize)
  10159. if !(ret != 0) {
  10160. return libc.UintptrFromInt32(0)
  10161. }
  10162. /* What follows is an iterative implementation (of what was previously done
  10163. * recursively in a dedicated function called "build_node". The old recursive
  10164. * build_node could be forced into stack exhaustion from input as small as a
  10165. * few megabyte, and so that was a security issue. Hence, a function call
  10166. * stack is avoided now by resolving recursion.)
  10167. *
  10168. * The iterative approach works as follows:
  10169. *
  10170. * - We have two writing pointers, both walking up the result array; one does
  10171. * the work, the other creates "jobs" for its colleague to do, and leads
  10172. * the way:
  10173. *
  10174. * - The faster one, pointer jobDest, always leads and writes "what job
  10175. * to do" by the other, once they reach that place in the
  10176. * array: leader "jobDest" stores the source node array index (relative
  10177. * to array dtd->scaffold) in field "numchildren".
  10178. *
  10179. * - The slower one, pointer dest, looks at the value stored in the
  10180. * "numchildren" field (which actually holds a source node array index
  10181. * at that time) and puts the real data from dtd->scaffold in.
  10182. *
  10183. * - Before the loop starts, jobDest writes source array index 0
  10184. * (where the root node is located) so that dest will have something to do
  10185. * when it starts operation.
  10186. *
  10187. * - Whenever nodes with children are encountered, jobDest appends
  10188. * them as new jobs, in order. As a result, tree node siblings are
  10189. * adjacent in the resulting array, for example:
  10190. *
  10191. * [0] root, has two children
  10192. * [1] first child of 0, has three children
  10193. * [3] first child of 1, does not have children
  10194. * [4] second child of 1, does not have children
  10195. * [5] third child of 1, does not have children
  10196. * [2] second child of 0, does not have children
  10197. *
  10198. * Or (the same data) presented in flat array view:
  10199. *
  10200. * [0] root, has two children
  10201. *
  10202. * [1] first child of 0, has three children
  10203. * [2] second child of 0, does not have children
  10204. *
  10205. * [3] first child of 1, does not have children
  10206. * [4] second child of 1, does not have children
  10207. * [5] third child of 1, does not have children
  10208. *
  10209. * - The algorithm repeats until all target array indices have been processed.
  10210. */
  10211. dest = ret /* tree node writing location, moves upwards */
  10212. destLimit = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*32
  10213. jobDest = ret /* next free writing location in target array */
  10214. str = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*32
  10215. /* Add the starting job, the root node (index 0) of the source tree */
  10216. v1 = jobDest
  10217. jobDest += 32
  10218. (*TXML_Content)(unsafe.Pointer(v1)).Fnumchildren = uint32(0)
  10219. for {
  10220. if !(dest < destLimit) {
  10221. break
  10222. }
  10223. /* Retrieve source tree array index from job storage */
  10224. src_node = libc.Int32FromUint32((*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren)
  10225. /* Convert item */
  10226. (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Ftype1
  10227. (*TXML_Content)(unsafe.Pointer(dest)).Fquant = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fquant
  10228. if (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 == int32(_XML_CTYPE_NAME) {
  10229. (*TXML_Content)(unsafe.Pointer(dest)).Fname = str
  10230. src = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fname
  10231. for {
  10232. v4 = str
  10233. str++
  10234. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(src))
  10235. if !(*(*TXML_Char)(unsafe.Pointer(src)) != 0) {
  10236. break
  10237. }
  10238. src++
  10239. goto _3
  10240. _3:
  10241. }
  10242. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = uint32(0)
  10243. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = libc.UintptrFromInt32(0)
  10244. } else {
  10245. (*TXML_Content)(unsafe.Pointer(dest)).Fname = libc.UintptrFromInt32(0)
  10246. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = libc.Uint32FromInt32((*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fchildcnt)
  10247. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = jobDest
  10248. /* Append scaffold indices of children to array */
  10249. i = uint32(0)
  10250. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Ffirstchild
  10251. for {
  10252. if !(i < (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren) {
  10253. break
  10254. }
  10255. v6 = jobDest
  10256. jobDest += 32
  10257. (*TXML_Content)(unsafe.Pointer(v6)).Fnumchildren = libc.Uint32FromInt32(cn)
  10258. goto _5
  10259. _5:
  10260. ;
  10261. i++
  10262. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(cn)*32))).Fnextsib
  10263. }
  10264. }
  10265. goto _2
  10266. _2:
  10267. ;
  10268. dest += 32
  10269. }
  10270. return ret
  10271. }
  10272. func _getElementType(tls *libc.TLS, parser TXML_Parser, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  10273. var dtd, name, ret uintptr
  10274. _, _, _ = dtd, name, ret
  10275. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  10276. name = _poolStoreString(tls, dtd+160, enc, ptr, end)
  10277. if !(name != 0) {
  10278. return libc.UintptrFromInt32(0)
  10279. }
  10280. ret = _lookup(tls, parser, dtd+40, name, uint64(40))
  10281. if !(ret != 0) {
  10282. return libc.UintptrFromInt32(0)
  10283. }
  10284. if (*TELEMENT_TYPE)(unsafe.Pointer(ret)).Fname != name {
  10285. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  10286. } else {
  10287. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  10288. if !(_setElementTypePrefix(tls, parser, ret) != 0) {
  10289. return libc.UintptrFromInt32(0)
  10290. }
  10291. }
  10292. return ret
  10293. }
  10294. func _copyString(tls *libc.TLS, s uintptr, memsuite uintptr) (r uintptr) {
  10295. var charsRequired Tsize_t
  10296. var result uintptr
  10297. _, _ = charsRequired, result
  10298. charsRequired = uint64(0)
  10299. /* First determine how long the string is */
  10300. for libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s + uintptr(charsRequired)))) != 0 {
  10301. charsRequired++
  10302. }
  10303. /* Include the terminator */
  10304. charsRequired++
  10305. /* Now allocate space for the copy */
  10306. result = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, charsRequired*uint64(1))
  10307. if result == libc.UintptrFromInt32(0) {
  10308. return libc.UintptrFromInt32(0)
  10309. }
  10310. /* Copy the original into place */
  10311. libc.Xmemcpy(tls, result, s, charsRequired*uint64(1))
  10312. return result
  10313. }
  10314. func _accountingGetCurrentAmplification(tls *libc.TLS, rootParser TXML_Parser) (r float32) {
  10315. var amplificationFactor, v1 float32
  10316. var countBytesOutput TXmlBigCount
  10317. _, _, _ = amplificationFactor, countBytesOutput, v1
  10318. countBytesOutput = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect + (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect
  10319. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect != 0 {
  10320. v1 = float32(countBytesOutput) / float32((*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect)
  10321. } else {
  10322. v1 = libc.Float32FromFloat32(1)
  10323. }
  10324. amplificationFactor = v1
  10325. return amplificationFactor
  10326. }
  10327. func _accountingReportStats(tls *libc.TLS, originParser TXML_Parser, epilog uintptr) {
  10328. bp := tls.Alloc(48)
  10329. defer tls.Free(48)
  10330. var amplificationFactor float32
  10331. var rootParser TXML_Parser
  10332. _, _ = amplificationFactor, rootParser
  10333. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10334. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel < int32(1) {
  10335. return
  10336. }
  10337. amplificationFactor = _accountingGetCurrentAmplification(tls, rootParser)
  10338. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1671, libc.VaList(bp+8, rootParser, (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect, (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect, float64(amplificationFactor), epilog))
  10339. }
  10340. func _accountingOnAbort(tls *libc.TLS, originParser TXML_Parser) {
  10341. _accountingReportStats(tls, originParser, __ccgo_ts+1748)
  10342. }
  10343. func _accountingReportDiff(tls *libc.TLS, rootParser TXML_Parser, levelsAwayFromRootParser uint32, before uintptr, after uintptr, bytesMore Tptrdiff_t, source_line int32, account _XML_Account) {
  10344. bp := tls.Alloc(64)
  10345. defer tls.Free(64)
  10346. var contextLength uint32
  10347. var ellipsisLength Tsize_t
  10348. var walker, v1 uintptr
  10349. var _ /* ellipis at bp+0 */ [5]uint8
  10350. _, _, _, _ = contextLength, ellipsisLength, walker, v1
  10351. if account == int32(_XML_ACCOUNT_DIRECT) {
  10352. v1 = __ccgo_ts + 1759
  10353. } else {
  10354. v1 = __ccgo_ts + 1763
  10355. }
  10356. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1767, libc.VaList(bp+16, bytesMore, v1, levelsAwayFromRootParser, source_line, int32(10), __ccgo_ts+1808))
  10357. *(*[5]uint8)(unsafe.Pointer(bp)) = [5]uint8{'[', '.', '.', ']'}
  10358. ellipsisLength = libc.Uint64FromInt64(5) - libc.Uint64FromInt32(1)
  10359. contextLength = uint32(10)
  10360. /* Note: Performance is of no concern here */
  10361. walker = before
  10362. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel >= int32(3) || int64(after)-int64(before) <= libc.Int64FromUint64(uint64(contextLength)+ellipsisLength+uint64(contextLength)) {
  10363. for {
  10364. if !(walker < after) {
  10365. break
  10366. }
  10367. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, *(*uint8)(unsafe.Pointer(walker)))))
  10368. goto _2
  10369. _2:
  10370. ;
  10371. walker++
  10372. }
  10373. } else {
  10374. for {
  10375. if !(walker < before+uintptr(contextLength)) {
  10376. break
  10377. }
  10378. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, *(*uint8)(unsafe.Pointer(walker)))))
  10379. goto _3
  10380. _3:
  10381. ;
  10382. walker++
  10383. }
  10384. libc.Xfprintf(tls, libc.Xstderr, bp, 0)
  10385. walker = after - uintptr(contextLength)
  10386. for {
  10387. if !(walker < after) {
  10388. break
  10389. }
  10390. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, *(*uint8)(unsafe.Pointer(walker)))))
  10391. goto _4
  10392. _4:
  10393. ;
  10394. walker++
  10395. }
  10396. }
  10397. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1812, 0)
  10398. }
  10399. func _accountingDiffTolerated(tls *libc.TLS, originParser TXML_Parser, tok int32, before uintptr, after uintptr, source_line int32, account _XML_Account) (r TXML_Bool) {
  10400. bp := tls.Alloc(16)
  10401. defer tls.Free(16)
  10402. var additionTarget, v1 uintptr
  10403. var amplificationFactor float32
  10404. var bytesMore Tptrdiff_t
  10405. var countBytesOutput TXmlBigCount
  10406. var isDirect int32
  10407. var rootParser TXML_Parser
  10408. var tolerated TXML_Bool
  10409. var _ /* levelsAwayFromRootParser at bp+0 */ uint32
  10410. _, _, _, _, _, _, _, _ = additionTarget, amplificationFactor, bytesMore, countBytesOutput, isDirect, rootParser, tolerated, v1
  10411. /* Note: We need to check the token type *first* to be sure that
  10412. * we can even access variable <after>, safely.
  10413. * E.g. for XML_TOK_NONE <after> may hold an invalid pointer. */
  10414. switch tok {
  10415. case m_XML_TOK_INVALID:
  10416. fallthrough
  10417. case -int32(1):
  10418. fallthrough
  10419. case -int32(2):
  10420. fallthrough
  10421. case -int32(4):
  10422. return libc.Uint8FromInt32(1)
  10423. }
  10424. if account == int32(_XML_ACCOUNT_NONE) {
  10425. return libc.Uint8FromInt32(1)
  10426. }
  10427. rootParser = _getRootParserOf(tls, originParser, bp)
  10428. isDirect = libc.BoolInt32(account == int32(_XML_ACCOUNT_DIRECT) && originParser == rootParser)
  10429. bytesMore = int64(after) - int64(before)
  10430. if isDirect != 0 {
  10431. v1 = rootParser + 928
  10432. } else {
  10433. v1 = rootParser + 928 + 8
  10434. }
  10435. additionTarget = v1
  10436. /* Detect and avoid integer overflow */
  10437. if *(*TXmlBigCount)(unsafe.Pointer(additionTarget)) > libc.Uint64FromInt32(-libc.Int32FromInt32(1))-libc.Uint64FromInt64(bytesMore) {
  10438. return libc.Uint8FromInt32(0)
  10439. }
  10440. *(*TXmlBigCount)(unsafe.Pointer(additionTarget)) += libc.Uint64FromInt64(bytesMore)
  10441. countBytesOutput = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect + (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect
  10442. amplificationFactor = _accountingGetCurrentAmplification(tls, rootParser)
  10443. tolerated = libc.BoolUint8(countBytesOutput < (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FactivationThresholdBytes || amplificationFactor <= (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FmaximumAmplificationFactor)
  10444. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel >= int32(2) {
  10445. _accountingReportStats(tls, rootParser, __ccgo_ts+1808)
  10446. _accountingReportDiff(tls, rootParser, *(*uint32)(unsafe.Pointer(bp)), before, after, bytesMore, source_line, account)
  10447. }
  10448. return tolerated
  10449. }
  10450. func XtestingAccountingGetCountBytesDirect(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  10451. if !(parser != 0) {
  10452. return uint64(0)
  10453. }
  10454. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FcountBytesDirect
  10455. }
  10456. func XtestingAccountingGetCountBytesIndirect(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  10457. if !(parser != 0) {
  10458. return uint64(0)
  10459. }
  10460. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FcountBytesIndirect
  10461. }
  10462. func _entityTrackingReportStats(tls *libc.TLS, rootParser TXML_Parser, entity uintptr, action uintptr, sourceLine int32) {
  10463. bp := tls.Alloc(96)
  10464. defer tls.Free(96)
  10465. var entityName, v1 uintptr
  10466. _, _ = entityName, v1
  10467. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FdebugLevel < int32(1) {
  10468. return
  10469. }
  10470. entityName = (*TENTITY)(unsafe.Pointer(entity)).Fname
  10471. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  10472. v1 = __ccgo_ts + 1815
  10473. } else {
  10474. v1 = __ccgo_ts + 1817
  10475. }
  10476. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1819, libc.VaList(bp+8, rootParser, (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcountEverOpened, (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth, (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen, ((*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth-uint32(1))*uint32(2), __ccgo_ts+1808, v1, entityName, action, (*TENTITY)(unsafe.Pointer(entity)).FtextLen, sourceLine))
  10477. }
  10478. func _entityTrackingOnOpen(tls *libc.TLS, originParser TXML_Parser, entity uintptr, sourceLine int32) {
  10479. var rootParser TXML_Parser
  10480. _ = rootParser
  10481. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10482. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcountEverOpened++
  10483. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth++
  10484. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth > (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen {
  10485. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen++
  10486. }
  10487. _entityTrackingReportStats(tls, rootParser, entity, __ccgo_ts+1904, sourceLine)
  10488. }
  10489. func _entityTrackingOnClose(tls *libc.TLS, originParser TXML_Parser, entity uintptr, sourceLine int32) {
  10490. var rootParser TXML_Parser
  10491. _ = rootParser
  10492. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10493. _entityTrackingReportStats(tls, rootParser, entity, __ccgo_ts+1910, sourceLine)
  10494. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth--
  10495. }
  10496. func _getRootParserOf(tls *libc.TLS, parser TXML_Parser, outLevelDiff uintptr) (r TXML_Parser) {
  10497. var rootParser TXML_Parser
  10498. var stepsTakenUpwards uint32
  10499. _, _ = rootParser, stepsTakenUpwards
  10500. rootParser = parser
  10501. stepsTakenUpwards = uint32(0)
  10502. for (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_parentParser != 0 {
  10503. rootParser = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_parentParser
  10504. stepsTakenUpwards++
  10505. }
  10506. if outLevelDiff != libc.UintptrFromInt32(0) {
  10507. *(*uint32)(unsafe.Pointer(outLevelDiff)) = stepsTakenUpwards
  10508. }
  10509. return rootParser
  10510. }
  10511. func XunsignedCharToPrintable(tls *libc.TLS, c uint8) (r uintptr) {
  10512. switch libc.Int32FromUint8(c) {
  10513. case 0:
  10514. return __ccgo_ts + 1916
  10515. case int32(1):
  10516. return __ccgo_ts + 1919
  10517. case int32(2):
  10518. return __ccgo_ts + 1923
  10519. case int32(3):
  10520. return __ccgo_ts + 1927
  10521. case int32(4):
  10522. return __ccgo_ts + 1931
  10523. case int32(5):
  10524. return __ccgo_ts + 1935
  10525. case int32(6):
  10526. return __ccgo_ts + 1939
  10527. case int32(7):
  10528. return __ccgo_ts + 1943
  10529. case int32(8):
  10530. return __ccgo_ts + 1947
  10531. case int32(9):
  10532. return __ccgo_ts + 1951
  10533. case int32(10):
  10534. return __ccgo_ts + 1954
  10535. case int32(11):
  10536. return __ccgo_ts + 1957
  10537. case int32(12):
  10538. return __ccgo_ts + 1961
  10539. case int32(13):
  10540. return __ccgo_ts + 1965
  10541. case int32(14):
  10542. return __ccgo_ts + 1968
  10543. case int32(15):
  10544. return __ccgo_ts + 1972
  10545. case int32(16):
  10546. return __ccgo_ts + 1976
  10547. case int32(17):
  10548. return __ccgo_ts + 1981
  10549. case int32(18):
  10550. return __ccgo_ts + 1986
  10551. case int32(19):
  10552. return __ccgo_ts + 1991
  10553. case int32(20):
  10554. return __ccgo_ts + 1996
  10555. case int32(21):
  10556. return __ccgo_ts + 2001
  10557. case int32(22):
  10558. return __ccgo_ts + 2006
  10559. case int32(23):
  10560. return __ccgo_ts + 2011
  10561. case int32(24):
  10562. return __ccgo_ts + 2016
  10563. case int32(25):
  10564. return __ccgo_ts + 2021
  10565. case int32(26):
  10566. return __ccgo_ts + 2026
  10567. case int32(27):
  10568. return __ccgo_ts + 2031
  10569. case int32(28):
  10570. return __ccgo_ts + 2036
  10571. case int32(29):
  10572. return __ccgo_ts + 2041
  10573. case int32(30):
  10574. return __ccgo_ts + 2046
  10575. case int32(31):
  10576. return __ccgo_ts + 2051
  10577. case int32(32):
  10578. return __ccgo_ts + 2056
  10579. case int32(33):
  10580. return __ccgo_ts + 2058
  10581. case int32(34):
  10582. return __ccgo_ts + 2060
  10583. case int32(35):
  10584. return __ccgo_ts + 2063
  10585. case int32(36):
  10586. return __ccgo_ts + 2065
  10587. case int32(37):
  10588. return __ccgo_ts + 1815
  10589. case int32(38):
  10590. return __ccgo_ts + 1817
  10591. case int32(39):
  10592. return __ccgo_ts + 2067
  10593. case int32(40):
  10594. return __ccgo_ts + 2069
  10595. case int32(41):
  10596. return __ccgo_ts + 2071
  10597. case int32(42):
  10598. return __ccgo_ts + 2073
  10599. case int32(43):
  10600. return __ccgo_ts + 2075
  10601. case int32(44):
  10602. return __ccgo_ts + 2077
  10603. case int32(45):
  10604. return __ccgo_ts + 2079
  10605. case int32(46):
  10606. return __ccgo_ts + 2081
  10607. case int32(47):
  10608. return __ccgo_ts + 2083
  10609. case int32(48):
  10610. return __ccgo_ts + 2085
  10611. case int32(49):
  10612. return __ccgo_ts + 2087
  10613. case int32(50):
  10614. return __ccgo_ts + 2089
  10615. case int32(51):
  10616. return __ccgo_ts + 2091
  10617. case int32(52):
  10618. return __ccgo_ts + 2093
  10619. case int32(53):
  10620. return __ccgo_ts + 2095
  10621. case int32(54):
  10622. return __ccgo_ts + 2097
  10623. case int32(55):
  10624. return __ccgo_ts + 2099
  10625. case int32(56):
  10626. return __ccgo_ts + 2101
  10627. case int32(57):
  10628. return __ccgo_ts + 2103
  10629. case int32(58):
  10630. return __ccgo_ts + 2105
  10631. case int32(59):
  10632. return __ccgo_ts + 2107
  10633. case int32(60):
  10634. return __ccgo_ts + 2109
  10635. case int32(61):
  10636. return __ccgo_ts + 2111
  10637. case int32(62):
  10638. return __ccgo_ts + 2113
  10639. case int32(63):
  10640. return __ccgo_ts + 2115
  10641. case int32(64):
  10642. return __ccgo_ts + 2117
  10643. case int32(65):
  10644. return __ccgo_ts + 2119
  10645. case int32(66):
  10646. return __ccgo_ts + 2121
  10647. case int32(67):
  10648. return __ccgo_ts + 2123
  10649. case int32(68):
  10650. return __ccgo_ts + 2125
  10651. case int32(69):
  10652. return __ccgo_ts + 2127
  10653. case int32(70):
  10654. return __ccgo_ts + 2129
  10655. case int32(71):
  10656. return __ccgo_ts + 2131
  10657. case int32(72):
  10658. return __ccgo_ts + 2133
  10659. case int32(73):
  10660. return __ccgo_ts + 2135
  10661. case int32(74):
  10662. return __ccgo_ts + 2137
  10663. case int32(75):
  10664. return __ccgo_ts + 2139
  10665. case int32(76):
  10666. return __ccgo_ts + 2141
  10667. case int32(77):
  10668. return __ccgo_ts + 2143
  10669. case int32(78):
  10670. return __ccgo_ts + 2145
  10671. case int32(79):
  10672. return __ccgo_ts + 2147
  10673. case int32(80):
  10674. return __ccgo_ts + 2149
  10675. case int32(81):
  10676. return __ccgo_ts + 2151
  10677. case int32(82):
  10678. return __ccgo_ts + 2153
  10679. case int32(83):
  10680. return __ccgo_ts + 2155
  10681. case int32(84):
  10682. return __ccgo_ts + 2157
  10683. case int32(85):
  10684. return __ccgo_ts + 2159
  10685. case int32(86):
  10686. return __ccgo_ts + 2161
  10687. case int32(87):
  10688. return __ccgo_ts + 2163
  10689. case int32(88):
  10690. return __ccgo_ts + 2165
  10691. case int32(89):
  10692. return __ccgo_ts + 2167
  10693. case int32(90):
  10694. return __ccgo_ts + 2169
  10695. case int32(91):
  10696. return __ccgo_ts + 2171
  10697. case int32(92):
  10698. return __ccgo_ts + 2173
  10699. case int32(93):
  10700. return __ccgo_ts + 2176
  10701. case int32(94):
  10702. return __ccgo_ts + 2178
  10703. case int32(95):
  10704. return __ccgo_ts + 2180
  10705. case int32(96):
  10706. return __ccgo_ts + 2182
  10707. case int32(97):
  10708. return __ccgo_ts + 2184
  10709. case int32(98):
  10710. return __ccgo_ts + 2186
  10711. case int32(99):
  10712. return __ccgo_ts + 2188
  10713. case int32(100):
  10714. return __ccgo_ts + 2190
  10715. case int32(101):
  10716. return __ccgo_ts + 2192
  10717. case int32(102):
  10718. return __ccgo_ts + 2194
  10719. case int32(103):
  10720. return __ccgo_ts + 2196
  10721. case int32(104):
  10722. return __ccgo_ts + 2198
  10723. case int32(105):
  10724. return __ccgo_ts + 2200
  10725. case int32(106):
  10726. return __ccgo_ts + 2202
  10727. case int32(107):
  10728. return __ccgo_ts + 2204
  10729. case int32(108):
  10730. return __ccgo_ts + 2206
  10731. case int32(109):
  10732. return __ccgo_ts + 2208
  10733. case int32(110):
  10734. return __ccgo_ts + 2210
  10735. case int32(111):
  10736. return __ccgo_ts + 2212
  10737. case int32(112):
  10738. return __ccgo_ts + 2214
  10739. case int32(113):
  10740. return __ccgo_ts + 2216
  10741. case int32(114):
  10742. return __ccgo_ts + 2218
  10743. case int32(115):
  10744. return __ccgo_ts + 2220
  10745. case int32(116):
  10746. return __ccgo_ts + 2222
  10747. case int32(117):
  10748. return __ccgo_ts + 2224
  10749. case int32(118):
  10750. return __ccgo_ts + 2226
  10751. case int32(119):
  10752. return __ccgo_ts + 2228
  10753. case int32(120):
  10754. return __ccgo_ts + 2230
  10755. case int32(121):
  10756. return __ccgo_ts + 2232
  10757. case int32(122):
  10758. return __ccgo_ts + 2234
  10759. case int32(123):
  10760. return __ccgo_ts + 2236
  10761. case int32(124):
  10762. return __ccgo_ts + 2238
  10763. case int32(125):
  10764. return __ccgo_ts + 2240
  10765. case int32(126):
  10766. return __ccgo_ts + 2242
  10767. case int32(127):
  10768. return __ccgo_ts + 2244
  10769. case int32(128):
  10770. return __ccgo_ts + 2249
  10771. case int32(129):
  10772. return __ccgo_ts + 2254
  10773. case int32(130):
  10774. return __ccgo_ts + 2259
  10775. case int32(131):
  10776. return __ccgo_ts + 2264
  10777. case int32(132):
  10778. return __ccgo_ts + 2269
  10779. case int32(133):
  10780. return __ccgo_ts + 2274
  10781. case int32(134):
  10782. return __ccgo_ts + 2279
  10783. case int32(135):
  10784. return __ccgo_ts + 2284
  10785. case int32(136):
  10786. return __ccgo_ts + 2289
  10787. case int32(137):
  10788. return __ccgo_ts + 2294
  10789. case int32(138):
  10790. return __ccgo_ts + 2299
  10791. case int32(139):
  10792. return __ccgo_ts + 2304
  10793. case int32(140):
  10794. return __ccgo_ts + 2309
  10795. case int32(141):
  10796. return __ccgo_ts + 2314
  10797. case int32(142):
  10798. return __ccgo_ts + 2319
  10799. case int32(143):
  10800. return __ccgo_ts + 2324
  10801. case int32(144):
  10802. return __ccgo_ts + 2329
  10803. case int32(145):
  10804. return __ccgo_ts + 2334
  10805. case int32(146):
  10806. return __ccgo_ts + 2339
  10807. case int32(147):
  10808. return __ccgo_ts + 2344
  10809. case int32(148):
  10810. return __ccgo_ts + 2349
  10811. case int32(149):
  10812. return __ccgo_ts + 2354
  10813. case int32(150):
  10814. return __ccgo_ts + 2359
  10815. case int32(151):
  10816. return __ccgo_ts + 2364
  10817. case int32(152):
  10818. return __ccgo_ts + 2369
  10819. case int32(153):
  10820. return __ccgo_ts + 2374
  10821. case int32(154):
  10822. return __ccgo_ts + 2379
  10823. case int32(155):
  10824. return __ccgo_ts + 2384
  10825. case int32(156):
  10826. return __ccgo_ts + 2389
  10827. case int32(157):
  10828. return __ccgo_ts + 2394
  10829. case int32(158):
  10830. return __ccgo_ts + 2399
  10831. case int32(159):
  10832. return __ccgo_ts + 2404
  10833. case int32(160):
  10834. return __ccgo_ts + 2409
  10835. case int32(161):
  10836. return __ccgo_ts + 2414
  10837. case int32(162):
  10838. return __ccgo_ts + 2419
  10839. case int32(163):
  10840. return __ccgo_ts + 2424
  10841. case int32(164):
  10842. return __ccgo_ts + 2429
  10843. case int32(165):
  10844. return __ccgo_ts + 2434
  10845. case int32(166):
  10846. return __ccgo_ts + 2439
  10847. case int32(167):
  10848. return __ccgo_ts + 2444
  10849. case int32(168):
  10850. return __ccgo_ts + 2449
  10851. case int32(169):
  10852. return __ccgo_ts + 2454
  10853. case int32(170):
  10854. return __ccgo_ts + 2459
  10855. case int32(171):
  10856. return __ccgo_ts + 2464
  10857. case int32(172):
  10858. return __ccgo_ts + 2469
  10859. case int32(173):
  10860. return __ccgo_ts + 2474
  10861. case int32(174):
  10862. return __ccgo_ts + 2479
  10863. case int32(175):
  10864. return __ccgo_ts + 2484
  10865. case int32(176):
  10866. return __ccgo_ts + 2489
  10867. case int32(177):
  10868. return __ccgo_ts + 2494
  10869. case int32(178):
  10870. return __ccgo_ts + 2499
  10871. case int32(179):
  10872. return __ccgo_ts + 2504
  10873. case int32(180):
  10874. return __ccgo_ts + 2509
  10875. case int32(181):
  10876. return __ccgo_ts + 2514
  10877. case int32(182):
  10878. return __ccgo_ts + 2519
  10879. case int32(183):
  10880. return __ccgo_ts + 2524
  10881. case int32(184):
  10882. return __ccgo_ts + 2529
  10883. case int32(185):
  10884. return __ccgo_ts + 2534
  10885. case int32(186):
  10886. return __ccgo_ts + 2539
  10887. case int32(187):
  10888. return __ccgo_ts + 2544
  10889. case int32(188):
  10890. return __ccgo_ts + 2549
  10891. case int32(189):
  10892. return __ccgo_ts + 2554
  10893. case int32(190):
  10894. return __ccgo_ts + 2559
  10895. case int32(191):
  10896. return __ccgo_ts + 2564
  10897. case int32(192):
  10898. return __ccgo_ts + 2569
  10899. case int32(193):
  10900. return __ccgo_ts + 2574
  10901. case int32(194):
  10902. return __ccgo_ts + 2579
  10903. case int32(195):
  10904. return __ccgo_ts + 2584
  10905. case int32(196):
  10906. return __ccgo_ts + 2589
  10907. case int32(197):
  10908. return __ccgo_ts + 2594
  10909. case int32(198):
  10910. return __ccgo_ts + 2599
  10911. case int32(199):
  10912. return __ccgo_ts + 2604
  10913. case int32(200):
  10914. return __ccgo_ts + 2609
  10915. case int32(201):
  10916. return __ccgo_ts + 2614
  10917. case int32(202):
  10918. return __ccgo_ts + 2619
  10919. case int32(203):
  10920. return __ccgo_ts + 2624
  10921. case int32(204):
  10922. return __ccgo_ts + 2629
  10923. case int32(205):
  10924. return __ccgo_ts + 2634
  10925. case int32(206):
  10926. return __ccgo_ts + 2639
  10927. case int32(207):
  10928. return __ccgo_ts + 2644
  10929. case int32(208):
  10930. return __ccgo_ts + 2649
  10931. case int32(209):
  10932. return __ccgo_ts + 2654
  10933. case int32(210):
  10934. return __ccgo_ts + 2659
  10935. case int32(211):
  10936. return __ccgo_ts + 2664
  10937. case int32(212):
  10938. return __ccgo_ts + 2669
  10939. case int32(213):
  10940. return __ccgo_ts + 2674
  10941. case int32(214):
  10942. return __ccgo_ts + 2679
  10943. case int32(215):
  10944. return __ccgo_ts + 2684
  10945. case int32(216):
  10946. return __ccgo_ts + 2689
  10947. case int32(217):
  10948. return __ccgo_ts + 2694
  10949. case int32(218):
  10950. return __ccgo_ts + 2699
  10951. case int32(219):
  10952. return __ccgo_ts + 2704
  10953. case int32(220):
  10954. return __ccgo_ts + 2709
  10955. case int32(221):
  10956. return __ccgo_ts + 2714
  10957. case int32(222):
  10958. return __ccgo_ts + 2719
  10959. case int32(223):
  10960. return __ccgo_ts + 2724
  10961. case int32(224):
  10962. return __ccgo_ts + 2729
  10963. case int32(225):
  10964. return __ccgo_ts + 2734
  10965. case int32(226):
  10966. return __ccgo_ts + 2739
  10967. case int32(227):
  10968. return __ccgo_ts + 2744
  10969. case int32(228):
  10970. return __ccgo_ts + 2749
  10971. case int32(229):
  10972. return __ccgo_ts + 2754
  10973. case int32(230):
  10974. return __ccgo_ts + 2759
  10975. case int32(231):
  10976. return __ccgo_ts + 2764
  10977. case int32(232):
  10978. return __ccgo_ts + 2769
  10979. case int32(233):
  10980. return __ccgo_ts + 2774
  10981. case int32(234):
  10982. return __ccgo_ts + 2779
  10983. case int32(235):
  10984. return __ccgo_ts + 2784
  10985. case int32(236):
  10986. return __ccgo_ts + 2789
  10987. case int32(237):
  10988. return __ccgo_ts + 2794
  10989. case int32(238):
  10990. return __ccgo_ts + 2799
  10991. case int32(239):
  10992. return __ccgo_ts + 2804
  10993. case int32(240):
  10994. return __ccgo_ts + 2809
  10995. case int32(241):
  10996. return __ccgo_ts + 2814
  10997. case int32(242):
  10998. return __ccgo_ts + 2819
  10999. case int32(243):
  11000. return __ccgo_ts + 2824
  11001. case int32(244):
  11002. return __ccgo_ts + 2829
  11003. case int32(245):
  11004. return __ccgo_ts + 2834
  11005. case int32(246):
  11006. return __ccgo_ts + 2839
  11007. case int32(247):
  11008. return __ccgo_ts + 2844
  11009. case int32(248):
  11010. return __ccgo_ts + 2849
  11011. case int32(249):
  11012. return __ccgo_ts + 2854
  11013. case int32(250):
  11014. return __ccgo_ts + 2859
  11015. case int32(251):
  11016. return __ccgo_ts + 2864
  11017. case int32(252):
  11018. return __ccgo_ts + 2869
  11019. case int32(253):
  11020. return __ccgo_ts + 2874
  11021. case int32(254):
  11022. return __ccgo_ts + 2879
  11023. case int32(255):
  11024. return __ccgo_ts + 2884
  11025. default:
  11026. /* never gets here */
  11027. return __ccgo_ts + 2889
  11028. }
  11029. /* never gets here */
  11030. return r
  11031. }
  11032. func _getDebugLevel(tls *libc.TLS, variableName uintptr, defaultDebugLevel uint64) (r uint64) {
  11033. bp := tls.Alloc(16)
  11034. defer tls.Free(16)
  11035. var debugLevel uint64
  11036. var value, valueOrNull uintptr
  11037. var _ /* afterValue at bp+0 */ uintptr
  11038. _, _, _ = debugLevel, value, valueOrNull
  11039. valueOrNull = libc.Xgetenv(tls, variableName)
  11040. if valueOrNull == libc.UintptrFromInt32(0) {
  11041. return defaultDebugLevel
  11042. }
  11043. value = valueOrNull
  11044. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  11045. *(*uintptr)(unsafe.Pointer(bp)) = value
  11046. debugLevel = libc.Xstrtoul(tls, value, bp, int32(10))
  11047. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != 0 || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != int32('\000') {
  11048. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  11049. return defaultDebugLevel
  11050. }
  11051. return debugLevel
  11052. }
  11053. const m_ASCII_01 = 0x30
  11054. const m_ASCII_11 = 0x31
  11055. const m_ASCII_21 = 0x32
  11056. const m_ASCII_31 = 0x33
  11057. const m_ASCII_81 = 0x38
  11058. const m_ASCII_91 = 0x39
  11059. const m_ASCII_B1 = 66
  11060. const m_ASCII_COLON1 = 0x3A
  11061. const m_ASCII_COMMA1 = 0x2C
  11062. const m_ASCII_EQUALS1 = 0x3D
  11063. const m_ASCII_EXCL1 = 0x21
  11064. const m_ASCII_FF1 = 0x0C
  11065. const m_ASCII_G1 = 71
  11066. const m_ASCII_HASH1 = 0x23
  11067. const m_ASCII_LPAREN1 = 0x28
  11068. const m_ASCII_P1 = 80
  11069. const m_ASCII_PERIOD1 = 0x2E
  11070. const m_ASCII_PIPE1 = 0x7C
  11071. const m_ASCII_Q1 = 81
  11072. const m_ASCII_RPAREN1 = 0x29
  11073. const m_ASCII_SLASH1 = 0x2F
  11074. const m_ASCII_U1 = 85
  11075. const m_ASCII_a1 = 0x61
  11076. const m_ASCII_c1 = 0x63
  11077. const m_ASCII_e1 = 0x65
  11078. const m_ASCII_g1 = 0x67
  11079. const m_ASCII_h1 = 0x68
  11080. const m_ASCII_l1 = 0x6C
  11081. const m_ASCII_m1 = 0x6D
  11082. const m_ASCII_n1 = 0x6E
  11083. const m_ASCII_o1 = 0x6F
  11084. const m_ASCII_p1 = 0x70
  11085. const m_ASCII_r1 = 0x72
  11086. const m_ASCII_s1 = 0x73
  11087. const m_ASCII_t1 = 0x74
  11088. const m_ASCII_w1 = 0x77
  11089. const m_ASCII_x1 = 0x78
  11090. const m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT1 = "100.0f"
  11091. const m_INT_MAX1 = 0x7fffffff
  11092. const m_UINT_MAX1 = 0xffffffff
  11093. /*
  11094. __ __ _
  11095. ___\ \/ /_ __ __ _| |_
  11096. / _ \\ /| '_ \ / _` | __|
  11097. | __// \| |_) | (_| | |_
  11098. \___/_/\_\ .__/ \__,_|\__|
  11099. |_| XML parser
  11100. Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
  11101. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  11102. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  11103. Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
  11104. Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
  11105. Licensed under the MIT license:
  11106. Permission is hereby granted, free of charge, to any person obtaining
  11107. a copy of this software and associated documentation files (the
  11108. "Software"), to deal in the Software without restriction, including
  11109. without limitation the rights to use, copy, modify, merge, publish,
  11110. distribute, sublicense, and/or sell copies of the Software, and to permit
  11111. persons to whom the Software is furnished to do so, subject to the
  11112. following conditions:
  11113. The above copyright notice and this permission notice shall be included
  11114. in all copies or substantial portions of the Software.
  11115. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  11116. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  11117. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  11118. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  11119. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  11120. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  11121. USE OR OTHER DEALINGS IN THE SOFTWARE.
  11122. */
  11123. /* Doesn't check:
  11124. that ,| are not mixed in a model group
  11125. content of literals
  11126. */
  11127. var _KW_ANY = [4]uint8{
  11128. 0: uint8(m_ASCII_A),
  11129. 1: uint8(m_ASCII_N),
  11130. 2: uint8(m_ASCII_Y),
  11131. }
  11132. var _KW_ATTLIST = [8]uint8{
  11133. 0: uint8(m_ASCII_A),
  11134. 1: uint8(m_ASCII_T),
  11135. 2: uint8(m_ASCII_T),
  11136. 3: uint8(m_ASCII_L),
  11137. 4: uint8(m_ASCII_I),
  11138. 5: uint8(m_ASCII_S),
  11139. 6: uint8(m_ASCII_T),
  11140. }
  11141. var _KW_CDATA = [6]uint8{
  11142. 0: uint8(m_ASCII_C),
  11143. 1: uint8(m_ASCII_D),
  11144. 2: uint8(m_ASCII_A),
  11145. 3: uint8(m_ASCII_T),
  11146. 4: uint8(m_ASCII_A),
  11147. }
  11148. var _KW_DOCTYPE = [8]uint8{
  11149. 0: uint8(m_ASCII_D),
  11150. 1: uint8(m_ASCII_O),
  11151. 2: uint8(m_ASCII_C),
  11152. 3: uint8(m_ASCII_T),
  11153. 4: uint8(m_ASCII_Y),
  11154. 5: uint8(m_ASCII_P1),
  11155. 6: uint8(m_ASCII_E),
  11156. }
  11157. var _KW_ELEMENT = [8]uint8{
  11158. 0: uint8(m_ASCII_E),
  11159. 1: uint8(m_ASCII_L),
  11160. 2: uint8(m_ASCII_E),
  11161. 3: uint8(m_ASCII_M),
  11162. 4: uint8(m_ASCII_E),
  11163. 5: uint8(m_ASCII_N),
  11164. 6: uint8(m_ASCII_T),
  11165. }
  11166. var _KW_EMPTY = [6]uint8{
  11167. 0: uint8(m_ASCII_E),
  11168. 1: uint8(m_ASCII_M),
  11169. 2: uint8(m_ASCII_P1),
  11170. 3: uint8(m_ASCII_T),
  11171. 4: uint8(m_ASCII_Y),
  11172. }
  11173. var _KW_ENTITIES = [9]uint8{
  11174. 0: uint8(m_ASCII_E),
  11175. 1: uint8(m_ASCII_N),
  11176. 2: uint8(m_ASCII_T),
  11177. 3: uint8(m_ASCII_I),
  11178. 4: uint8(m_ASCII_T),
  11179. 5: uint8(m_ASCII_I),
  11180. 6: uint8(m_ASCII_E),
  11181. 7: uint8(m_ASCII_S),
  11182. }
  11183. var _KW_ENTITY = [7]uint8{
  11184. 0: uint8(m_ASCII_E),
  11185. 1: uint8(m_ASCII_N),
  11186. 2: uint8(m_ASCII_T),
  11187. 3: uint8(m_ASCII_I),
  11188. 4: uint8(m_ASCII_T),
  11189. 5: uint8(m_ASCII_Y),
  11190. }
  11191. var _KW_FIXED = [6]uint8{
  11192. 0: uint8(m_ASCII_F),
  11193. 1: uint8(m_ASCII_I),
  11194. 2: uint8(m_ASCII_X),
  11195. 3: uint8(m_ASCII_E),
  11196. 4: uint8(m_ASCII_D),
  11197. }
  11198. var _KW_ID = [3]uint8{
  11199. 0: uint8(m_ASCII_I),
  11200. 1: uint8(m_ASCII_D),
  11201. }
  11202. var _KW_IDREF = [6]uint8{
  11203. 0: uint8(m_ASCII_I),
  11204. 1: uint8(m_ASCII_D),
  11205. 2: uint8(m_ASCII_R),
  11206. 3: uint8(m_ASCII_E),
  11207. 4: uint8(m_ASCII_F),
  11208. }
  11209. var _KW_IDREFS = [7]uint8{
  11210. 0: uint8(m_ASCII_I),
  11211. 1: uint8(m_ASCII_D),
  11212. 2: uint8(m_ASCII_R),
  11213. 3: uint8(m_ASCII_E),
  11214. 4: uint8(m_ASCII_F),
  11215. 5: uint8(m_ASCII_S),
  11216. }
  11217. var _KW_IGNORE = [7]uint8{
  11218. 0: uint8(m_ASCII_I),
  11219. 1: uint8(m_ASCII_G1),
  11220. 2: uint8(m_ASCII_N),
  11221. 3: uint8(m_ASCII_O),
  11222. 4: uint8(m_ASCII_R),
  11223. 5: uint8(m_ASCII_E),
  11224. }
  11225. var _KW_IMPLIED = [8]uint8{
  11226. 0: uint8(m_ASCII_I),
  11227. 1: uint8(m_ASCII_M),
  11228. 2: uint8(m_ASCII_P1),
  11229. 3: uint8(m_ASCII_L),
  11230. 4: uint8(m_ASCII_I),
  11231. 5: uint8(m_ASCII_E),
  11232. 6: uint8(m_ASCII_D),
  11233. }
  11234. var _KW_INCLUDE = [8]uint8{
  11235. 0: uint8(m_ASCII_I),
  11236. 1: uint8(m_ASCII_N),
  11237. 2: uint8(m_ASCII_C),
  11238. 3: uint8(m_ASCII_L),
  11239. 4: uint8(m_ASCII_U1),
  11240. 5: uint8(m_ASCII_D),
  11241. 6: uint8(m_ASCII_E),
  11242. }
  11243. var _KW_NDATA = [6]uint8{
  11244. 0: uint8(m_ASCII_N),
  11245. 1: uint8(m_ASCII_D),
  11246. 2: uint8(m_ASCII_A),
  11247. 3: uint8(m_ASCII_T),
  11248. 4: uint8(m_ASCII_A),
  11249. }
  11250. var _KW_NMTOKEN = [8]uint8{
  11251. 0: uint8(m_ASCII_N),
  11252. 1: uint8(m_ASCII_M),
  11253. 2: uint8(m_ASCII_T),
  11254. 3: uint8(m_ASCII_O),
  11255. 4: uint8(m_ASCII_K),
  11256. 5: uint8(m_ASCII_E),
  11257. 6: uint8(m_ASCII_N),
  11258. }
  11259. var _KW_NMTOKENS = [9]uint8{
  11260. 0: uint8(m_ASCII_N),
  11261. 1: uint8(m_ASCII_M),
  11262. 2: uint8(m_ASCII_T),
  11263. 3: uint8(m_ASCII_O),
  11264. 4: uint8(m_ASCII_K),
  11265. 5: uint8(m_ASCII_E),
  11266. 6: uint8(m_ASCII_N),
  11267. 7: uint8(m_ASCII_S),
  11268. }
  11269. var _KW_NOTATION = [9]uint8{
  11270. 0: uint8(m_ASCII_N),
  11271. 1: uint8(m_ASCII_O),
  11272. 2: uint8(m_ASCII_T),
  11273. 3: uint8(m_ASCII_A),
  11274. 4: uint8(m_ASCII_T),
  11275. 5: uint8(m_ASCII_I),
  11276. 6: uint8(m_ASCII_O),
  11277. 7: uint8(m_ASCII_N),
  11278. }
  11279. var _KW_PCDATA = [7]uint8{
  11280. 0: uint8(m_ASCII_P1),
  11281. 1: uint8(m_ASCII_C),
  11282. 2: uint8(m_ASCII_D),
  11283. 3: uint8(m_ASCII_A),
  11284. 4: uint8(m_ASCII_T),
  11285. 5: uint8(m_ASCII_A),
  11286. }
  11287. var _KW_PUBLIC = [7]uint8{
  11288. 0: uint8(m_ASCII_P1),
  11289. 1: uint8(m_ASCII_U1),
  11290. 2: uint8(m_ASCII_B1),
  11291. 3: uint8(m_ASCII_L),
  11292. 4: uint8(m_ASCII_I),
  11293. 5: uint8(m_ASCII_C),
  11294. }
  11295. var _KW_REQUIRED = [9]uint8{
  11296. 0: uint8(m_ASCII_R),
  11297. 1: uint8(m_ASCII_E),
  11298. 2: uint8(m_ASCII_Q1),
  11299. 3: uint8(m_ASCII_U1),
  11300. 4: uint8(m_ASCII_I),
  11301. 5: uint8(m_ASCII_R),
  11302. 6: uint8(m_ASCII_E),
  11303. 7: uint8(m_ASCII_D),
  11304. }
  11305. var _KW_SYSTEM = [7]uint8{
  11306. 0: uint8(m_ASCII_S),
  11307. 1: uint8(m_ASCII_Y),
  11308. 2: uint8(m_ASCII_S),
  11309. 3: uint8(m_ASCII_T),
  11310. 4: uint8(m_ASCII_E),
  11311. 5: uint8(m_ASCII_M),
  11312. }
  11313. func _prolog0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11314. switch tok {
  11315. case int32(m_XML_TOK_PROLOG_S):
  11316. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11317. return int32(_XML_ROLE_NONE)
  11318. case int32(m_XML_TOK_XML_DECL):
  11319. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11320. return int32(_XML_ROLE_XML_DECL)
  11321. case int32(m_XML_TOK_PI):
  11322. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11323. return int32(_XML_ROLE_PI)
  11324. case int32(m_XML_TOK_COMMENT):
  11325. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11326. return int32(_XML_ROLE_COMMENT)
  11327. case int32(m_XML_TOK_BOM):
  11328. return int32(_XML_ROLE_NONE)
  11329. case int32(m_XML_TOK_DECL_OPEN):
  11330. 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) {
  11331. break
  11332. }
  11333. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  11334. return int32(_XML_ROLE_DOCTYPE_NONE)
  11335. case int32(m_XML_TOK_INSTANCE_START):
  11336. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11337. return int32(_XML_ROLE_INSTANCE_START)
  11338. }
  11339. return _common(tls, state, tok)
  11340. }
  11341. func _prolog1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11342. switch tok {
  11343. case int32(m_XML_TOK_PROLOG_S):
  11344. return int32(_XML_ROLE_NONE)
  11345. case int32(m_XML_TOK_PI):
  11346. return int32(_XML_ROLE_PI)
  11347. case int32(m_XML_TOK_COMMENT):
  11348. return int32(_XML_ROLE_COMMENT)
  11349. case int32(m_XML_TOK_BOM):
  11350. /* This case can never arise. To reach this role function, the
  11351. * parse must have passed through prolog0 and therefore have had
  11352. * some form of input, even if only a space. At that point, a
  11353. * byte order mark is no longer a valid character (though
  11354. * technically it should be interpreted as a non-breaking space),
  11355. * so will be rejected by the tokenizing stages.
  11356. */
  11357. return int32(_XML_ROLE_NONE) /* LCOV_EXCL_LINE */
  11358. case int32(m_XML_TOK_DECL_OPEN):
  11359. 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) {
  11360. break
  11361. }
  11362. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  11363. return int32(_XML_ROLE_DOCTYPE_NONE)
  11364. case int32(m_XML_TOK_INSTANCE_START):
  11365. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11366. return int32(_XML_ROLE_INSTANCE_START)
  11367. }
  11368. return _common(tls, state, tok)
  11369. }
  11370. func _prolog2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11371. _ = ptr
  11372. _ = end
  11373. _ = enc
  11374. switch tok {
  11375. case int32(m_XML_TOK_PROLOG_S):
  11376. return int32(_XML_ROLE_NONE)
  11377. case int32(m_XML_TOK_PI):
  11378. return int32(_XML_ROLE_PI)
  11379. case int32(m_XML_TOK_COMMENT):
  11380. return int32(_XML_ROLE_COMMENT)
  11381. case int32(m_XML_TOK_INSTANCE_START):
  11382. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11383. return int32(_XML_ROLE_INSTANCE_START)
  11384. }
  11385. return _common(tls, state, tok)
  11386. }
  11387. func _doctype0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11388. _ = ptr
  11389. _ = end
  11390. _ = enc
  11391. switch tok {
  11392. case int32(m_XML_TOK_PROLOG_S):
  11393. return int32(_XML_ROLE_DOCTYPE_NONE)
  11394. case int32(m_XML_TOK_NAME):
  11395. fallthrough
  11396. case int32(m_XML_TOK_PREFIXED_NAME):
  11397. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype1)
  11398. return int32(_XML_ROLE_DOCTYPE_NAME)
  11399. }
  11400. return _common(tls, state, tok)
  11401. }
  11402. func _doctype1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11403. switch tok {
  11404. case int32(m_XML_TOK_PROLOG_S):
  11405. return int32(_XML_ROLE_DOCTYPE_NONE)
  11406. case int32(m_XML_TOK_OPEN_BRACKET):
  11407. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  11408. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  11409. case int32(m_XML_TOK_DECL_CLOSE):
  11410. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11411. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11412. case int32(m_XML_TOK_NAME):
  11413. 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 {
  11414. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  11415. return int32(_XML_ROLE_DOCTYPE_NONE)
  11416. }
  11417. 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 {
  11418. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype2)
  11419. return int32(_XML_ROLE_DOCTYPE_NONE)
  11420. }
  11421. break
  11422. }
  11423. return _common(tls, state, tok)
  11424. }
  11425. func _doctype2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11426. _ = ptr
  11427. _ = end
  11428. _ = enc
  11429. switch tok {
  11430. case int32(m_XML_TOK_PROLOG_S):
  11431. return int32(_XML_ROLE_DOCTYPE_NONE)
  11432. case int32(m_XML_TOK_LITERAL):
  11433. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  11434. return int32(_XML_ROLE_DOCTYPE_PUBLIC_ID)
  11435. }
  11436. return _common(tls, state, tok)
  11437. }
  11438. func _doctype3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11439. _ = ptr
  11440. _ = end
  11441. _ = enc
  11442. switch tok {
  11443. case int32(m_XML_TOK_PROLOG_S):
  11444. return int32(_XML_ROLE_DOCTYPE_NONE)
  11445. case int32(m_XML_TOK_LITERAL):
  11446. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype4)
  11447. return int32(_XML_ROLE_DOCTYPE_SYSTEM_ID)
  11448. }
  11449. return _common(tls, state, tok)
  11450. }
  11451. func _doctype4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11452. _ = ptr
  11453. _ = end
  11454. _ = enc
  11455. switch tok {
  11456. case int32(m_XML_TOK_PROLOG_S):
  11457. return int32(_XML_ROLE_DOCTYPE_NONE)
  11458. case int32(m_XML_TOK_OPEN_BRACKET):
  11459. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  11460. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  11461. case int32(m_XML_TOK_DECL_CLOSE):
  11462. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11463. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11464. }
  11465. return _common(tls, state, tok)
  11466. }
  11467. func _doctype5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11468. _ = ptr
  11469. _ = end
  11470. _ = enc
  11471. switch tok {
  11472. case int32(m_XML_TOK_PROLOG_S):
  11473. return int32(_XML_ROLE_DOCTYPE_NONE)
  11474. case int32(m_XML_TOK_DECL_CLOSE):
  11475. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11476. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11477. }
  11478. return _common(tls, state, tok)
  11479. }
  11480. func _internalSubset(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11481. switch tok {
  11482. case int32(m_XML_TOK_PROLOG_S):
  11483. return int32(_XML_ROLE_NONE)
  11484. case int32(m_XML_TOK_DECL_OPEN):
  11485. 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 {
  11486. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity0)
  11487. return int32(_XML_ROLE_ENTITY_NONE)
  11488. }
  11489. 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 {
  11490. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist0)
  11491. return int32(_XML_ROLE_ATTLIST_NONE)
  11492. }
  11493. 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 {
  11494. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element0)
  11495. return int32(_XML_ROLE_ELEMENT_NONE)
  11496. }
  11497. 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 {
  11498. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation0)
  11499. return int32(_XML_ROLE_NOTATION_NONE)
  11500. }
  11501. case int32(m_XML_TOK_PI):
  11502. return int32(_XML_ROLE_PI)
  11503. case int32(m_XML_TOK_COMMENT):
  11504. return int32(_XML_ROLE_COMMENT)
  11505. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  11506. return int32(_XML_ROLE_PARAM_ENTITY_REF)
  11507. case int32(m_XML_TOK_CLOSE_BRACKET):
  11508. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype5)
  11509. return int32(_XML_ROLE_DOCTYPE_NONE)
  11510. case -int32(4):
  11511. return int32(_XML_ROLE_NONE)
  11512. }
  11513. return _common(tls, state, tok)
  11514. }
  11515. func _externalSubset0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11516. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  11517. if tok == int32(m_XML_TOK_XML_DECL) {
  11518. return int32(_XML_ROLE_TEXT_DECL)
  11519. }
  11520. return _externalSubset1(tls, state, tok, ptr, end, enc)
  11521. }
  11522. func _externalSubset1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11523. switch tok {
  11524. case int32(m_XML_TOK_COND_SECT_OPEN):
  11525. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect0)
  11526. return int32(_XML_ROLE_NONE)
  11527. case int32(m_XML_TOK_COND_SECT_CLOSE):
  11528. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel == uint32(0) {
  11529. break
  11530. }
  11531. *(*uint32)(unsafe.Pointer(state + 16)) -= uint32(1)
  11532. return int32(_XML_ROLE_NONE)
  11533. case int32(m_XML_TOK_PROLOG_S):
  11534. return int32(_XML_ROLE_NONE)
  11535. case int32(m_XML_TOK_CLOSE_BRACKET):
  11536. case -int32(4):
  11537. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel != 0 {
  11538. break
  11539. }
  11540. return int32(_XML_ROLE_NONE)
  11541. default:
  11542. return _internalSubset(tls, state, tok, ptr, end, enc)
  11543. }
  11544. return _common(tls, state, tok)
  11545. }
  11546. func _entity0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11547. _ = ptr
  11548. _ = end
  11549. _ = enc
  11550. switch tok {
  11551. case int32(m_XML_TOK_PROLOG_S):
  11552. return int32(_XML_ROLE_ENTITY_NONE)
  11553. case int32(m_XML_TOK_PERCENT):
  11554. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity1)
  11555. return int32(_XML_ROLE_ENTITY_NONE)
  11556. case int32(m_XML_TOK_NAME):
  11557. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity2)
  11558. return int32(_XML_ROLE_GENERAL_ENTITY_NAME)
  11559. }
  11560. return _common(tls, state, tok)
  11561. }
  11562. func _entity1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11563. _ = ptr
  11564. _ = end
  11565. _ = enc
  11566. switch tok {
  11567. case int32(m_XML_TOK_PROLOG_S):
  11568. return int32(_XML_ROLE_ENTITY_NONE)
  11569. case int32(m_XML_TOK_NAME):
  11570. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity7)
  11571. return int32(_XML_ROLE_PARAM_ENTITY_NAME)
  11572. }
  11573. return _common(tls, state, tok)
  11574. }
  11575. func _entity2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11576. switch tok {
  11577. case int32(m_XML_TOK_PROLOG_S):
  11578. return int32(_XML_ROLE_ENTITY_NONE)
  11579. case int32(m_XML_TOK_NAME):
  11580. 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 {
  11581. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  11582. return int32(_XML_ROLE_ENTITY_NONE)
  11583. }
  11584. 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 {
  11585. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity3)
  11586. return int32(_XML_ROLE_ENTITY_NONE)
  11587. }
  11588. case int32(m_XML_TOK_LITERAL):
  11589. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11590. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11591. return int32(_XML_ROLE_ENTITY_VALUE)
  11592. }
  11593. return _common(tls, state, tok)
  11594. }
  11595. func _entity3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11596. _ = ptr
  11597. _ = end
  11598. _ = enc
  11599. switch tok {
  11600. case int32(m_XML_TOK_PROLOG_S):
  11601. return int32(_XML_ROLE_ENTITY_NONE)
  11602. case int32(m_XML_TOK_LITERAL):
  11603. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  11604. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  11605. }
  11606. return _common(tls, state, tok)
  11607. }
  11608. func _entity4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11609. _ = ptr
  11610. _ = end
  11611. _ = enc
  11612. switch tok {
  11613. case int32(m_XML_TOK_PROLOG_S):
  11614. return int32(_XML_ROLE_ENTITY_NONE)
  11615. case int32(m_XML_TOK_LITERAL):
  11616. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity5)
  11617. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  11618. }
  11619. return _common(tls, state, tok)
  11620. }
  11621. func _entity5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11622. var v1 uintptr
  11623. _ = v1
  11624. switch tok {
  11625. case int32(m_XML_TOK_PROLOG_S):
  11626. return int32(_XML_ROLE_ENTITY_NONE)
  11627. case int32(m_XML_TOK_DECL_CLOSE):
  11628. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11629. v1 = __ccgo_fp(_internalSubset)
  11630. } else {
  11631. v1 = __ccgo_fp(_externalSubset1)
  11632. }
  11633. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11634. return int32(_XML_ROLE_ENTITY_COMPLETE)
  11635. case int32(m_XML_TOK_NAME):
  11636. 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 {
  11637. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity6)
  11638. return int32(_XML_ROLE_ENTITY_NONE)
  11639. }
  11640. break
  11641. }
  11642. return _common(tls, state, tok)
  11643. }
  11644. func _entity6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11645. _ = ptr
  11646. _ = end
  11647. _ = enc
  11648. switch tok {
  11649. case int32(m_XML_TOK_PROLOG_S):
  11650. return int32(_XML_ROLE_ENTITY_NONE)
  11651. case int32(m_XML_TOK_NAME):
  11652. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11653. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11654. return int32(_XML_ROLE_ENTITY_NOTATION_NAME)
  11655. }
  11656. return _common(tls, state, tok)
  11657. }
  11658. func _entity7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11659. switch tok {
  11660. case int32(m_XML_TOK_PROLOG_S):
  11661. return int32(_XML_ROLE_ENTITY_NONE)
  11662. case int32(m_XML_TOK_NAME):
  11663. 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 {
  11664. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  11665. return int32(_XML_ROLE_ENTITY_NONE)
  11666. }
  11667. 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 {
  11668. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity8)
  11669. return int32(_XML_ROLE_ENTITY_NONE)
  11670. }
  11671. case int32(m_XML_TOK_LITERAL):
  11672. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11673. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11674. return int32(_XML_ROLE_ENTITY_VALUE)
  11675. }
  11676. return _common(tls, state, tok)
  11677. }
  11678. func _entity8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11679. _ = ptr
  11680. _ = end
  11681. _ = enc
  11682. switch tok {
  11683. case int32(m_XML_TOK_PROLOG_S):
  11684. return int32(_XML_ROLE_ENTITY_NONE)
  11685. case int32(m_XML_TOK_LITERAL):
  11686. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  11687. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  11688. }
  11689. return _common(tls, state, tok)
  11690. }
  11691. func _entity9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11692. _ = ptr
  11693. _ = end
  11694. _ = enc
  11695. switch tok {
  11696. case int32(m_XML_TOK_PROLOG_S):
  11697. return int32(_XML_ROLE_ENTITY_NONE)
  11698. case int32(m_XML_TOK_LITERAL):
  11699. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity10)
  11700. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  11701. }
  11702. return _common(tls, state, tok)
  11703. }
  11704. func _entity10(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11705. var v1 uintptr
  11706. _ = v1
  11707. _ = ptr
  11708. _ = end
  11709. _ = enc
  11710. switch tok {
  11711. case int32(m_XML_TOK_PROLOG_S):
  11712. return int32(_XML_ROLE_ENTITY_NONE)
  11713. case int32(m_XML_TOK_DECL_CLOSE):
  11714. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11715. v1 = __ccgo_fp(_internalSubset)
  11716. } else {
  11717. v1 = __ccgo_fp(_externalSubset1)
  11718. }
  11719. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11720. return int32(_XML_ROLE_ENTITY_COMPLETE)
  11721. }
  11722. return _common(tls, state, tok)
  11723. }
  11724. func _notation0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11725. _ = ptr
  11726. _ = end
  11727. _ = enc
  11728. switch tok {
  11729. case int32(m_XML_TOK_PROLOG_S):
  11730. return int32(_XML_ROLE_NOTATION_NONE)
  11731. case int32(m_XML_TOK_NAME):
  11732. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation1)
  11733. return int32(_XML_ROLE_NOTATION_NAME)
  11734. }
  11735. return _common(tls, state, tok)
  11736. }
  11737. func _notation1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11738. switch tok {
  11739. case int32(m_XML_TOK_PROLOG_S):
  11740. return int32(_XML_ROLE_NOTATION_NONE)
  11741. case int32(m_XML_TOK_NAME):
  11742. 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 {
  11743. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation3)
  11744. return int32(_XML_ROLE_NOTATION_NONE)
  11745. }
  11746. 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 {
  11747. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation2)
  11748. return int32(_XML_ROLE_NOTATION_NONE)
  11749. }
  11750. break
  11751. }
  11752. return _common(tls, state, tok)
  11753. }
  11754. func _notation2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11755. _ = ptr
  11756. _ = end
  11757. _ = enc
  11758. switch tok {
  11759. case int32(m_XML_TOK_PROLOG_S):
  11760. return int32(_XML_ROLE_NOTATION_NONE)
  11761. case int32(m_XML_TOK_LITERAL):
  11762. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation4)
  11763. return int32(_XML_ROLE_NOTATION_PUBLIC_ID)
  11764. }
  11765. return _common(tls, state, tok)
  11766. }
  11767. func _notation3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11768. _ = ptr
  11769. _ = end
  11770. _ = enc
  11771. switch tok {
  11772. case int32(m_XML_TOK_PROLOG_S):
  11773. return int32(_XML_ROLE_NOTATION_NONE)
  11774. case int32(m_XML_TOK_LITERAL):
  11775. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11776. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  11777. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  11778. }
  11779. return _common(tls, state, tok)
  11780. }
  11781. func _notation4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11782. var v1 uintptr
  11783. _ = v1
  11784. _ = ptr
  11785. _ = end
  11786. _ = enc
  11787. switch tok {
  11788. case int32(m_XML_TOK_PROLOG_S):
  11789. return int32(_XML_ROLE_NOTATION_NONE)
  11790. case int32(m_XML_TOK_LITERAL):
  11791. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11792. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  11793. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  11794. case int32(m_XML_TOK_DECL_CLOSE):
  11795. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11796. v1 = __ccgo_fp(_internalSubset)
  11797. } else {
  11798. v1 = __ccgo_fp(_externalSubset1)
  11799. }
  11800. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11801. return int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID)
  11802. }
  11803. return _common(tls, state, tok)
  11804. }
  11805. func _attlist0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11806. _ = ptr
  11807. _ = end
  11808. _ = enc
  11809. switch tok {
  11810. case int32(m_XML_TOK_PROLOG_S):
  11811. return int32(_XML_ROLE_ATTLIST_NONE)
  11812. case int32(m_XML_TOK_NAME):
  11813. fallthrough
  11814. case int32(m_XML_TOK_PREFIXED_NAME):
  11815. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11816. return int32(_XML_ROLE_ATTLIST_ELEMENT_NAME)
  11817. }
  11818. return _common(tls, state, tok)
  11819. }
  11820. func _attlist1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11821. var v1 uintptr
  11822. _ = v1
  11823. _ = ptr
  11824. _ = end
  11825. _ = enc
  11826. switch tok {
  11827. case int32(m_XML_TOK_PROLOG_S):
  11828. return int32(_XML_ROLE_ATTLIST_NONE)
  11829. case int32(m_XML_TOK_DECL_CLOSE):
  11830. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11831. v1 = __ccgo_fp(_internalSubset)
  11832. } else {
  11833. v1 = __ccgo_fp(_externalSubset1)
  11834. }
  11835. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11836. return int32(_XML_ROLE_ATTLIST_NONE)
  11837. case int32(m_XML_TOK_NAME):
  11838. fallthrough
  11839. case int32(m_XML_TOK_PREFIXED_NAME):
  11840. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist2)
  11841. return int32(_XML_ROLE_ATTRIBUTE_NAME)
  11842. }
  11843. return _common(tls, state, tok)
  11844. }
  11845. func _attlist2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11846. var i int32
  11847. _ = i
  11848. switch tok {
  11849. case int32(m_XML_TOK_PROLOG_S):
  11850. return int32(_XML_ROLE_ATTLIST_NONE)
  11851. case int32(m_XML_TOK_NAME):
  11852. i = 0
  11853. for {
  11854. if !(i < libc.Int32FromUint64(libc.Uint64FromInt64(64)/libc.Uint64FromInt64(8))) {
  11855. break
  11856. }
  11857. 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 {
  11858. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  11859. return int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA) + i
  11860. }
  11861. goto _1
  11862. _1:
  11863. ;
  11864. i++
  11865. }
  11866. 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 {
  11867. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist5)
  11868. return int32(_XML_ROLE_ATTLIST_NONE)
  11869. }
  11870. case int32(m_XML_TOK_OPEN_PAREN):
  11871. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  11872. return int32(_XML_ROLE_ATTLIST_NONE)
  11873. }
  11874. return _common(tls, state, tok)
  11875. }
  11876. var _types = [8]uintptr{
  11877. 0: uintptr(unsafe.Pointer(&_KW_CDATA)),
  11878. 1: uintptr(unsafe.Pointer(&_KW_ID)),
  11879. 2: uintptr(unsafe.Pointer(&_KW_IDREF)),
  11880. 3: uintptr(unsafe.Pointer(&_KW_IDREFS)),
  11881. 4: uintptr(unsafe.Pointer(&_KW_ENTITY)),
  11882. 5: uintptr(unsafe.Pointer(&_KW_ENTITIES)),
  11883. 6: uintptr(unsafe.Pointer(&_KW_NMTOKEN)),
  11884. 7: uintptr(unsafe.Pointer(&_KW_NMTOKENS)),
  11885. }
  11886. func _attlist3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11887. _ = ptr
  11888. _ = end
  11889. _ = enc
  11890. switch tok {
  11891. case int32(m_XML_TOK_PROLOG_S):
  11892. return int32(_XML_ROLE_ATTLIST_NONE)
  11893. case int32(m_XML_TOK_NMTOKEN):
  11894. fallthrough
  11895. case int32(m_XML_TOK_NAME):
  11896. fallthrough
  11897. case int32(m_XML_TOK_PREFIXED_NAME):
  11898. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist4)
  11899. return int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE)
  11900. }
  11901. return _common(tls, state, tok)
  11902. }
  11903. func _attlist4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11904. _ = ptr
  11905. _ = end
  11906. _ = enc
  11907. switch tok {
  11908. case int32(m_XML_TOK_PROLOG_S):
  11909. return int32(_XML_ROLE_ATTLIST_NONE)
  11910. case int32(m_XML_TOK_CLOSE_PAREN):
  11911. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  11912. return int32(_XML_ROLE_ATTLIST_NONE)
  11913. case int32(m_XML_TOK_OR):
  11914. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  11915. return int32(_XML_ROLE_ATTLIST_NONE)
  11916. }
  11917. return _common(tls, state, tok)
  11918. }
  11919. func _attlist5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11920. _ = ptr
  11921. _ = end
  11922. _ = enc
  11923. switch tok {
  11924. case int32(m_XML_TOK_PROLOG_S):
  11925. return int32(_XML_ROLE_ATTLIST_NONE)
  11926. case int32(m_XML_TOK_OPEN_PAREN):
  11927. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  11928. return int32(_XML_ROLE_ATTLIST_NONE)
  11929. }
  11930. return _common(tls, state, tok)
  11931. }
  11932. func _attlist6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11933. _ = ptr
  11934. _ = end
  11935. _ = enc
  11936. switch tok {
  11937. case int32(m_XML_TOK_PROLOG_S):
  11938. return int32(_XML_ROLE_ATTLIST_NONE)
  11939. case int32(m_XML_TOK_NAME):
  11940. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist7)
  11941. return int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE)
  11942. }
  11943. return _common(tls, state, tok)
  11944. }
  11945. func _attlist7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11946. _ = ptr
  11947. _ = end
  11948. _ = enc
  11949. switch tok {
  11950. case int32(m_XML_TOK_PROLOG_S):
  11951. return int32(_XML_ROLE_ATTLIST_NONE)
  11952. case int32(m_XML_TOK_CLOSE_PAREN):
  11953. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  11954. return int32(_XML_ROLE_ATTLIST_NONE)
  11955. case int32(m_XML_TOK_OR):
  11956. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  11957. return int32(_XML_ROLE_ATTLIST_NONE)
  11958. }
  11959. return _common(tls, state, tok)
  11960. }
  11961. // C documentation
  11962. //
  11963. // /* default value */
  11964. func _attlist8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11965. switch tok {
  11966. case int32(m_XML_TOK_PROLOG_S):
  11967. return int32(_XML_ROLE_ATTLIST_NONE)
  11968. case int32(m_XML_TOK_POUND_NAME):
  11969. 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 {
  11970. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11971. return int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE)
  11972. }
  11973. 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 {
  11974. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11975. return int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE)
  11976. }
  11977. 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 {
  11978. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist9)
  11979. return int32(_XML_ROLE_ATTLIST_NONE)
  11980. }
  11981. case int32(m_XML_TOK_LITERAL):
  11982. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11983. return int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE)
  11984. }
  11985. return _common(tls, state, tok)
  11986. }
  11987. func _attlist9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11988. _ = ptr
  11989. _ = end
  11990. _ = enc
  11991. switch tok {
  11992. case int32(m_XML_TOK_PROLOG_S):
  11993. return int32(_XML_ROLE_ATTLIST_NONE)
  11994. case int32(m_XML_TOK_LITERAL):
  11995. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11996. return int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE)
  11997. }
  11998. return _common(tls, state, tok)
  11999. }
  12000. func _element0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12001. _ = ptr
  12002. _ = end
  12003. _ = enc
  12004. switch tok {
  12005. case int32(m_XML_TOK_PROLOG_S):
  12006. return int32(_XML_ROLE_ELEMENT_NONE)
  12007. case int32(m_XML_TOK_NAME):
  12008. fallthrough
  12009. case int32(m_XML_TOK_PREFIXED_NAME):
  12010. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element1)
  12011. return int32(_XML_ROLE_ELEMENT_NAME)
  12012. }
  12013. return _common(tls, state, tok)
  12014. }
  12015. func _element1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12016. switch tok {
  12017. case int32(m_XML_TOK_PROLOG_S):
  12018. return int32(_XML_ROLE_ELEMENT_NONE)
  12019. case int32(m_XML_TOK_NAME):
  12020. 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 {
  12021. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12022. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12023. return int32(_XML_ROLE_CONTENT_EMPTY)
  12024. }
  12025. 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 {
  12026. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12027. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12028. return int32(_XML_ROLE_CONTENT_ANY)
  12029. }
  12030. case int32(m_XML_TOK_OPEN_PAREN):
  12031. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element2)
  12032. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(1)
  12033. return int32(_XML_ROLE_GROUP_OPEN)
  12034. }
  12035. return _common(tls, state, tok)
  12036. }
  12037. func _element2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12038. switch tok {
  12039. case int32(m_XML_TOK_PROLOG_S):
  12040. return int32(_XML_ROLE_ELEMENT_NONE)
  12041. case int32(m_XML_TOK_POUND_NAME):
  12042. 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 {
  12043. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element3)
  12044. return int32(_XML_ROLE_CONTENT_PCDATA)
  12045. }
  12046. case int32(m_XML_TOK_OPEN_PAREN):
  12047. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(2)
  12048. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12049. return int32(_XML_ROLE_GROUP_OPEN)
  12050. case int32(m_XML_TOK_NAME):
  12051. fallthrough
  12052. case int32(m_XML_TOK_PREFIXED_NAME):
  12053. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12054. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12055. case int32(m_XML_TOK_NAME_QUESTION):
  12056. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12057. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  12058. case int32(m_XML_TOK_NAME_ASTERISK):
  12059. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12060. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  12061. case int32(m_XML_TOK_NAME_PLUS):
  12062. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12063. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  12064. }
  12065. return _common(tls, state, tok)
  12066. }
  12067. func _element3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12068. _ = ptr
  12069. _ = end
  12070. _ = enc
  12071. switch tok {
  12072. case int32(m_XML_TOK_PROLOG_S):
  12073. return int32(_XML_ROLE_ELEMENT_NONE)
  12074. case int32(m_XML_TOK_CLOSE_PAREN):
  12075. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12076. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12077. return int32(_XML_ROLE_GROUP_CLOSE)
  12078. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12079. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12080. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12081. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12082. case int32(m_XML_TOK_OR):
  12083. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  12084. return int32(_XML_ROLE_ELEMENT_NONE)
  12085. }
  12086. return _common(tls, state, tok)
  12087. }
  12088. func _element4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12089. _ = ptr
  12090. _ = end
  12091. _ = enc
  12092. switch tok {
  12093. case int32(m_XML_TOK_PROLOG_S):
  12094. return int32(_XML_ROLE_ELEMENT_NONE)
  12095. case int32(m_XML_TOK_NAME):
  12096. fallthrough
  12097. case int32(m_XML_TOK_PREFIXED_NAME):
  12098. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element5)
  12099. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12100. }
  12101. return _common(tls, state, tok)
  12102. }
  12103. func _element5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12104. _ = ptr
  12105. _ = end
  12106. _ = enc
  12107. switch tok {
  12108. case int32(m_XML_TOK_PROLOG_S):
  12109. return int32(_XML_ROLE_ELEMENT_NONE)
  12110. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12111. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12112. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12113. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12114. case int32(m_XML_TOK_OR):
  12115. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  12116. return int32(_XML_ROLE_ELEMENT_NONE)
  12117. }
  12118. return _common(tls, state, tok)
  12119. }
  12120. func _element6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12121. _ = ptr
  12122. _ = end
  12123. _ = enc
  12124. switch tok {
  12125. case int32(m_XML_TOK_PROLOG_S):
  12126. return int32(_XML_ROLE_ELEMENT_NONE)
  12127. case int32(m_XML_TOK_OPEN_PAREN):
  12128. *(*uint32)(unsafe.Pointer(state + 8)) += uint32(1)
  12129. return int32(_XML_ROLE_GROUP_OPEN)
  12130. case int32(m_XML_TOK_NAME):
  12131. fallthrough
  12132. case int32(m_XML_TOK_PREFIXED_NAME):
  12133. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12134. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12135. case int32(m_XML_TOK_NAME_QUESTION):
  12136. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12137. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  12138. case int32(m_XML_TOK_NAME_ASTERISK):
  12139. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12140. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  12141. case int32(m_XML_TOK_NAME_PLUS):
  12142. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12143. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  12144. }
  12145. return _common(tls, state, tok)
  12146. }
  12147. func _element7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12148. _ = ptr
  12149. _ = end
  12150. _ = enc
  12151. switch tok {
  12152. case int32(m_XML_TOK_PROLOG_S):
  12153. return int32(_XML_ROLE_ELEMENT_NONE)
  12154. case int32(m_XML_TOK_CLOSE_PAREN):
  12155. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12156. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12157. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12158. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12159. }
  12160. return int32(_XML_ROLE_GROUP_CLOSE)
  12161. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12162. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12163. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12164. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12165. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12166. }
  12167. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12168. case int32(m_XML_TOK_CLOSE_PAREN_QUESTION):
  12169. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12170. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12171. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12172. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12173. }
  12174. return int32(_XML_ROLE_GROUP_CLOSE_OPT)
  12175. case int32(m_XML_TOK_CLOSE_PAREN_PLUS):
  12176. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12177. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12178. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12179. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12180. }
  12181. return int32(_XML_ROLE_GROUP_CLOSE_PLUS)
  12182. case int32(m_XML_TOK_COMMA):
  12183. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12184. return int32(_XML_ROLE_GROUP_SEQUENCE)
  12185. case int32(m_XML_TOK_OR):
  12186. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12187. return int32(_XML_ROLE_GROUP_CHOICE)
  12188. }
  12189. return _common(tls, state, tok)
  12190. }
  12191. func _condSect0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12192. switch tok {
  12193. case int32(m_XML_TOK_PROLOG_S):
  12194. return int32(_XML_ROLE_NONE)
  12195. case int32(m_XML_TOK_NAME):
  12196. 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 {
  12197. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect1)
  12198. return int32(_XML_ROLE_NONE)
  12199. }
  12200. 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 {
  12201. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect2)
  12202. return int32(_XML_ROLE_NONE)
  12203. }
  12204. break
  12205. }
  12206. return _common(tls, state, tok)
  12207. }
  12208. func _condSect1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12209. _ = ptr
  12210. _ = end
  12211. _ = enc
  12212. switch tok {
  12213. case int32(m_XML_TOK_PROLOG_S):
  12214. return int32(_XML_ROLE_NONE)
  12215. case int32(m_XML_TOK_OPEN_BRACKET):
  12216. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  12217. *(*uint32)(unsafe.Pointer(state + 16)) += uint32(1)
  12218. return int32(_XML_ROLE_NONE)
  12219. }
  12220. return _common(tls, state, tok)
  12221. }
  12222. func _condSect2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12223. _ = ptr
  12224. _ = end
  12225. _ = enc
  12226. switch tok {
  12227. case int32(m_XML_TOK_PROLOG_S):
  12228. return int32(_XML_ROLE_NONE)
  12229. case int32(m_XML_TOK_OPEN_BRACKET):
  12230. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  12231. return int32(_XML_ROLE_IGNORE_SECT)
  12232. }
  12233. return _common(tls, state, tok)
  12234. }
  12235. func _declClose(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12236. var v1 uintptr
  12237. _ = v1
  12238. _ = ptr
  12239. _ = end
  12240. _ = enc
  12241. switch tok {
  12242. case int32(m_XML_TOK_PROLOG_S):
  12243. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  12244. case int32(m_XML_TOK_DECL_CLOSE):
  12245. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  12246. v1 = __ccgo_fp(_internalSubset)
  12247. } else {
  12248. v1 = __ccgo_fp(_externalSubset1)
  12249. }
  12250. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  12251. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  12252. }
  12253. return _common(tls, state, tok)
  12254. }
  12255. // C documentation
  12256. //
  12257. // /* This function will only be invoked if the internal logic of the
  12258. // * parser has broken down. It is used in two cases:
  12259. // *
  12260. // * 1: When the XML prolog has been finished. At this point the
  12261. // * processor (the parser level above these role handlers) should
  12262. // * switch from prologProcessor to contentProcessor and reinitialise
  12263. // * the handler function.
  12264. // *
  12265. // * 2: When an error has been detected (via common() below). At this
  12266. // * point again the processor should be switched to errorProcessor,
  12267. // * which will never call a handler.
  12268. // *
  12269. // * The result of this is that error() can only be called if the
  12270. // * processor switch failed to happen, which is an internal error and
  12271. // * therefore we shouldn't be able to provoke it simply by using the
  12272. // * library. It is a necessary backstop, however, so we merely exclude
  12273. // * it from the coverage statistics.
  12274. // *
  12275. // * LCOV_EXCL_START
  12276. // */
  12277. func _error(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12278. _ = state
  12279. _ = tok
  12280. _ = ptr
  12281. _ = end
  12282. _ = enc
  12283. return int32(_XML_ROLE_NONE)
  12284. }
  12285. /* LCOV_EXCL_STOP */
  12286. func _common(tls *libc.TLS, state uintptr, tok int32) (r int32) {
  12287. if !((*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0) && tok == int32(m_XML_TOK_PARAM_ENTITY_REF) {
  12288. return int32(_XML_ROLE_INNER_PARAM_ENTITY_REF)
  12289. }
  12290. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  12291. return int32(_XML_ROLE_ERROR)
  12292. }
  12293. func XXmlPrologStateInit(tls *libc.TLS, state uintptr) {
  12294. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog0)
  12295. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = int32(1)
  12296. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  12297. (*TPROLOG_STATE)(unsafe.Pointer(state)).FinEntityValue = 0
  12298. }
  12299. func XXmlPrologStateInitExternalEntity(tls *libc.TLS, state uintptr) {
  12300. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset0)
  12301. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = 0
  12302. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  12303. }
  12304. const m_ASCII_02 = 48
  12305. const m_ASCII_12 = 49
  12306. const m_ASCII_22 = 50
  12307. const m_ASCII_32 = 51
  12308. const m_ASCII_41 = 52
  12309. const m_ASCII_51 = 53
  12310. const m_ASCII_61 = 54
  12311. const m_ASCII_71 = 55
  12312. const m_ASCII_82 = 56
  12313. const m_ASCII_92 = 57
  12314. const m_ASCII_AMP1 = 38
  12315. const m_ASCII_APOS1 = 39
  12316. const m_ASCII_COLON2 = 58
  12317. const m_ASCII_EQUALS2 = 61
  12318. const m_ASCII_EXCL2 = 33
  12319. const m_ASCII_G2 = 0x47
  12320. const m_ASCII_GT1 = 62
  12321. const m_ASCII_K1 = 0x4B
  12322. const m_ASCII_LSQB1 = 91
  12323. const m_ASCII_LT1 = 60
  12324. const m_ASCII_MINUS1 = 45
  12325. const m_ASCII_N1 = 0x4E
  12326. const m_ASCII_P2 = 0x50
  12327. const m_ASCII_PERIOD2 = 46
  12328. const m_ASCII_Q2 = 0x51
  12329. const m_ASCII_QUOT1 = 34
  12330. const m_ASCII_R1 = 0x52
  12331. const m_ASCII_RSQB1 = 93
  12332. const m_ASCII_SEMI1 = 59
  12333. const m_ASCII_SPACE1 = 32
  12334. const m_ASCII_TAB1 = 9
  12335. const m_ASCII_UNDERSCORE1 = 95
  12336. const m_ASCII_Y1 = 0x59
  12337. const m_ASCII_Z1 = 90
  12338. const m_ASCII_a2 = 97
  12339. const m_ASCII_b1 = 98
  12340. const m_ASCII_c2 = 99
  12341. const m_ASCII_d1 = 100
  12342. const m_ASCII_e2 = 101
  12343. const m_ASCII_f1 = 102
  12344. const m_ASCII_g2 = 103
  12345. const m_ASCII_i1 = 105
  12346. const m_ASCII_l2 = 108
  12347. const m_ASCII_m2 = 109
  12348. const m_ASCII_n2 = 110
  12349. const m_ASCII_o2 = 111
  12350. const m_ASCII_p2 = 112
  12351. const m_ASCII_q1 = 113
  12352. const m_ASCII_r2 = 114
  12353. const m_ASCII_s2 = 115
  12354. const m_ASCII_t2 = 116
  12355. const m_ASCII_u1 = 117
  12356. const m_ASCII_v1 = 118
  12357. const m_ASCII_x2 = 120
  12358. const m_ASCII_y1 = 121
  12359. const m_ASCII_z1 = 122
  12360. const m_ENCODING_MAX = 128
  12361. const m___bool_true_false_are_defined = 1
  12362. const m_bool = "_Bool"
  12363. const m_false = 0
  12364. const m_true = 1
  12365. const m_utf8_isName4 = "isNever"
  12366. const m_utf8_isNmstrt4 = "isNever"
  12367. var _namingBitmap = [320]uint32{
  12368. 8: uint32(0xFFFFFFFF),
  12369. 9: uint32(0xFFFFFFFF),
  12370. 10: uint32(0xFFFFFFFF),
  12371. 11: uint32(0xFFFFFFFF),
  12372. 12: uint32(0xFFFFFFFF),
  12373. 13: uint32(0xFFFFFFFF),
  12374. 14: uint32(0xFFFFFFFF),
  12375. 15: uint32(0xFFFFFFFF),
  12376. 17: uint32(0x04000000),
  12377. 18: uint32(0x87FFFFFE),
  12378. 19: uint32(0x07FFFFFE),
  12379. 22: uint32(0xFF7FFFFF),
  12380. 23: uint32(0xFF7FFFFF),
  12381. 24: uint32(0xFFFFFFFF),
  12382. 25: uint32(0x7FF3FFFF),
  12383. 26: uint32(0xFFFFFDFE),
  12384. 27: uint32(0x7FFFFFFF),
  12385. 28: uint32(0xFFFFFFFF),
  12386. 29: uint32(0xFFFFFFFF),
  12387. 30: uint32(0xFFFFE00F),
  12388. 31: uint32(0xFC31FFFF),
  12389. 32: uint32(0x00FFFFFF),
  12390. 34: uint32(0xFFFF0000),
  12391. 35: uint32(0xFFFFFFFF),
  12392. 36: uint32(0xFFFFFFFF),
  12393. 37: uint32(0xF80001FF),
  12394. 38: uint32(0x00000003),
  12395. 44: uint32(0xFFFFD740),
  12396. 45: uint32(0xFFFFFFFB),
  12397. 46: uint32(0x547F7FFF),
  12398. 47: uint32(0x000FFFFD),
  12399. 48: uint32(0xFFFFDFFE),
  12400. 49: uint32(0xFFFFFFFF),
  12401. 50: uint32(0xDFFEFFFF),
  12402. 51: uint32(0xFFFFFFFF),
  12403. 52: uint32(0xFFFF0003),
  12404. 53: uint32(0xFFFFFFFF),
  12405. 54: uint32(0xFFFF199F),
  12406. 55: uint32(0x033FCFFF),
  12407. 57: uint32(0xFFFE0000),
  12408. 58: uint32(0x027FFFFF),
  12409. 59: uint32(0xFFFFFFFE),
  12410. 60: uint32(0x0000007F),
  12411. 62: uint32(0xFFFF0000),
  12412. 63: uint32(0x000707FF),
  12413. 65: uint32(0x07FFFFFE),
  12414. 66: uint32(0x000007FE),
  12415. 67: uint32(0xFFFE0000),
  12416. 68: uint32(0xFFFFFFFF),
  12417. 69: uint32(0x7CFFFFFF),
  12418. 70: uint32(0x002F7FFF),
  12419. 71: uint32(0x00000060),
  12420. 72: uint32(0xFFFFFFE0),
  12421. 73: uint32(0x23FFFFFF),
  12422. 74: uint32(0xFF000000),
  12423. 75: uint32(0x00000003),
  12424. 76: uint32(0xFFF99FE0),
  12425. 77: uint32(0x03C5FDFF),
  12426. 78: uint32(0xB0000000),
  12427. 79: uint32(0x00030003),
  12428. 80: uint32(0xFFF987E0),
  12429. 81: uint32(0x036DFDFF),
  12430. 82: uint32(0x5E000000),
  12431. 83: uint32(0x001C0000),
  12432. 84: uint32(0xFFFBAFE0),
  12433. 85: uint32(0x23EDFDFF),
  12434. 87: uint32(0x00000001),
  12435. 88: uint32(0xFFF99FE0),
  12436. 89: uint32(0x23CDFDFF),
  12437. 90: uint32(0xB0000000),
  12438. 91: uint32(0x00000003),
  12439. 92: uint32(0xD63DC7E0),
  12440. 93: uint32(0x03BFC718),
  12441. 96: uint32(0xFFFDDFE0),
  12442. 97: uint32(0x03EFFDFF),
  12443. 99: uint32(0x00000003),
  12444. 100: uint32(0xFFFDDFE0),
  12445. 101: uint32(0x03EFFDFF),
  12446. 102: uint32(0x40000000),
  12447. 103: uint32(0x00000003),
  12448. 104: uint32(0xFFFDDFE0),
  12449. 105: uint32(0x03FFFDFF),
  12450. 107: uint32(0x00000003),
  12451. 112: uint32(0xFFFFFFFE),
  12452. 113: uint32(0x000D7FFF),
  12453. 114: uint32(0x0000003F),
  12454. 116: uint32(0xFEF02596),
  12455. 117: uint32(0x200D6CAE),
  12456. 118: uint32(0x0000001F),
  12457. 122: uint32(0xFFFFFEFF),
  12458. 123: uint32(0x000003FF),
  12459. 133: uint32(0xFFFFFFFF),
  12460. 134: uint32(0xFFFF003F),
  12461. 135: uint32(0x007FFFFF),
  12462. 136: uint32(0x0007DAED),
  12463. 137: uint32(0x50000000),
  12464. 138: uint32(0x82315001),
  12465. 139: uint32(0x002C62AB),
  12466. 140: uint32(0x40000000),
  12467. 141: uint32(0xF580C900),
  12468. 142: uint32(0x00000007),
  12469. 143: uint32(0x02010800),
  12470. 144: uint32(0xFFFFFFFF),
  12471. 145: uint32(0xFFFFFFFF),
  12472. 146: uint32(0xFFFFFFFF),
  12473. 147: uint32(0xFFFFFFFF),
  12474. 148: uint32(0x0FFFFFFF),
  12475. 149: uint32(0xFFFFFFFF),
  12476. 150: uint32(0xFFFFFFFF),
  12477. 151: uint32(0x03FFFFFF),
  12478. 152: uint32(0x3F3FFFFF),
  12479. 153: uint32(0xFFFFFFFF),
  12480. 154: uint32(0xAAFF3F3F),
  12481. 155: uint32(0x3FFFFFFF),
  12482. 156: uint32(0xFFFFFFFF),
  12483. 157: uint32(0x5FDFFFFF),
  12484. 158: uint32(0x0FCF1FDC),
  12485. 159: uint32(0x1FDC1FFF),
  12486. 161: uint32(0x00004C40),
  12487. 164: uint32(0x00000007),
  12488. 168: uint32(0x00000080),
  12489. 169: uint32(0x000003FE),
  12490. 170: uint32(0xFFFFFFFE),
  12491. 171: uint32(0xFFFFFFFF),
  12492. 172: uint32(0x001FFFFF),
  12493. 173: uint32(0xFFFFFFFE),
  12494. 174: uint32(0xFFFFFFFF),
  12495. 175: uint32(0x07FFFFFF),
  12496. 176: uint32(0xFFFFFFE0),
  12497. 177: uint32(0x00001FFF),
  12498. 184: uint32(0xFFFFFFFF),
  12499. 185: uint32(0xFFFFFFFF),
  12500. 186: uint32(0xFFFFFFFF),
  12501. 187: uint32(0xFFFFFFFF),
  12502. 188: uint32(0xFFFFFFFF),
  12503. 189: uint32(0x0000003F),
  12504. 192: uint32(0xFFFFFFFF),
  12505. 193: uint32(0xFFFFFFFF),
  12506. 194: uint32(0xFFFFFFFF),
  12507. 195: uint32(0xFFFFFFFF),
  12508. 196: uint32(0xFFFFFFFF),
  12509. 197: uint32(0x0000000F),
  12510. 201: uint32(0x07FF6000),
  12511. 202: uint32(0x87FFFFFE),
  12512. 203: uint32(0x07FFFFFE),
  12513. 205: uint32(0x00800000),
  12514. 206: uint32(0xFF7FFFFF),
  12515. 207: uint32(0xFF7FFFFF),
  12516. 208: uint32(0x00FFFFFF),
  12517. 210: uint32(0xFFFF0000),
  12518. 211: uint32(0xFFFFFFFF),
  12519. 212: uint32(0xFFFFFFFF),
  12520. 213: uint32(0xF80001FF),
  12521. 214: uint32(0x00030003),
  12522. 216: uint32(0xFFFFFFFF),
  12523. 217: uint32(0xFFFFFFFF),
  12524. 218: uint32(0x0000003F),
  12525. 219: uint32(0x00000003),
  12526. 220: uint32(0xFFFFD7C0),
  12527. 221: uint32(0xFFFFFFFB),
  12528. 222: uint32(0x547F7FFF),
  12529. 223: uint32(0x000FFFFD),
  12530. 224: uint32(0xFFFFDFFE),
  12531. 225: uint32(0xFFFFFFFF),
  12532. 226: uint32(0xDFFEFFFF),
  12533. 227: uint32(0xFFFFFFFF),
  12534. 228: uint32(0xFFFF007B),
  12535. 229: uint32(0xFFFFFFFF),
  12536. 230: uint32(0xFFFF199F),
  12537. 231: uint32(0x033FCFFF),
  12538. 233: uint32(0xFFFE0000),
  12539. 234: uint32(0x027FFFFF),
  12540. 235: uint32(0xFFFFFFFE),
  12541. 236: uint32(0xFFFE007F),
  12542. 237: uint32(0xBBFFFFFB),
  12543. 238: uint32(0xFFFF0016),
  12544. 239: uint32(0x000707FF),
  12545. 241: uint32(0x07FFFFFE),
  12546. 242: uint32(0x0007FFFF),
  12547. 243: uint32(0xFFFF03FF),
  12548. 244: uint32(0xFFFFFFFF),
  12549. 245: uint32(0x7CFFFFFF),
  12550. 246: uint32(0xFFEF7FFF),
  12551. 247: uint32(0x03FF3DFF),
  12552. 248: uint32(0xFFFFFFEE),
  12553. 249: uint32(0xF3FFFFFF),
  12554. 250: uint32(0xFF1E3FFF),
  12555. 251: uint32(0x0000FFCF),
  12556. 252: uint32(0xFFF99FEE),
  12557. 253: uint32(0xD3C5FDFF),
  12558. 254: uint32(0xB080399F),
  12559. 255: uint32(0x0003FFCF),
  12560. 256: uint32(0xFFF987E4),
  12561. 257: uint32(0xD36DFDFF),
  12562. 258: uint32(0x5E003987),
  12563. 259: uint32(0x001FFFC0),
  12564. 260: uint32(0xFFFBAFEE),
  12565. 261: uint32(0xF3EDFDFF),
  12566. 262: uint32(0x00003BBF),
  12567. 263: uint32(0x0000FFC1),
  12568. 264: uint32(0xFFF99FEE),
  12569. 265: uint32(0xF3CDFDFF),
  12570. 266: uint32(0xB0C0398F),
  12571. 267: uint32(0x0000FFC3),
  12572. 268: uint32(0xD63DC7EC),
  12573. 269: uint32(0xC3BFC718),
  12574. 270: uint32(0x00803DC7),
  12575. 271: uint32(0x0000FF80),
  12576. 272: uint32(0xFFFDDFEE),
  12577. 273: uint32(0xC3EFFDFF),
  12578. 274: uint32(0x00603DDF),
  12579. 275: uint32(0x0000FFC3),
  12580. 276: uint32(0xFFFDDFEC),
  12581. 277: uint32(0xC3EFFDFF),
  12582. 278: uint32(0x40603DDF),
  12583. 279: uint32(0x0000FFC3),
  12584. 280: uint32(0xFFFDDFEC),
  12585. 281: uint32(0xC3FFFDFF),
  12586. 282: uint32(0x00803DCF),
  12587. 283: uint32(0x0000FFC3),
  12588. 288: uint32(0xFFFFFFFE),
  12589. 289: uint32(0x07FF7FFF),
  12590. 290: uint32(0x03FF7FFF),
  12591. 292: uint32(0xFEF02596),
  12592. 293: uint32(0x3BFF6CAE),
  12593. 294: uint32(0x03FF3F5F),
  12594. 296: uint32(0x03000000),
  12595. 297: uint32(0xC2A003FF),
  12596. 298: uint32(0xFFFFFEFF),
  12597. 299: uint32(0xFFFE03FF),
  12598. 300: uint32(0xFEBF0FDF),
  12599. 301: uint32(0x02FE3FFF),
  12600. 310: uint32(0x1FFF0000),
  12601. 311: uint32(0x00000002),
  12602. 312: uint32(0x000000A0),
  12603. 313: uint32(0x003EFFFE),
  12604. 314: uint32(0xFFFFFFFE),
  12605. 315: uint32(0xFFFFFFFF),
  12606. 316: uint32(0x661FFFFF),
  12607. 317: uint32(0xFFFFFFFE),
  12608. 318: uint32(0xFFFFFFFF),
  12609. 319: uint32(0x77FFFFFF),
  12610. }
  12611. var _nmstrtPages = [256]uint8{
  12612. 0: uint8(0x02),
  12613. 1: uint8(0x03),
  12614. 2: uint8(0x04),
  12615. 3: uint8(0x05),
  12616. 4: uint8(0x06),
  12617. 5: uint8(0x07),
  12618. 6: uint8(0x08),
  12619. 9: uint8(0x09),
  12620. 10: uint8(0x0A),
  12621. 11: uint8(0x0B),
  12622. 12: uint8(0x0C),
  12623. 13: uint8(0x0D),
  12624. 14: uint8(0x0E),
  12625. 15: uint8(0x0F),
  12626. 16: uint8(0x10),
  12627. 17: uint8(0x11),
  12628. 30: uint8(0x12),
  12629. 31: uint8(0x13),
  12630. 33: uint8(0x14),
  12631. 48: uint8(0x15),
  12632. 49: uint8(0x16),
  12633. 78: uint8(0x01),
  12634. 79: uint8(0x01),
  12635. 80: uint8(0x01),
  12636. 81: uint8(0x01),
  12637. 82: uint8(0x01),
  12638. 83: uint8(0x01),
  12639. 84: uint8(0x01),
  12640. 85: uint8(0x01),
  12641. 86: uint8(0x01),
  12642. 87: uint8(0x01),
  12643. 88: uint8(0x01),
  12644. 89: uint8(0x01),
  12645. 90: uint8(0x01),
  12646. 91: uint8(0x01),
  12647. 92: uint8(0x01),
  12648. 93: uint8(0x01),
  12649. 94: uint8(0x01),
  12650. 95: uint8(0x01),
  12651. 96: uint8(0x01),
  12652. 97: uint8(0x01),
  12653. 98: uint8(0x01),
  12654. 99: uint8(0x01),
  12655. 100: uint8(0x01),
  12656. 101: uint8(0x01),
  12657. 102: uint8(0x01),
  12658. 103: uint8(0x01),
  12659. 104: uint8(0x01),
  12660. 105: uint8(0x01),
  12661. 106: uint8(0x01),
  12662. 107: uint8(0x01),
  12663. 108: uint8(0x01),
  12664. 109: uint8(0x01),
  12665. 110: uint8(0x01),
  12666. 111: uint8(0x01),
  12667. 112: uint8(0x01),
  12668. 113: uint8(0x01),
  12669. 114: uint8(0x01),
  12670. 115: uint8(0x01),
  12671. 116: uint8(0x01),
  12672. 117: uint8(0x01),
  12673. 118: uint8(0x01),
  12674. 119: uint8(0x01),
  12675. 120: uint8(0x01),
  12676. 121: uint8(0x01),
  12677. 122: uint8(0x01),
  12678. 123: uint8(0x01),
  12679. 124: uint8(0x01),
  12680. 125: uint8(0x01),
  12681. 126: uint8(0x01),
  12682. 127: uint8(0x01),
  12683. 128: uint8(0x01),
  12684. 129: uint8(0x01),
  12685. 130: uint8(0x01),
  12686. 131: uint8(0x01),
  12687. 132: uint8(0x01),
  12688. 133: uint8(0x01),
  12689. 134: uint8(0x01),
  12690. 135: uint8(0x01),
  12691. 136: uint8(0x01),
  12692. 137: uint8(0x01),
  12693. 138: uint8(0x01),
  12694. 139: uint8(0x01),
  12695. 140: uint8(0x01),
  12696. 141: uint8(0x01),
  12697. 142: uint8(0x01),
  12698. 143: uint8(0x01),
  12699. 144: uint8(0x01),
  12700. 145: uint8(0x01),
  12701. 146: uint8(0x01),
  12702. 147: uint8(0x01),
  12703. 148: uint8(0x01),
  12704. 149: uint8(0x01),
  12705. 150: uint8(0x01),
  12706. 151: uint8(0x01),
  12707. 152: uint8(0x01),
  12708. 153: uint8(0x01),
  12709. 154: uint8(0x01),
  12710. 155: uint8(0x01),
  12711. 156: uint8(0x01),
  12712. 157: uint8(0x01),
  12713. 158: uint8(0x01),
  12714. 159: uint8(0x17),
  12715. 172: uint8(0x01),
  12716. 173: uint8(0x01),
  12717. 174: uint8(0x01),
  12718. 175: uint8(0x01),
  12719. 176: uint8(0x01),
  12720. 177: uint8(0x01),
  12721. 178: uint8(0x01),
  12722. 179: uint8(0x01),
  12723. 180: uint8(0x01),
  12724. 181: uint8(0x01),
  12725. 182: uint8(0x01),
  12726. 183: uint8(0x01),
  12727. 184: uint8(0x01),
  12728. 185: uint8(0x01),
  12729. 186: uint8(0x01),
  12730. 187: uint8(0x01),
  12731. 188: uint8(0x01),
  12732. 189: uint8(0x01),
  12733. 190: uint8(0x01),
  12734. 191: uint8(0x01),
  12735. 192: uint8(0x01),
  12736. 193: uint8(0x01),
  12737. 194: uint8(0x01),
  12738. 195: uint8(0x01),
  12739. 196: uint8(0x01),
  12740. 197: uint8(0x01),
  12741. 198: uint8(0x01),
  12742. 199: uint8(0x01),
  12743. 200: uint8(0x01),
  12744. 201: uint8(0x01),
  12745. 202: uint8(0x01),
  12746. 203: uint8(0x01),
  12747. 204: uint8(0x01),
  12748. 205: uint8(0x01),
  12749. 206: uint8(0x01),
  12750. 207: uint8(0x01),
  12751. 208: uint8(0x01),
  12752. 209: uint8(0x01),
  12753. 210: uint8(0x01),
  12754. 211: uint8(0x01),
  12755. 212: uint8(0x01),
  12756. 213: uint8(0x01),
  12757. 214: uint8(0x01),
  12758. 215: uint8(0x18),
  12759. }
  12760. var _namePages = [256]uint8{
  12761. 0: uint8(0x19),
  12762. 1: uint8(0x03),
  12763. 2: uint8(0x1A),
  12764. 3: uint8(0x1B),
  12765. 4: uint8(0x1C),
  12766. 5: uint8(0x1D),
  12767. 6: uint8(0x1E),
  12768. 9: uint8(0x1F),
  12769. 10: uint8(0x20),
  12770. 11: uint8(0x21),
  12771. 12: uint8(0x22),
  12772. 13: uint8(0x23),
  12773. 14: uint8(0x24),
  12774. 15: uint8(0x25),
  12775. 16: uint8(0x10),
  12776. 17: uint8(0x11),
  12777. 30: uint8(0x12),
  12778. 31: uint8(0x13),
  12779. 32: uint8(0x26),
  12780. 33: uint8(0x14),
  12781. 48: uint8(0x27),
  12782. 49: uint8(0x16),
  12783. 78: uint8(0x01),
  12784. 79: uint8(0x01),
  12785. 80: uint8(0x01),
  12786. 81: uint8(0x01),
  12787. 82: uint8(0x01),
  12788. 83: uint8(0x01),
  12789. 84: uint8(0x01),
  12790. 85: uint8(0x01),
  12791. 86: uint8(0x01),
  12792. 87: uint8(0x01),
  12793. 88: uint8(0x01),
  12794. 89: uint8(0x01),
  12795. 90: uint8(0x01),
  12796. 91: uint8(0x01),
  12797. 92: uint8(0x01),
  12798. 93: uint8(0x01),
  12799. 94: uint8(0x01),
  12800. 95: uint8(0x01),
  12801. 96: uint8(0x01),
  12802. 97: uint8(0x01),
  12803. 98: uint8(0x01),
  12804. 99: uint8(0x01),
  12805. 100: uint8(0x01),
  12806. 101: uint8(0x01),
  12807. 102: uint8(0x01),
  12808. 103: uint8(0x01),
  12809. 104: uint8(0x01),
  12810. 105: uint8(0x01),
  12811. 106: uint8(0x01),
  12812. 107: uint8(0x01),
  12813. 108: uint8(0x01),
  12814. 109: uint8(0x01),
  12815. 110: uint8(0x01),
  12816. 111: uint8(0x01),
  12817. 112: uint8(0x01),
  12818. 113: uint8(0x01),
  12819. 114: uint8(0x01),
  12820. 115: uint8(0x01),
  12821. 116: uint8(0x01),
  12822. 117: uint8(0x01),
  12823. 118: uint8(0x01),
  12824. 119: uint8(0x01),
  12825. 120: uint8(0x01),
  12826. 121: uint8(0x01),
  12827. 122: uint8(0x01),
  12828. 123: uint8(0x01),
  12829. 124: uint8(0x01),
  12830. 125: uint8(0x01),
  12831. 126: uint8(0x01),
  12832. 127: uint8(0x01),
  12833. 128: uint8(0x01),
  12834. 129: uint8(0x01),
  12835. 130: uint8(0x01),
  12836. 131: uint8(0x01),
  12837. 132: uint8(0x01),
  12838. 133: uint8(0x01),
  12839. 134: uint8(0x01),
  12840. 135: uint8(0x01),
  12841. 136: uint8(0x01),
  12842. 137: uint8(0x01),
  12843. 138: uint8(0x01),
  12844. 139: uint8(0x01),
  12845. 140: uint8(0x01),
  12846. 141: uint8(0x01),
  12847. 142: uint8(0x01),
  12848. 143: uint8(0x01),
  12849. 144: uint8(0x01),
  12850. 145: uint8(0x01),
  12851. 146: uint8(0x01),
  12852. 147: uint8(0x01),
  12853. 148: uint8(0x01),
  12854. 149: uint8(0x01),
  12855. 150: uint8(0x01),
  12856. 151: uint8(0x01),
  12857. 152: uint8(0x01),
  12858. 153: uint8(0x01),
  12859. 154: uint8(0x01),
  12860. 155: uint8(0x01),
  12861. 156: uint8(0x01),
  12862. 157: uint8(0x01),
  12863. 158: uint8(0x01),
  12864. 159: uint8(0x17),
  12865. 172: uint8(0x01),
  12866. 173: uint8(0x01),
  12867. 174: uint8(0x01),
  12868. 175: uint8(0x01),
  12869. 176: uint8(0x01),
  12870. 177: uint8(0x01),
  12871. 178: uint8(0x01),
  12872. 179: uint8(0x01),
  12873. 180: uint8(0x01),
  12874. 181: uint8(0x01),
  12875. 182: uint8(0x01),
  12876. 183: uint8(0x01),
  12877. 184: uint8(0x01),
  12878. 185: uint8(0x01),
  12879. 186: uint8(0x01),
  12880. 187: uint8(0x01),
  12881. 188: uint8(0x01),
  12882. 189: uint8(0x01),
  12883. 190: uint8(0x01),
  12884. 191: uint8(0x01),
  12885. 192: uint8(0x01),
  12886. 193: uint8(0x01),
  12887. 194: uint8(0x01),
  12888. 195: uint8(0x01),
  12889. 196: uint8(0x01),
  12890. 197: uint8(0x01),
  12891. 198: uint8(0x01),
  12892. 199: uint8(0x01),
  12893. 200: uint8(0x01),
  12894. 201: uint8(0x01),
  12895. 202: uint8(0x01),
  12896. 203: uint8(0x01),
  12897. 204: uint8(0x01),
  12898. 205: uint8(0x01),
  12899. 206: uint8(0x01),
  12900. 207: uint8(0x01),
  12901. 208: uint8(0x01),
  12902. 209: uint8(0x01),
  12903. 210: uint8(0x01),
  12904. 211: uint8(0x01),
  12905. 212: uint8(0x01),
  12906. 213: uint8(0x01),
  12907. 214: uint8(0x01),
  12908. 215: uint8(0x18),
  12909. }
  12910. /* A 2 byte UTF-8 representation splits the characters 11 bits between
  12911. the bottom 5 and 6 bits of the bytes. We need 8 bits to index into
  12912. pages, 3 bits to add to that index and 5 bits to generate the mask.
  12913. */
  12914. /* A 3 byte UTF-8 representation splits the characters 16 bits between
  12915. the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index
  12916. into pages, 3 bits to add to that index and 5 bits to generate the
  12917. mask.
  12918. */
  12919. /* Detection of invalid UTF-8 sequences is based on Table 3.1B
  12920. of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/
  12921. with the additional restriction of not allowing the Unicode
  12922. code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE).
  12923. Implementation details:
  12924. (A & 0x80) == 0 means A < 0x80
  12925. and
  12926. (A & 0xC0) == 0xC0 means A > 0xBF
  12927. */
  12928. func _isNever(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12929. _ = enc
  12930. _ = p
  12931. return 0
  12932. }
  12933. func _utf8_isName2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12934. _ = enc
  12935. 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))))
  12936. }
  12937. func _utf8_isName3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12938. _ = enc
  12939. 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))))
  12940. }
  12941. func _utf8_isNmstrt2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12942. _ = enc
  12943. 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))))
  12944. }
  12945. func _utf8_isNmstrt3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12946. _ = enc
  12947. 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))))
  12948. }
  12949. func _utf8_isInvalid2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12950. _ = enc
  12951. 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))
  12952. }
  12953. func _utf8_isInvalid3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12954. var v1, v3, v4 int32
  12955. var v2, v5, v6 bool
  12956. _, _, _, _, _, _ = v1, v2, v3, v4, v5, v6
  12957. _ = enc
  12958. if v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0x80) == 0; !v2 {
  12959. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xEF) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) == int32(0xBF) {
  12960. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) > int32(0xBD))
  12961. } else {
  12962. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0xC0) == int32(0xC0))
  12963. }
  12964. }
  12965. if v6 = v2 || v1 != 0; !v6 {
  12966. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xE0) {
  12967. v3 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0xA0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  12968. } else {
  12969. if v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v5 {
  12970. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xED) {
  12971. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x9F))
  12972. } else {
  12973. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  12974. }
  12975. }
  12976. v3 = libc.BoolInt32(v5 || v4 != 0)
  12977. }
  12978. }
  12979. return libc.BoolInt32(v6 || v3 != 0)
  12980. }
  12981. func _utf8_isInvalid4(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12982. var v1, v2 int32
  12983. var v3, v4 bool
  12984. _, _, _, _ = v1, v2, v3, v4
  12985. _ = enc
  12986. 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 {
  12987. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF0) {
  12988. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0x90) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  12989. } else {
  12990. if v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v3 {
  12991. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF4) {
  12992. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x8F))
  12993. } else {
  12994. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  12995. }
  12996. }
  12997. v1 = libc.BoolInt32(v3 || v2 != 0)
  12998. }
  12999. }
  13000. return libc.BoolInt32(v4 || v1 != 0)
  13001. }
  13002. type Tnormal_encoding = struct {
  13003. Fenc TENCODING
  13004. Ftype1 [256]uint8
  13005. FisName2 uintptr
  13006. FisName3 uintptr
  13007. FisName4 uintptr
  13008. FisNmstrt2 uintptr
  13009. FisNmstrt3 uintptr
  13010. FisNmstrt4 uintptr
  13011. FisInvalid2 uintptr
  13012. FisInvalid3 uintptr
  13013. FisInvalid4 uintptr
  13014. }
  13015. const _BT_NONXML = 0
  13016. const _BT_MALFORM = 1
  13017. const _BT_LT = 2
  13018. const _BT_AMP = 3
  13019. const _BT_RSQB = 4
  13020. const _BT_LEAD2 = 5
  13021. const _BT_LEAD3 = 6
  13022. const _BT_LEAD4 = 7
  13023. const _BT_TRAIL = 8
  13024. const _BT_CR = 9
  13025. const _BT_LF = 10
  13026. const _BT_GT = 11
  13027. const _BT_QUOT = 12
  13028. const _BT_APOS = 13
  13029. const _BT_EQUALS = 14
  13030. const _BT_QUEST = 15
  13031. const _BT_EXCL = 16
  13032. const _BT_SOL = 17
  13033. const _BT_SEMI = 18
  13034. const _BT_NUM = 19
  13035. const _BT_LSQB = 20
  13036. const _BT_S = 21
  13037. const _BT_NMSTRT = 22
  13038. const _BT_COLON = 23
  13039. const _BT_HEX = 24
  13040. const _BT_DIGIT = 25
  13041. const _BT_NAME = 26
  13042. const _BT_MINUS = 27
  13043. const _BT_OTHER = 28
  13044. const _BT_NONASCII = 29
  13045. const _BT_PERCNT = 30
  13046. const _BT_LPAR = 31
  13047. const _BT_RPAR = 32
  13048. const _BT_AST = 33
  13049. const _BT_PLUS = 34
  13050. const _BT_COMMA = 35
  13051. const _BT_VERBAR = 36
  13052. /*
  13053. __ __ _
  13054. ___\ \/ /_ __ __ _| |_
  13055. / _ \\ /| '_ \ / _` | __|
  13056. | __// \| |_) | (_| | |_
  13057. \___/_/\_\ .__/ \__,_|\__|
  13058. |_| XML parser
  13059. Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
  13060. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  13061. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  13062. Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
  13063. Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
  13064. Licensed under the MIT license:
  13065. Permission is hereby granted, free of charge, to any person obtaining
  13066. a copy of this software and associated documentation files (the
  13067. "Software"), to deal in the Software without restriction, including
  13068. without limitation the rights to use, copy, modify, merge, publish,
  13069. distribute, sublicense, and/or sell copies of the Software, and to permit
  13070. persons to whom the Software is furnished to do so, subject to the
  13071. following conditions:
  13072. The above copyright notice and this permission notice shall be included
  13073. in all copies or substantial portions of the Software.
  13074. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13075. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13076. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13077. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13078. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13079. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13080. USE OR OTHER DEALINGS IN THE SOFTWARE.
  13081. */
  13082. /* minimum bytes per character */
  13083. /* c is an ASCII character */
  13084. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  13085. __ __ _
  13086. ___\ \/ /_ __ __ _| |_
  13087. / _ \\ /| '_ \ / _` | __|
  13088. | __// \| |_) | (_| | |_
  13089. \___/_/\_\ .__/ \__,_|\__|
  13090. |_| XML parser
  13091. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  13092. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  13093. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  13094. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  13095. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  13096. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  13097. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  13098. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  13099. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  13100. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  13101. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  13102. Licensed under the MIT license:
  13103. Permission is hereby granted, free of charge, to any person obtaining
  13104. a copy of this software and associated documentation files (the
  13105. "Software"), to deal in the Software without restriction, including
  13106. without limitation the rights to use, copy, modify, merge, publish,
  13107. distribute, sublicense, and/or sell copies of the Software, and to permit
  13108. persons to whom the Software is furnished to do so, subject to the
  13109. following conditions:
  13110. The above copyright notice and this permission notice shall be included
  13111. in all copies or substantial portions of the Software.
  13112. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13113. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13114. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13115. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13116. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13117. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13118. USE OR OTHER DEALINGS IN THE SOFTWARE.
  13119. */
  13120. /* ptr points to character following "<!-" */
  13121. func _normal_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13122. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13123. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_MINUS1)) {
  13124. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13125. return m_XML_TOK_INVALID
  13126. }
  13127. ptr += uintptr(1)
  13128. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13129. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13130. case int32(_BT_LEAD2):
  13131. if int64(end)-int64(ptr) < int64(2) {
  13132. return -int32(2)
  13133. }
  13134. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13135. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13136. return m_XML_TOK_INVALID
  13137. }
  13138. ptr += uintptr(2)
  13139. case int32(_BT_LEAD3):
  13140. if int64(end)-int64(ptr) < int64(3) {
  13141. return -int32(2)
  13142. }
  13143. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13144. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13145. return m_XML_TOK_INVALID
  13146. }
  13147. ptr += uintptr(3)
  13148. case int32(_BT_LEAD4):
  13149. if int64(end)-int64(ptr) < int64(4) {
  13150. return -int32(2)
  13151. }
  13152. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13153. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13154. return m_XML_TOK_INVALID
  13155. }
  13156. ptr += uintptr(4)
  13157. case int32(_BT_NONXML):
  13158. fallthrough
  13159. case int32(_BT_MALFORM):
  13160. fallthrough
  13161. case int32(_BT_TRAIL):
  13162. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13163. return m_XML_TOK_INVALID
  13164. case int32(_BT_MINUS):
  13165. ptr += uintptr(1)
  13166. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13167. return -int32(1)
  13168. }
  13169. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  13170. ptr += uintptr(1)
  13171. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13172. return -int32(1)
  13173. }
  13174. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  13175. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13176. return m_XML_TOK_INVALID
  13177. }
  13178. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13179. return int32(m_XML_TOK_COMMENT)
  13180. }
  13181. default:
  13182. ptr += uintptr(1)
  13183. break
  13184. }
  13185. }
  13186. }
  13187. return -int32(1)
  13188. }
  13189. /* ptr points to character following "<!" */
  13190. func _normal_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13191. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13192. return -int32(1)
  13193. }
  13194. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13195. case int32(_BT_MINUS):
  13196. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13197. case int32(_BT_LSQB):
  13198. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13199. return int32(m_XML_TOK_COND_SECT_OPEN)
  13200. case int32(_BT_NMSTRT):
  13201. fallthrough
  13202. case int32(_BT_HEX):
  13203. ptr += uintptr(1)
  13204. default:
  13205. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13206. return m_XML_TOK_INVALID
  13207. }
  13208. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13209. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13210. case int32(_BT_PERCNT):
  13211. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))) {
  13212. return -int32(1)
  13213. }
  13214. /* don't allow <!ENTITY% foo "whatever"> */
  13215. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1))))))) {
  13216. case int32(_BT_S):
  13217. fallthrough
  13218. case int32(_BT_CR):
  13219. fallthrough
  13220. case int32(_BT_LF):
  13221. fallthrough
  13222. case int32(_BT_PERCNT):
  13223. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13224. return m_XML_TOK_INVALID
  13225. }
  13226. /* fall through */
  13227. fallthrough
  13228. case int32(_BT_S):
  13229. fallthrough
  13230. case int32(_BT_CR):
  13231. fallthrough
  13232. case int32(_BT_LF):
  13233. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13234. return int32(m_XML_TOK_DECL_OPEN)
  13235. case int32(_BT_NMSTRT):
  13236. fallthrough
  13237. case int32(_BT_HEX):
  13238. ptr += uintptr(1)
  13239. default:
  13240. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13241. return m_XML_TOK_INVALID
  13242. }
  13243. }
  13244. return -int32(1)
  13245. }
  13246. func _normal_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  13247. var upper int32
  13248. _ = upper
  13249. upper = 0
  13250. _ = enc
  13251. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  13252. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(3)) {
  13253. return int32(1)
  13254. }
  13255. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  13256. case int32(m_ASCII_x2):
  13257. case int32(m_ASCII_X):
  13258. upper = int32(1)
  13259. default:
  13260. return int32(1)
  13261. }
  13262. ptr += uintptr(1)
  13263. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  13264. case int32(m_ASCII_m2):
  13265. case int32(m_ASCII_M):
  13266. upper = int32(1)
  13267. default:
  13268. return int32(1)
  13269. }
  13270. ptr += uintptr(1)
  13271. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  13272. case int32(m_ASCII_l2):
  13273. case int32(m_ASCII_L):
  13274. upper = int32(1)
  13275. default:
  13276. return int32(1)
  13277. }
  13278. if upper != 0 {
  13279. return 0
  13280. }
  13281. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  13282. return int32(1)
  13283. }
  13284. /* ptr points to character following "<?" */
  13285. func _normal_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13286. bp := tls.Alloc(16)
  13287. defer tls.Free(16)
  13288. var target uintptr
  13289. var _ /* tok at bp+0 */ int32
  13290. _ = target
  13291. target = ptr
  13292. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13293. return -int32(1)
  13294. }
  13295. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13296. case int32(_BT_NONASCII):
  13297. if !(libc.Int32FromInt32(0) != 0) {
  13298. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13299. return m_XML_TOK_INVALID
  13300. } /* fall through */
  13301. fallthrough
  13302. case int32(_BT_NMSTRT):
  13303. fallthrough
  13304. case int32(_BT_HEX):
  13305. ptr += uintptr(1)
  13306. case int32(_BT_LEAD2):
  13307. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  13308. return -int32(2)
  13309. }
  13310. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  13311. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13312. return m_XML_TOK_INVALID
  13313. }
  13314. ptr += uintptr(2)
  13315. case int32(_BT_LEAD3):
  13316. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  13317. return -int32(2)
  13318. }
  13319. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  13320. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13321. return m_XML_TOK_INVALID
  13322. }
  13323. ptr += uintptr(3)
  13324. case int32(_BT_LEAD4):
  13325. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  13326. return -int32(2)
  13327. }
  13328. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  13329. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13330. return m_XML_TOK_INVALID
  13331. }
  13332. ptr += uintptr(4)
  13333. default:
  13334. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13335. return m_XML_TOK_INVALID
  13336. }
  13337. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13338. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13339. case int32(_BT_NONASCII):
  13340. if !(libc.Int32FromInt32(0) != 0) {
  13341. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13342. return m_XML_TOK_INVALID
  13343. } /* fall through */
  13344. fallthrough
  13345. case int32(_BT_NMSTRT):
  13346. fallthrough
  13347. case int32(_BT_HEX):
  13348. fallthrough
  13349. case int32(_BT_DIGIT):
  13350. fallthrough
  13351. case int32(_BT_NAME):
  13352. fallthrough
  13353. case int32(_BT_MINUS):
  13354. ptr += uintptr(1)
  13355. case int32(_BT_LEAD2):
  13356. if int64(end)-int64(ptr) < int64(2) {
  13357. return -int32(2)
  13358. }
  13359. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  13360. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13361. return m_XML_TOK_INVALID
  13362. }
  13363. ptr += uintptr(2)
  13364. case int32(_BT_LEAD3):
  13365. if int64(end)-int64(ptr) < int64(3) {
  13366. return -int32(2)
  13367. }
  13368. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  13369. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13370. return m_XML_TOK_INVALID
  13371. }
  13372. ptr += uintptr(3)
  13373. case int32(_BT_LEAD4):
  13374. if int64(end)-int64(ptr) < int64(4) {
  13375. return -int32(2)
  13376. }
  13377. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  13378. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13379. return m_XML_TOK_INVALID
  13380. }
  13381. ptr += uintptr(4)
  13382. case int32(_BT_S):
  13383. fallthrough
  13384. case int32(_BT_CR):
  13385. fallthrough
  13386. case int32(_BT_LF):
  13387. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  13388. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13389. return m_XML_TOK_INVALID
  13390. }
  13391. ptr += uintptr(1)
  13392. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13393. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13394. case int32(_BT_LEAD2):
  13395. if int64(end)-int64(ptr) < int64(2) {
  13396. return -int32(2)
  13397. }
  13398. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13399. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13400. return m_XML_TOK_INVALID
  13401. }
  13402. ptr += uintptr(2)
  13403. case int32(_BT_LEAD3):
  13404. if int64(end)-int64(ptr) < int64(3) {
  13405. return -int32(2)
  13406. }
  13407. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13408. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13409. return m_XML_TOK_INVALID
  13410. }
  13411. ptr += uintptr(3)
  13412. case int32(_BT_LEAD4):
  13413. if int64(end)-int64(ptr) < int64(4) {
  13414. return -int32(2)
  13415. }
  13416. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13417. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13418. return m_XML_TOK_INVALID
  13419. }
  13420. ptr += uintptr(4)
  13421. case int32(_BT_NONXML):
  13422. fallthrough
  13423. case int32(_BT_MALFORM):
  13424. fallthrough
  13425. case int32(_BT_TRAIL):
  13426. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13427. return m_XML_TOK_INVALID
  13428. case int32(_BT_QUEST):
  13429. ptr += uintptr(1)
  13430. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13431. return -int32(1)
  13432. }
  13433. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  13434. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13435. return *(*int32)(unsafe.Pointer(bp))
  13436. }
  13437. default:
  13438. ptr += uintptr(1)
  13439. break
  13440. }
  13441. }
  13442. return -int32(1)
  13443. case int32(_BT_QUEST):
  13444. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  13445. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13446. return m_XML_TOK_INVALID
  13447. }
  13448. ptr += uintptr(1)
  13449. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13450. return -int32(1)
  13451. }
  13452. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  13453. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13454. return *(*int32)(unsafe.Pointer(bp))
  13455. }
  13456. /* fall through */
  13457. fallthrough
  13458. default:
  13459. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13460. return m_XML_TOK_INVALID
  13461. }
  13462. }
  13463. return -int32(1)
  13464. }
  13465. func _normal_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13466. var i int32
  13467. _ = i
  13468. _ = enc
  13469. /* CDATA[ */
  13470. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(1))) {
  13471. return -int32(1)
  13472. }
  13473. i = 0
  13474. for {
  13475. if !(i < int32(6)) {
  13476. break
  13477. }
  13478. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromUint8(_CDATA_LSQB[i])) {
  13479. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13480. return m_XML_TOK_INVALID
  13481. }
  13482. goto _1
  13483. _1:
  13484. ;
  13485. i++
  13486. ptr += uintptr(1)
  13487. }
  13488. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13489. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  13490. }
  13491. var _CDATA_LSQB = [6]uint8{
  13492. 0: uint8(m_ASCII_C),
  13493. 1: uint8(m_ASCII_D),
  13494. 2: uint8(m_ASCII_A),
  13495. 3: uint8(m_ASCII_T),
  13496. 4: uint8(m_ASCII_A),
  13497. 5: uint8(m_ASCII_LSQB1),
  13498. }
  13499. func _normal_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13500. var n Tsize_t
  13501. _ = n
  13502. if ptr >= end {
  13503. return -int32(4)
  13504. }
  13505. if int32(1) > int32(1) {
  13506. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  13507. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  13508. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  13509. if n == uint64(0) {
  13510. return -int32(1)
  13511. }
  13512. end = ptr + uintptr(n)
  13513. }
  13514. }
  13515. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13516. case int32(_BT_RSQB):
  13517. ptr += uintptr(1)
  13518. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13519. return -int32(1)
  13520. }
  13521. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  13522. break
  13523. }
  13524. ptr += uintptr(1)
  13525. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13526. return -int32(1)
  13527. }
  13528. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  13529. ptr -= uintptr(1)
  13530. break
  13531. }
  13532. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13533. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  13534. case int32(_BT_CR):
  13535. ptr += uintptr(1)
  13536. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13537. return -int32(1)
  13538. }
  13539. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  13540. ptr += uintptr(1)
  13541. }
  13542. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13543. return int32(m_XML_TOK_DATA_NEWLINE)
  13544. case int32(_BT_LF):
  13545. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13546. return int32(m_XML_TOK_DATA_NEWLINE)
  13547. case int32(_BT_LEAD2):
  13548. if int64(end)-int64(ptr) < int64(2) {
  13549. return -int32(2)
  13550. }
  13551. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13552. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13553. return m_XML_TOK_INVALID
  13554. }
  13555. ptr += uintptr(2)
  13556. case int32(_BT_LEAD3):
  13557. if int64(end)-int64(ptr) < int64(3) {
  13558. return -int32(2)
  13559. }
  13560. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13561. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13562. return m_XML_TOK_INVALID
  13563. }
  13564. ptr += uintptr(3)
  13565. case int32(_BT_LEAD4):
  13566. if int64(end)-int64(ptr) < int64(4) {
  13567. return -int32(2)
  13568. }
  13569. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13570. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13571. return m_XML_TOK_INVALID
  13572. }
  13573. ptr += uintptr(4)
  13574. case int32(_BT_NONXML):
  13575. fallthrough
  13576. case int32(_BT_MALFORM):
  13577. fallthrough
  13578. case int32(_BT_TRAIL):
  13579. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13580. return m_XML_TOK_INVALID
  13581. default:
  13582. ptr += uintptr(1)
  13583. break
  13584. }
  13585. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13586. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13587. case int32(_BT_LEAD2):
  13588. 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 {
  13589. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13590. return int32(m_XML_TOK_DATA_CHARS)
  13591. }
  13592. ptr += uintptr(2)
  13593. case int32(_BT_LEAD3):
  13594. 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 {
  13595. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13596. return int32(m_XML_TOK_DATA_CHARS)
  13597. }
  13598. ptr += uintptr(3)
  13599. case int32(_BT_LEAD4):
  13600. 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 {
  13601. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13602. return int32(m_XML_TOK_DATA_CHARS)
  13603. }
  13604. ptr += uintptr(4)
  13605. case int32(_BT_NONXML):
  13606. fallthrough
  13607. case int32(_BT_MALFORM):
  13608. fallthrough
  13609. case int32(_BT_TRAIL):
  13610. fallthrough
  13611. case int32(_BT_CR):
  13612. fallthrough
  13613. case int32(_BT_LF):
  13614. fallthrough
  13615. case int32(_BT_RSQB):
  13616. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13617. return int32(m_XML_TOK_DATA_CHARS)
  13618. default:
  13619. ptr += uintptr(1)
  13620. break
  13621. }
  13622. }
  13623. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13624. return int32(m_XML_TOK_DATA_CHARS)
  13625. }
  13626. /* ptr points to character following "</" */
  13627. func _normal_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13628. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13629. return -int32(1)
  13630. }
  13631. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13632. case int32(_BT_NONASCII):
  13633. if !(libc.Int32FromInt32(0) != 0) {
  13634. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13635. return m_XML_TOK_INVALID
  13636. } /* fall through */
  13637. fallthrough
  13638. case int32(_BT_NMSTRT):
  13639. fallthrough
  13640. case int32(_BT_HEX):
  13641. ptr += uintptr(1)
  13642. case int32(_BT_LEAD2):
  13643. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  13644. return -int32(2)
  13645. }
  13646. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  13647. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13648. return m_XML_TOK_INVALID
  13649. }
  13650. ptr += uintptr(2)
  13651. case int32(_BT_LEAD3):
  13652. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  13653. return -int32(2)
  13654. }
  13655. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  13656. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13657. return m_XML_TOK_INVALID
  13658. }
  13659. ptr += uintptr(3)
  13660. case int32(_BT_LEAD4):
  13661. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  13662. return -int32(2)
  13663. }
  13664. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  13665. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13666. return m_XML_TOK_INVALID
  13667. }
  13668. ptr += uintptr(4)
  13669. default:
  13670. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13671. return m_XML_TOK_INVALID
  13672. }
  13673. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13674. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13675. case int32(_BT_NONASCII):
  13676. goto _1
  13677. case int32(_BT_MINUS):
  13678. goto _2
  13679. case int32(_BT_NAME):
  13680. goto _3
  13681. case int32(_BT_DIGIT):
  13682. goto _4
  13683. case int32(_BT_HEX):
  13684. goto _5
  13685. case int32(_BT_NMSTRT):
  13686. goto _6
  13687. case int32(_BT_LEAD2):
  13688. goto _7
  13689. case int32(_BT_LEAD3):
  13690. goto _8
  13691. case int32(_BT_LEAD4):
  13692. goto _9
  13693. case int32(_BT_LF):
  13694. goto _10
  13695. case int32(_BT_CR):
  13696. goto _11
  13697. case int32(_BT_S):
  13698. goto _12
  13699. case int32(_BT_COLON):
  13700. goto _13
  13701. case int32(_BT_GT):
  13702. goto _14
  13703. default:
  13704. goto _15
  13705. }
  13706. goto _16
  13707. _1:
  13708. ;
  13709. if !(libc.Int32FromInt32(0) != 0) {
  13710. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13711. return m_XML_TOK_INVALID
  13712. } /* fall through */
  13713. _6:
  13714. ;
  13715. _5:
  13716. ;
  13717. _4:
  13718. ;
  13719. _3:
  13720. ;
  13721. _2:
  13722. ;
  13723. ptr += uintptr(1)
  13724. goto _16
  13725. _7:
  13726. ;
  13727. if int64(end)-int64(ptr) < int64(2) {
  13728. return -int32(2)
  13729. }
  13730. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  13731. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13732. return m_XML_TOK_INVALID
  13733. }
  13734. ptr += uintptr(2)
  13735. goto _16
  13736. _8:
  13737. ;
  13738. if int64(end)-int64(ptr) < int64(3) {
  13739. return -int32(2)
  13740. }
  13741. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  13742. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13743. return m_XML_TOK_INVALID
  13744. }
  13745. ptr += uintptr(3)
  13746. goto _16
  13747. _9:
  13748. ;
  13749. if int64(end)-int64(ptr) < int64(4) {
  13750. return -int32(2)
  13751. }
  13752. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  13753. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13754. return m_XML_TOK_INVALID
  13755. }
  13756. ptr += uintptr(4)
  13757. goto _16
  13758. _12:
  13759. ;
  13760. _11:
  13761. ;
  13762. _10:
  13763. ;
  13764. ptr += uintptr(1)
  13765. _19:
  13766. ;
  13767. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13768. goto _17
  13769. }
  13770. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13771. case int32(_BT_S):
  13772. fallthrough
  13773. case int32(_BT_CR):
  13774. fallthrough
  13775. case int32(_BT_LF):
  13776. case int32(_BT_GT):
  13777. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13778. return int32(m_XML_TOK_END_TAG)
  13779. default:
  13780. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13781. return m_XML_TOK_INVALID
  13782. }
  13783. goto _18
  13784. _18:
  13785. ;
  13786. ptr += uintptr(1)
  13787. goto _19
  13788. goto _17
  13789. _17:
  13790. ;
  13791. return -int32(1)
  13792. _13:
  13793. ;
  13794. /* no need to check qname syntax here,
  13795. since end-tag must match exactly */
  13796. ptr += uintptr(1)
  13797. goto _16
  13798. _14:
  13799. ;
  13800. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13801. return int32(m_XML_TOK_END_TAG)
  13802. _15:
  13803. ;
  13804. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13805. return m_XML_TOK_INVALID
  13806. _16:
  13807. }
  13808. return -int32(1)
  13809. }
  13810. /* ptr points to character following "&#X" */
  13811. func _normal_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13812. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13813. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13814. case int32(_BT_DIGIT):
  13815. fallthrough
  13816. case int32(_BT_HEX):
  13817. default:
  13818. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13819. return m_XML_TOK_INVALID
  13820. }
  13821. ptr += uintptr(1)
  13822. for {
  13823. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13824. break
  13825. }
  13826. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13827. case int32(_BT_DIGIT):
  13828. fallthrough
  13829. case int32(_BT_HEX):
  13830. case int32(_BT_SEMI):
  13831. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13832. return int32(m_XML_TOK_CHAR_REF)
  13833. default:
  13834. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13835. return m_XML_TOK_INVALID
  13836. }
  13837. goto _1
  13838. _1:
  13839. ;
  13840. ptr += uintptr(1)
  13841. }
  13842. }
  13843. return -int32(1)
  13844. }
  13845. /* ptr points to character following "&#" */
  13846. func _normal_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13847. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13848. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  13849. return _normal_scanHexCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13850. }
  13851. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13852. case int32(_BT_DIGIT):
  13853. default:
  13854. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13855. return m_XML_TOK_INVALID
  13856. }
  13857. ptr += uintptr(1)
  13858. for {
  13859. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13860. break
  13861. }
  13862. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13863. case int32(_BT_DIGIT):
  13864. case int32(_BT_SEMI):
  13865. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13866. return int32(m_XML_TOK_CHAR_REF)
  13867. default:
  13868. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13869. return m_XML_TOK_INVALID
  13870. }
  13871. goto _1
  13872. _1:
  13873. ;
  13874. ptr += uintptr(1)
  13875. }
  13876. }
  13877. return -int32(1)
  13878. }
  13879. /* ptr points to character following "&" */
  13880. func _normal_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13881. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13882. return -int32(1)
  13883. }
  13884. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13885. case int32(_BT_NONASCII):
  13886. if !(libc.Int32FromInt32(0) != 0) {
  13887. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13888. return m_XML_TOK_INVALID
  13889. } /* fall through */
  13890. fallthrough
  13891. case int32(_BT_NMSTRT):
  13892. fallthrough
  13893. case int32(_BT_HEX):
  13894. ptr += uintptr(1)
  13895. case int32(_BT_LEAD2):
  13896. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  13897. return -int32(2)
  13898. }
  13899. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  13900. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13901. return m_XML_TOK_INVALID
  13902. }
  13903. ptr += uintptr(2)
  13904. case int32(_BT_LEAD3):
  13905. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  13906. return -int32(2)
  13907. }
  13908. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  13909. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13910. return m_XML_TOK_INVALID
  13911. }
  13912. ptr += uintptr(3)
  13913. case int32(_BT_LEAD4):
  13914. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  13915. return -int32(2)
  13916. }
  13917. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  13918. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13919. return m_XML_TOK_INVALID
  13920. }
  13921. ptr += uintptr(4)
  13922. case int32(_BT_NUM):
  13923. return _normal_scanCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13924. default:
  13925. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13926. return m_XML_TOK_INVALID
  13927. }
  13928. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13929. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13930. case int32(_BT_NONASCII):
  13931. if !(libc.Int32FromInt32(0) != 0) {
  13932. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13933. return m_XML_TOK_INVALID
  13934. } /* fall through */
  13935. fallthrough
  13936. case int32(_BT_NMSTRT):
  13937. fallthrough
  13938. case int32(_BT_HEX):
  13939. fallthrough
  13940. case int32(_BT_DIGIT):
  13941. fallthrough
  13942. case int32(_BT_NAME):
  13943. fallthrough
  13944. case int32(_BT_MINUS):
  13945. ptr += uintptr(1)
  13946. case int32(_BT_LEAD2):
  13947. if int64(end)-int64(ptr) < int64(2) {
  13948. return -int32(2)
  13949. }
  13950. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  13951. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13952. return m_XML_TOK_INVALID
  13953. }
  13954. ptr += uintptr(2)
  13955. case int32(_BT_LEAD3):
  13956. if int64(end)-int64(ptr) < int64(3) {
  13957. return -int32(2)
  13958. }
  13959. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  13960. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13961. return m_XML_TOK_INVALID
  13962. }
  13963. ptr += uintptr(3)
  13964. case int32(_BT_LEAD4):
  13965. if int64(end)-int64(ptr) < int64(4) {
  13966. return -int32(2)
  13967. }
  13968. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  13969. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13970. return m_XML_TOK_INVALID
  13971. }
  13972. ptr += uintptr(4)
  13973. case int32(_BT_SEMI):
  13974. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13975. return int32(m_XML_TOK_ENTITY_REF)
  13976. default:
  13977. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13978. return m_XML_TOK_INVALID
  13979. }
  13980. }
  13981. return -int32(1)
  13982. }
  13983. /* ptr points to character following first character of attribute name */
  13984. func _normal_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13985. bp := tls.Alloc(16)
  13986. defer tls.Free(16)
  13987. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  13988. var hadColon, open, t, t1, tok int32
  13989. _, _, _, _, _ = hadColon, open, t, t1, tok
  13990. hadColon = 0
  13991. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13992. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  13993. case int32(_BT_NONASCII):
  13994. goto _1
  13995. case int32(_BT_MINUS):
  13996. goto _2
  13997. case int32(_BT_NAME):
  13998. goto _3
  13999. case int32(_BT_DIGIT):
  14000. goto _4
  14001. case int32(_BT_HEX):
  14002. goto _5
  14003. case int32(_BT_NMSTRT):
  14004. goto _6
  14005. case int32(_BT_LEAD2):
  14006. goto _7
  14007. case int32(_BT_LEAD3):
  14008. goto _8
  14009. case int32(_BT_LEAD4):
  14010. goto _9
  14011. case int32(_BT_COLON):
  14012. goto _10
  14013. case int32(_BT_LF):
  14014. goto _11
  14015. case int32(_BT_CR):
  14016. goto _12
  14017. case int32(_BT_S):
  14018. goto _13
  14019. case int32(_BT_EQUALS):
  14020. goto _14
  14021. default:
  14022. goto _15
  14023. }
  14024. goto _16
  14025. _1:
  14026. ;
  14027. if !(libc.Int32FromInt32(0) != 0) {
  14028. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14029. return m_XML_TOK_INVALID
  14030. } /* fall through */
  14031. _6:
  14032. ;
  14033. _5:
  14034. ;
  14035. _4:
  14036. ;
  14037. _3:
  14038. ;
  14039. _2:
  14040. ;
  14041. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14042. goto _16
  14043. _7:
  14044. ;
  14045. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  14046. return -int32(2)
  14047. }
  14048. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14049. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14050. return m_XML_TOK_INVALID
  14051. }
  14052. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14053. goto _16
  14054. _8:
  14055. ;
  14056. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  14057. return -int32(2)
  14058. }
  14059. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14060. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14061. return m_XML_TOK_INVALID
  14062. }
  14063. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14064. goto _16
  14065. _9:
  14066. ;
  14067. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  14068. return -int32(2)
  14069. }
  14070. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14071. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14072. return m_XML_TOK_INVALID
  14073. }
  14074. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14075. goto _16
  14076. _10:
  14077. ;
  14078. if hadColon != 0 {
  14079. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14080. return m_XML_TOK_INVALID
  14081. }
  14082. hadColon = int32(1)
  14083. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14084. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14085. return -int32(1)
  14086. }
  14087. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  14088. case int32(_BT_NONASCII):
  14089. if !(libc.Int32FromInt32(0) != 0) {
  14090. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14091. return m_XML_TOK_INVALID
  14092. } /* fall through */
  14093. fallthrough
  14094. case int32(_BT_NMSTRT):
  14095. fallthrough
  14096. case int32(_BT_HEX):
  14097. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14098. case int32(_BT_LEAD2):
  14099. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  14100. return -int32(2)
  14101. }
  14102. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14103. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14104. return m_XML_TOK_INVALID
  14105. }
  14106. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14107. case int32(_BT_LEAD3):
  14108. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  14109. return -int32(2)
  14110. }
  14111. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14112. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14113. return m_XML_TOK_INVALID
  14114. }
  14115. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14116. case int32(_BT_LEAD4):
  14117. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  14118. return -int32(2)
  14119. }
  14120. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14121. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14122. return m_XML_TOK_INVALID
  14123. }
  14124. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14125. default:
  14126. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14127. return m_XML_TOK_INVALID
  14128. }
  14129. goto _16
  14130. _13:
  14131. ;
  14132. _12:
  14133. ;
  14134. _11:
  14135. ;
  14136. _19:
  14137. ;
  14138. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14139. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14140. return -int32(1)
  14141. }
  14142. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  14143. if t == int32(_BT_EQUALS) {
  14144. goto _17
  14145. }
  14146. switch t {
  14147. case int32(_BT_S):
  14148. fallthrough
  14149. case int32(_BT_LF):
  14150. fallthrough
  14151. case int32(_BT_CR):
  14152. default:
  14153. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14154. return m_XML_TOK_INVALID
  14155. }
  14156. goto _18
  14157. _18:
  14158. ;
  14159. goto _19
  14160. goto _17
  14161. _17:
  14162. ;
  14163. /* fall through */
  14164. _14:
  14165. ;
  14166. hadColon = 0
  14167. for {
  14168. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14169. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14170. return -int32(1)
  14171. }
  14172. open = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  14173. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  14174. break
  14175. }
  14176. switch open {
  14177. case int32(_BT_S):
  14178. fallthrough
  14179. case int32(_BT_LF):
  14180. fallthrough
  14181. case int32(_BT_CR):
  14182. default:
  14183. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14184. return m_XML_TOK_INVALID
  14185. }
  14186. goto _20
  14187. _20:
  14188. }
  14189. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14190. /* in attribute value */
  14191. for {
  14192. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14193. return -int32(1)
  14194. }
  14195. t1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  14196. if t1 == open {
  14197. break
  14198. }
  14199. switch t1 {
  14200. case int32(_BT_LEAD2):
  14201. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  14202. return -int32(2)
  14203. }
  14204. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14205. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14206. return m_XML_TOK_INVALID
  14207. }
  14208. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14209. case int32(_BT_LEAD3):
  14210. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  14211. return -int32(2)
  14212. }
  14213. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14214. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14215. return m_XML_TOK_INVALID
  14216. }
  14217. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14218. case int32(_BT_LEAD4):
  14219. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  14220. return -int32(2)
  14221. }
  14222. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14223. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14224. return m_XML_TOK_INVALID
  14225. }
  14226. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14227. case int32(_BT_NONXML):
  14228. fallthrough
  14229. case int32(_BT_MALFORM):
  14230. fallthrough
  14231. case int32(_BT_TRAIL):
  14232. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14233. return m_XML_TOK_INVALID
  14234. case int32(_BT_AMP):
  14235. tok = _normal_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(1), end, bp)
  14236. if tok <= 0 {
  14237. if tok == m_XML_TOK_INVALID {
  14238. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14239. }
  14240. return tok
  14241. }
  14242. case int32(_BT_LT):
  14243. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14244. return m_XML_TOK_INVALID
  14245. default:
  14246. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14247. break
  14248. }
  14249. goto _21
  14250. _21:
  14251. }
  14252. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14253. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14254. return -int32(1)
  14255. }
  14256. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  14257. case int32(_BT_S):
  14258. fallthrough
  14259. case int32(_BT_CR):
  14260. fallthrough
  14261. case int32(_BT_LF):
  14262. case int32(_BT_SOL):
  14263. goto sol
  14264. case int32(_BT_GT):
  14265. goto gt
  14266. default:
  14267. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14268. return m_XML_TOK_INVALID
  14269. }
  14270. /* ptr points to closing quote */
  14271. _24:
  14272. ;
  14273. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14274. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14275. return -int32(1)
  14276. }
  14277. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  14278. case int32(_BT_NONASCII):
  14279. goto _25
  14280. case int32(_BT_HEX):
  14281. goto _26
  14282. case int32(_BT_NMSTRT):
  14283. goto _27
  14284. case int32(_BT_LEAD2):
  14285. goto _28
  14286. case int32(_BT_LEAD3):
  14287. goto _29
  14288. case int32(_BT_LEAD4):
  14289. goto _30
  14290. case int32(_BT_LF):
  14291. goto _31
  14292. case int32(_BT_CR):
  14293. goto _32
  14294. case int32(_BT_S):
  14295. goto _33
  14296. case int32(_BT_GT):
  14297. goto _34
  14298. case int32(_BT_SOL):
  14299. goto _35
  14300. default:
  14301. goto _36
  14302. }
  14303. goto _37
  14304. _25:
  14305. ;
  14306. if !(libc.Int32FromInt32(0) != 0) {
  14307. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14308. return m_XML_TOK_INVALID
  14309. } /* fall through */
  14310. _27:
  14311. ;
  14312. _26:
  14313. ;
  14314. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14315. goto _37
  14316. _28:
  14317. ;
  14318. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  14319. return -int32(2)
  14320. }
  14321. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14322. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14323. return m_XML_TOK_INVALID
  14324. }
  14325. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14326. goto _37
  14327. _29:
  14328. ;
  14329. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  14330. return -int32(2)
  14331. }
  14332. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14333. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14334. return m_XML_TOK_INVALID
  14335. }
  14336. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14337. goto _37
  14338. _30:
  14339. ;
  14340. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  14341. return -int32(2)
  14342. }
  14343. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14344. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14345. return m_XML_TOK_INVALID
  14346. }
  14347. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14348. goto _37
  14349. _33:
  14350. ;
  14351. _32:
  14352. ;
  14353. _31:
  14354. ;
  14355. goto _23
  14356. _34:
  14357. ;
  14358. goto gt
  14359. gt:
  14360. ;
  14361. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  14362. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  14363. _35:
  14364. ;
  14365. goto sol
  14366. sol:
  14367. ;
  14368. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14369. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14370. return -int32(1)
  14371. }
  14372. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14373. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14374. return m_XML_TOK_INVALID
  14375. }
  14376. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  14377. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  14378. _36:
  14379. ;
  14380. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14381. return m_XML_TOK_INVALID
  14382. _37:
  14383. ;
  14384. goto _22
  14385. goto _23
  14386. _23:
  14387. ;
  14388. goto _24
  14389. goto _22
  14390. _22:
  14391. ;
  14392. goto _16
  14393. _15:
  14394. ;
  14395. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14396. return m_XML_TOK_INVALID
  14397. _16:
  14398. }
  14399. return -int32(1)
  14400. }
  14401. /* ptr points to character following "<" */
  14402. func _normal_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14403. var hadColon int32
  14404. _ = hadColon
  14405. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14406. return -int32(1)
  14407. }
  14408. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14409. case int32(_BT_NONASCII):
  14410. if !(libc.Int32FromInt32(0) != 0) {
  14411. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14412. return m_XML_TOK_INVALID
  14413. } /* fall through */
  14414. fallthrough
  14415. case int32(_BT_NMSTRT):
  14416. fallthrough
  14417. case int32(_BT_HEX):
  14418. ptr += uintptr(1)
  14419. case int32(_BT_LEAD2):
  14420. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14421. return -int32(2)
  14422. }
  14423. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  14424. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14425. return m_XML_TOK_INVALID
  14426. }
  14427. ptr += uintptr(2)
  14428. case int32(_BT_LEAD3):
  14429. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14430. return -int32(2)
  14431. }
  14432. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  14433. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14434. return m_XML_TOK_INVALID
  14435. }
  14436. ptr += uintptr(3)
  14437. case int32(_BT_LEAD4):
  14438. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14439. return -int32(2)
  14440. }
  14441. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  14442. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14443. return m_XML_TOK_INVALID
  14444. }
  14445. ptr += uintptr(4)
  14446. case int32(_BT_EXCL):
  14447. ptr += uintptr(1)
  14448. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14449. return -int32(1)
  14450. }
  14451. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14452. case int32(_BT_MINUS):
  14453. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14454. case int32(_BT_LSQB):
  14455. return _normal_scanCdataSection(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14456. }
  14457. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14458. return m_XML_TOK_INVALID
  14459. case int32(_BT_QUEST):
  14460. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14461. case int32(_BT_SOL):
  14462. return _normal_scanEndTag(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14463. default:
  14464. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14465. return m_XML_TOK_INVALID
  14466. }
  14467. hadColon = 0
  14468. /* we have a start-tag */
  14469. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14470. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14471. case int32(_BT_NONASCII):
  14472. goto _1
  14473. case int32(_BT_MINUS):
  14474. goto _2
  14475. case int32(_BT_NAME):
  14476. goto _3
  14477. case int32(_BT_DIGIT):
  14478. goto _4
  14479. case int32(_BT_HEX):
  14480. goto _5
  14481. case int32(_BT_NMSTRT):
  14482. goto _6
  14483. case int32(_BT_LEAD2):
  14484. goto _7
  14485. case int32(_BT_LEAD3):
  14486. goto _8
  14487. case int32(_BT_LEAD4):
  14488. goto _9
  14489. case int32(_BT_COLON):
  14490. goto _10
  14491. case int32(_BT_LF):
  14492. goto _11
  14493. case int32(_BT_CR):
  14494. goto _12
  14495. case int32(_BT_S):
  14496. goto _13
  14497. case int32(_BT_GT):
  14498. goto _14
  14499. case int32(_BT_SOL):
  14500. goto _15
  14501. default:
  14502. goto _16
  14503. }
  14504. goto _17
  14505. _1:
  14506. ;
  14507. if !(libc.Int32FromInt32(0) != 0) {
  14508. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14509. return m_XML_TOK_INVALID
  14510. } /* fall through */
  14511. _6:
  14512. ;
  14513. _5:
  14514. ;
  14515. _4:
  14516. ;
  14517. _3:
  14518. ;
  14519. _2:
  14520. ;
  14521. ptr += uintptr(1)
  14522. goto _17
  14523. _7:
  14524. ;
  14525. if int64(end)-int64(ptr) < int64(2) {
  14526. return -int32(2)
  14527. }
  14528. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  14529. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14530. return m_XML_TOK_INVALID
  14531. }
  14532. ptr += uintptr(2)
  14533. goto _17
  14534. _8:
  14535. ;
  14536. if int64(end)-int64(ptr) < int64(3) {
  14537. return -int32(2)
  14538. }
  14539. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  14540. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14541. return m_XML_TOK_INVALID
  14542. }
  14543. ptr += uintptr(3)
  14544. goto _17
  14545. _9:
  14546. ;
  14547. if int64(end)-int64(ptr) < int64(4) {
  14548. return -int32(2)
  14549. }
  14550. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  14551. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14552. return m_XML_TOK_INVALID
  14553. }
  14554. ptr += uintptr(4)
  14555. goto _17
  14556. _10:
  14557. ;
  14558. if hadColon != 0 {
  14559. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14560. return m_XML_TOK_INVALID
  14561. }
  14562. hadColon = int32(1)
  14563. ptr += uintptr(1)
  14564. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14565. return -int32(1)
  14566. }
  14567. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14568. case int32(_BT_NONASCII):
  14569. if !(libc.Int32FromInt32(0) != 0) {
  14570. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14571. return m_XML_TOK_INVALID
  14572. } /* fall through */
  14573. fallthrough
  14574. case int32(_BT_NMSTRT):
  14575. fallthrough
  14576. case int32(_BT_HEX):
  14577. ptr += uintptr(1)
  14578. case int32(_BT_LEAD2):
  14579. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14580. return -int32(2)
  14581. }
  14582. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  14583. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14584. return m_XML_TOK_INVALID
  14585. }
  14586. ptr += uintptr(2)
  14587. case int32(_BT_LEAD3):
  14588. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14589. return -int32(2)
  14590. }
  14591. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  14592. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14593. return m_XML_TOK_INVALID
  14594. }
  14595. ptr += uintptr(3)
  14596. case int32(_BT_LEAD4):
  14597. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14598. return -int32(2)
  14599. }
  14600. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  14601. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14602. return m_XML_TOK_INVALID
  14603. }
  14604. ptr += uintptr(4)
  14605. default:
  14606. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14607. return m_XML_TOK_INVALID
  14608. }
  14609. goto _17
  14610. _13:
  14611. ;
  14612. _12:
  14613. ;
  14614. _11:
  14615. ;
  14616. ptr += uintptr(1)
  14617. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14618. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14619. case int32(_BT_NONASCII):
  14620. if !(libc.Int32FromInt32(0) != 0) {
  14621. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14622. return m_XML_TOK_INVALID
  14623. } /* fall through */
  14624. fallthrough
  14625. case int32(_BT_NMSTRT):
  14626. fallthrough
  14627. case int32(_BT_HEX):
  14628. ptr += uintptr(1)
  14629. case int32(_BT_LEAD2):
  14630. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14631. return -int32(2)
  14632. }
  14633. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  14634. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14635. return m_XML_TOK_INVALID
  14636. }
  14637. ptr += uintptr(2)
  14638. case int32(_BT_LEAD3):
  14639. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14640. return -int32(2)
  14641. }
  14642. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  14643. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14644. return m_XML_TOK_INVALID
  14645. }
  14646. ptr += uintptr(3)
  14647. case int32(_BT_LEAD4):
  14648. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14649. return -int32(2)
  14650. }
  14651. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  14652. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14653. return m_XML_TOK_INVALID
  14654. }
  14655. ptr += uintptr(4)
  14656. case int32(_BT_GT):
  14657. goto gt
  14658. case int32(_BT_SOL):
  14659. goto sol
  14660. case int32(_BT_S):
  14661. fallthrough
  14662. case int32(_BT_CR):
  14663. fallthrough
  14664. case int32(_BT_LF):
  14665. ptr += uintptr(1)
  14666. continue
  14667. default:
  14668. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14669. return m_XML_TOK_INVALID
  14670. }
  14671. return _normal_scanAtts(tls, enc, ptr, end, nextTokPtr)
  14672. }
  14673. return -int32(1)
  14674. _14:
  14675. ;
  14676. goto gt
  14677. gt:
  14678. ;
  14679. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14680. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  14681. _15:
  14682. ;
  14683. goto sol
  14684. sol:
  14685. ;
  14686. ptr += uintptr(1)
  14687. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14688. return -int32(1)
  14689. }
  14690. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14691. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14692. return m_XML_TOK_INVALID
  14693. }
  14694. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14695. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  14696. _16:
  14697. ;
  14698. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14699. return m_XML_TOK_INVALID
  14700. _17:
  14701. }
  14702. return -int32(1)
  14703. }
  14704. func _normal_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14705. var n Tsize_t
  14706. _ = n
  14707. if ptr >= end {
  14708. return -int32(4)
  14709. }
  14710. if int32(1) > int32(1) {
  14711. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  14712. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  14713. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  14714. if n == uint64(0) {
  14715. return -int32(1)
  14716. }
  14717. end = ptr + uintptr(n)
  14718. }
  14719. }
  14720. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14721. case int32(_BT_LT):
  14722. return _normal_scanLt(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14723. case int32(_BT_AMP):
  14724. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14725. case int32(_BT_CR):
  14726. ptr += uintptr(1)
  14727. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14728. return -int32(3)
  14729. }
  14730. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  14731. ptr += uintptr(1)
  14732. }
  14733. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14734. return int32(m_XML_TOK_DATA_NEWLINE)
  14735. case int32(_BT_LF):
  14736. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14737. return int32(m_XML_TOK_DATA_NEWLINE)
  14738. case int32(_BT_RSQB):
  14739. ptr += uintptr(1)
  14740. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14741. return -int32(5)
  14742. }
  14743. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  14744. break
  14745. }
  14746. ptr += uintptr(1)
  14747. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14748. return -int32(5)
  14749. }
  14750. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14751. ptr -= uintptr(1)
  14752. break
  14753. }
  14754. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14755. return m_XML_TOK_INVALID
  14756. case int32(_BT_LEAD2):
  14757. if int64(end)-int64(ptr) < int64(2) {
  14758. return -int32(2)
  14759. }
  14760. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  14761. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14762. return m_XML_TOK_INVALID
  14763. }
  14764. ptr += uintptr(2)
  14765. case int32(_BT_LEAD3):
  14766. if int64(end)-int64(ptr) < int64(3) {
  14767. return -int32(2)
  14768. }
  14769. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  14770. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14771. return m_XML_TOK_INVALID
  14772. }
  14773. ptr += uintptr(3)
  14774. case int32(_BT_LEAD4):
  14775. if int64(end)-int64(ptr) < int64(4) {
  14776. return -int32(2)
  14777. }
  14778. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  14779. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14780. return m_XML_TOK_INVALID
  14781. }
  14782. ptr += uintptr(4)
  14783. case int32(_BT_NONXML):
  14784. fallthrough
  14785. case int32(_BT_MALFORM):
  14786. fallthrough
  14787. case int32(_BT_TRAIL):
  14788. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14789. return m_XML_TOK_INVALID
  14790. default:
  14791. ptr += uintptr(1)
  14792. break
  14793. }
  14794. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14795. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14796. case int32(_BT_LEAD2):
  14797. 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 {
  14798. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14799. return int32(m_XML_TOK_DATA_CHARS)
  14800. }
  14801. ptr += uintptr(2)
  14802. case int32(_BT_LEAD3):
  14803. 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 {
  14804. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14805. return int32(m_XML_TOK_DATA_CHARS)
  14806. }
  14807. ptr += uintptr(3)
  14808. case int32(_BT_LEAD4):
  14809. 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 {
  14810. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14811. return int32(m_XML_TOK_DATA_CHARS)
  14812. }
  14813. ptr += uintptr(4)
  14814. case int32(_BT_RSQB):
  14815. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1)) {
  14816. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  14817. ptr += uintptr(1)
  14818. break
  14819. }
  14820. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(1)) {
  14821. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14822. ptr += uintptr(1)
  14823. break
  14824. }
  14825. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  14826. return m_XML_TOK_INVALID
  14827. }
  14828. }
  14829. /* fall through */
  14830. fallthrough
  14831. case int32(_BT_AMP):
  14832. fallthrough
  14833. case int32(_BT_LT):
  14834. fallthrough
  14835. case int32(_BT_NONXML):
  14836. fallthrough
  14837. case int32(_BT_MALFORM):
  14838. fallthrough
  14839. case int32(_BT_TRAIL):
  14840. fallthrough
  14841. case int32(_BT_CR):
  14842. fallthrough
  14843. case int32(_BT_LF):
  14844. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14845. return int32(m_XML_TOK_DATA_CHARS)
  14846. default:
  14847. ptr += uintptr(1)
  14848. break
  14849. }
  14850. }
  14851. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14852. return int32(m_XML_TOK_DATA_CHARS)
  14853. }
  14854. /* ptr points to character following "%" */
  14855. func _normal_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14856. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14857. return -int32(1)
  14858. }
  14859. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14860. case int32(_BT_NONASCII):
  14861. if !(libc.Int32FromInt32(0) != 0) {
  14862. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14863. return m_XML_TOK_INVALID
  14864. } /* fall through */
  14865. fallthrough
  14866. case int32(_BT_NMSTRT):
  14867. fallthrough
  14868. case int32(_BT_HEX):
  14869. ptr += uintptr(1)
  14870. case int32(_BT_LEAD2):
  14871. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14872. return -int32(2)
  14873. }
  14874. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  14875. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14876. return m_XML_TOK_INVALID
  14877. }
  14878. ptr += uintptr(2)
  14879. case int32(_BT_LEAD3):
  14880. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14881. return -int32(2)
  14882. }
  14883. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  14884. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14885. return m_XML_TOK_INVALID
  14886. }
  14887. ptr += uintptr(3)
  14888. case int32(_BT_LEAD4):
  14889. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14890. return -int32(2)
  14891. }
  14892. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  14893. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14894. return m_XML_TOK_INVALID
  14895. }
  14896. ptr += uintptr(4)
  14897. case int32(_BT_S):
  14898. fallthrough
  14899. case int32(_BT_LF):
  14900. fallthrough
  14901. case int32(_BT_CR):
  14902. fallthrough
  14903. case int32(_BT_PERCNT):
  14904. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14905. return int32(m_XML_TOK_PERCENT)
  14906. default:
  14907. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14908. return m_XML_TOK_INVALID
  14909. }
  14910. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14911. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14912. case int32(_BT_NONASCII):
  14913. if !(libc.Int32FromInt32(0) != 0) {
  14914. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14915. return m_XML_TOK_INVALID
  14916. } /* fall through */
  14917. fallthrough
  14918. case int32(_BT_NMSTRT):
  14919. fallthrough
  14920. case int32(_BT_HEX):
  14921. fallthrough
  14922. case int32(_BT_DIGIT):
  14923. fallthrough
  14924. case int32(_BT_NAME):
  14925. fallthrough
  14926. case int32(_BT_MINUS):
  14927. ptr += uintptr(1)
  14928. case int32(_BT_LEAD2):
  14929. if int64(end)-int64(ptr) < int64(2) {
  14930. return -int32(2)
  14931. }
  14932. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  14933. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14934. return m_XML_TOK_INVALID
  14935. }
  14936. ptr += uintptr(2)
  14937. case int32(_BT_LEAD3):
  14938. if int64(end)-int64(ptr) < int64(3) {
  14939. return -int32(2)
  14940. }
  14941. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  14942. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14943. return m_XML_TOK_INVALID
  14944. }
  14945. ptr += uintptr(3)
  14946. case int32(_BT_LEAD4):
  14947. if int64(end)-int64(ptr) < int64(4) {
  14948. return -int32(2)
  14949. }
  14950. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  14951. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14952. return m_XML_TOK_INVALID
  14953. }
  14954. ptr += uintptr(4)
  14955. case int32(_BT_SEMI):
  14956. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14957. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  14958. default:
  14959. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14960. return m_XML_TOK_INVALID
  14961. }
  14962. }
  14963. return -int32(1)
  14964. }
  14965. func _normal_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14966. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14967. return -int32(1)
  14968. }
  14969. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14970. case int32(_BT_NONASCII):
  14971. if !(libc.Int32FromInt32(0) != 0) {
  14972. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14973. return m_XML_TOK_INVALID
  14974. } /* fall through */
  14975. fallthrough
  14976. case int32(_BT_NMSTRT):
  14977. fallthrough
  14978. case int32(_BT_HEX):
  14979. ptr += uintptr(1)
  14980. case int32(_BT_LEAD2):
  14981. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14982. return -int32(2)
  14983. }
  14984. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  14985. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14986. return m_XML_TOK_INVALID
  14987. }
  14988. ptr += uintptr(2)
  14989. case int32(_BT_LEAD3):
  14990. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14991. return -int32(2)
  14992. }
  14993. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  14994. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14995. return m_XML_TOK_INVALID
  14996. }
  14997. ptr += uintptr(3)
  14998. case int32(_BT_LEAD4):
  14999. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  15000. return -int32(2)
  15001. }
  15002. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  15003. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15004. return m_XML_TOK_INVALID
  15005. }
  15006. ptr += uintptr(4)
  15007. default:
  15008. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15009. return m_XML_TOK_INVALID
  15010. }
  15011. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15012. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15013. case int32(_BT_NONASCII):
  15014. if !(libc.Int32FromInt32(0) != 0) {
  15015. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15016. return m_XML_TOK_INVALID
  15017. } /* fall through */
  15018. fallthrough
  15019. case int32(_BT_NMSTRT):
  15020. fallthrough
  15021. case int32(_BT_HEX):
  15022. fallthrough
  15023. case int32(_BT_DIGIT):
  15024. fallthrough
  15025. case int32(_BT_NAME):
  15026. fallthrough
  15027. case int32(_BT_MINUS):
  15028. ptr += uintptr(1)
  15029. case int32(_BT_LEAD2):
  15030. if int64(end)-int64(ptr) < int64(2) {
  15031. return -int32(2)
  15032. }
  15033. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  15034. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15035. return m_XML_TOK_INVALID
  15036. }
  15037. ptr += uintptr(2)
  15038. case int32(_BT_LEAD3):
  15039. if int64(end)-int64(ptr) < int64(3) {
  15040. return -int32(2)
  15041. }
  15042. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  15043. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15044. return m_XML_TOK_INVALID
  15045. }
  15046. ptr += uintptr(3)
  15047. case int32(_BT_LEAD4):
  15048. if int64(end)-int64(ptr) < int64(4) {
  15049. return -int32(2)
  15050. }
  15051. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  15052. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15053. return m_XML_TOK_INVALID
  15054. }
  15055. ptr += uintptr(4)
  15056. case int32(_BT_CR):
  15057. fallthrough
  15058. case int32(_BT_LF):
  15059. fallthrough
  15060. case int32(_BT_S):
  15061. fallthrough
  15062. case int32(_BT_RPAR):
  15063. fallthrough
  15064. case int32(_BT_GT):
  15065. fallthrough
  15066. case int32(_BT_PERCNT):
  15067. fallthrough
  15068. case int32(_BT_VERBAR):
  15069. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15070. return int32(m_XML_TOK_POUND_NAME)
  15071. default:
  15072. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15073. return m_XML_TOK_INVALID
  15074. }
  15075. }
  15076. return -int32(m_XML_TOK_POUND_NAME)
  15077. }
  15078. func _normal_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15079. var t int32
  15080. _ = t
  15081. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15082. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  15083. switch t {
  15084. case int32(_BT_LEAD2):
  15085. if int64(end)-int64(ptr) < int64(2) {
  15086. return -int32(2)
  15087. }
  15088. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15089. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15090. return m_XML_TOK_INVALID
  15091. }
  15092. ptr += uintptr(2)
  15093. case int32(_BT_LEAD3):
  15094. if int64(end)-int64(ptr) < int64(3) {
  15095. return -int32(2)
  15096. }
  15097. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15098. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15099. return m_XML_TOK_INVALID
  15100. }
  15101. ptr += uintptr(3)
  15102. case int32(_BT_LEAD4):
  15103. if int64(end)-int64(ptr) < int64(4) {
  15104. return -int32(2)
  15105. }
  15106. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15107. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15108. return m_XML_TOK_INVALID
  15109. }
  15110. ptr += uintptr(4)
  15111. case int32(_BT_NONXML):
  15112. fallthrough
  15113. case int32(_BT_MALFORM):
  15114. fallthrough
  15115. case int32(_BT_TRAIL):
  15116. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15117. return m_XML_TOK_INVALID
  15118. case int32(_BT_QUOT):
  15119. fallthrough
  15120. case int32(_BT_APOS):
  15121. ptr += uintptr(1)
  15122. if t != open {
  15123. break
  15124. }
  15125. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15126. return -int32(m_XML_TOK_LITERAL)
  15127. }
  15128. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15129. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15130. case int32(_BT_S):
  15131. fallthrough
  15132. case int32(_BT_CR):
  15133. fallthrough
  15134. case int32(_BT_LF):
  15135. fallthrough
  15136. case int32(_BT_GT):
  15137. fallthrough
  15138. case int32(_BT_PERCNT):
  15139. fallthrough
  15140. case int32(_BT_LSQB):
  15141. return int32(m_XML_TOK_LITERAL)
  15142. default:
  15143. return m_XML_TOK_INVALID
  15144. }
  15145. fallthrough
  15146. default:
  15147. ptr += uintptr(1)
  15148. break
  15149. }
  15150. }
  15151. return -int32(1)
  15152. }
  15153. func _normal_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15154. var n Tsize_t
  15155. var tok int32
  15156. _, _ = n, tok
  15157. if ptr >= end {
  15158. return -int32(4)
  15159. }
  15160. if int32(1) > int32(1) {
  15161. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  15162. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  15163. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  15164. if n == uint64(0) {
  15165. return -int32(1)
  15166. }
  15167. end = ptr + uintptr(n)
  15168. }
  15169. }
  15170. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15171. case int32(_BT_QUOT):
  15172. goto _1
  15173. case int32(_BT_APOS):
  15174. goto _2
  15175. case int32(_BT_LT):
  15176. goto _3
  15177. case int32(_BT_CR):
  15178. goto _4
  15179. case int32(_BT_LF):
  15180. goto _5
  15181. case int32(_BT_S):
  15182. goto _6
  15183. case int32(_BT_PERCNT):
  15184. goto _7
  15185. case int32(_BT_COMMA):
  15186. goto _8
  15187. case int32(_BT_LSQB):
  15188. goto _9
  15189. case int32(_BT_RSQB):
  15190. goto _10
  15191. case int32(_BT_LPAR):
  15192. goto _11
  15193. case int32(_BT_RPAR):
  15194. goto _12
  15195. case int32(_BT_VERBAR):
  15196. goto _13
  15197. case int32(_BT_GT):
  15198. goto _14
  15199. case int32(_BT_NUM):
  15200. goto _15
  15201. case int32(_BT_LEAD2):
  15202. goto _16
  15203. case int32(_BT_LEAD3):
  15204. goto _17
  15205. case int32(_BT_LEAD4):
  15206. goto _18
  15207. case int32(_BT_HEX):
  15208. goto _19
  15209. case int32(_BT_NMSTRT):
  15210. goto _20
  15211. case int32(_BT_COLON):
  15212. goto _21
  15213. case int32(_BT_MINUS):
  15214. goto _22
  15215. case int32(_BT_NAME):
  15216. goto _23
  15217. case int32(_BT_DIGIT):
  15218. goto _24
  15219. case int32(_BT_NONASCII):
  15220. goto _25
  15221. default:
  15222. goto _26
  15223. }
  15224. goto _27
  15225. _1:
  15226. ;
  15227. return _normal_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(1), end, nextTokPtr)
  15228. _2:
  15229. ;
  15230. return _normal_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(1), end, nextTokPtr)
  15231. _3:
  15232. ;
  15233. ptr += uintptr(1)
  15234. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15235. return -int32(1)
  15236. }
  15237. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15238. case int32(_BT_EXCL):
  15239. return _normal_scanDecl(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15240. case int32(_BT_QUEST):
  15241. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15242. case int32(_BT_NMSTRT):
  15243. fallthrough
  15244. case int32(_BT_HEX):
  15245. fallthrough
  15246. case int32(_BT_NONASCII):
  15247. fallthrough
  15248. case int32(_BT_LEAD2):
  15249. fallthrough
  15250. case int32(_BT_LEAD3):
  15251. fallthrough
  15252. case int32(_BT_LEAD4):
  15253. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(1)
  15254. return int32(m_XML_TOK_INSTANCE_START)
  15255. }
  15256. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15257. return m_XML_TOK_INVALID
  15258. _4:
  15259. ;
  15260. if ptr+uintptr(1) == end {
  15261. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  15262. /* indicate that this might be part of a CR/LF pair */
  15263. return -int32(m_XML_TOK_PROLOG_S)
  15264. }
  15265. /* fall through */
  15266. _6:
  15267. ;
  15268. _5:
  15269. ;
  15270. _30:
  15271. ;
  15272. ptr += uintptr(1)
  15273. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15274. goto _28
  15275. }
  15276. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15277. case int32(_BT_S):
  15278. fallthrough
  15279. case int32(_BT_LF):
  15280. case int32(_BT_CR):
  15281. /* don't split CR/LF pair */
  15282. if ptr+uintptr(1) != end {
  15283. break
  15284. }
  15285. /* fall through */
  15286. fallthrough
  15287. default:
  15288. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15289. return int32(m_XML_TOK_PROLOG_S)
  15290. }
  15291. goto _29
  15292. _29:
  15293. ;
  15294. goto _30
  15295. goto _28
  15296. _28:
  15297. ;
  15298. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15299. return int32(m_XML_TOK_PROLOG_S)
  15300. _7:
  15301. ;
  15302. return _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15303. _8:
  15304. ;
  15305. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15306. return int32(m_XML_TOK_COMMA)
  15307. _9:
  15308. ;
  15309. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15310. return int32(m_XML_TOK_OPEN_BRACKET)
  15311. _10:
  15312. ;
  15313. ptr += uintptr(1)
  15314. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15315. return -int32(m_XML_TOK_CLOSE_BRACKET)
  15316. }
  15317. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  15318. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))) {
  15319. return -int32(1)
  15320. }
  15321. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_GT1) {
  15322. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  15323. return int32(m_XML_TOK_COND_SECT_CLOSE)
  15324. }
  15325. }
  15326. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15327. return int32(m_XML_TOK_CLOSE_BRACKET)
  15328. _11:
  15329. ;
  15330. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15331. return int32(m_XML_TOK_OPEN_PAREN)
  15332. _12:
  15333. ;
  15334. ptr += uintptr(1)
  15335. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15336. return -int32(m_XML_TOK_CLOSE_PAREN)
  15337. }
  15338. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15339. case int32(_BT_AST):
  15340. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15341. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  15342. case int32(_BT_QUEST):
  15343. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15344. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  15345. case int32(_BT_PLUS):
  15346. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15347. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  15348. case int32(_BT_CR):
  15349. fallthrough
  15350. case int32(_BT_LF):
  15351. fallthrough
  15352. case int32(_BT_S):
  15353. fallthrough
  15354. case int32(_BT_GT):
  15355. fallthrough
  15356. case int32(_BT_COMMA):
  15357. fallthrough
  15358. case int32(_BT_VERBAR):
  15359. fallthrough
  15360. case int32(_BT_RPAR):
  15361. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15362. return int32(m_XML_TOK_CLOSE_PAREN)
  15363. }
  15364. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15365. return m_XML_TOK_INVALID
  15366. _13:
  15367. ;
  15368. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15369. return int32(m_XML_TOK_OR)
  15370. _14:
  15371. ;
  15372. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15373. return int32(m_XML_TOK_DECL_CLOSE)
  15374. _15:
  15375. ;
  15376. return _normal_scanPoundName(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15377. _16:
  15378. ;
  15379. if int64(end)-int64(ptr) < int64(2) {
  15380. return -int32(2)
  15381. }
  15382. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15383. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15384. return m_XML_TOK_INVALID
  15385. }
  15386. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0 {
  15387. ptr += uintptr(2)
  15388. tok = int32(m_XML_TOK_NAME)
  15389. goto _27
  15390. }
  15391. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0 {
  15392. ptr += uintptr(2)
  15393. tok = int32(m_XML_TOK_NMTOKEN)
  15394. goto _27
  15395. }
  15396. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15397. return m_XML_TOK_INVALID
  15398. _17:
  15399. ;
  15400. if int64(end)-int64(ptr) < int64(3) {
  15401. return -int32(2)
  15402. }
  15403. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15404. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15405. return m_XML_TOK_INVALID
  15406. }
  15407. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0 {
  15408. ptr += uintptr(3)
  15409. tok = int32(m_XML_TOK_NAME)
  15410. goto _27
  15411. }
  15412. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0 {
  15413. ptr += uintptr(3)
  15414. tok = int32(m_XML_TOK_NMTOKEN)
  15415. goto _27
  15416. }
  15417. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15418. return m_XML_TOK_INVALID
  15419. _18:
  15420. ;
  15421. if int64(end)-int64(ptr) < int64(4) {
  15422. return -int32(2)
  15423. }
  15424. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15425. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15426. return m_XML_TOK_INVALID
  15427. }
  15428. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0 {
  15429. ptr += uintptr(4)
  15430. tok = int32(m_XML_TOK_NAME)
  15431. goto _27
  15432. }
  15433. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0 {
  15434. ptr += uintptr(4)
  15435. tok = int32(m_XML_TOK_NMTOKEN)
  15436. goto _27
  15437. }
  15438. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15439. return m_XML_TOK_INVALID
  15440. _20:
  15441. ;
  15442. _19:
  15443. ;
  15444. tok = int32(m_XML_TOK_NAME)
  15445. ptr += uintptr(1)
  15446. goto _27
  15447. _24:
  15448. ;
  15449. _23:
  15450. ;
  15451. _22:
  15452. ;
  15453. _21:
  15454. ;
  15455. tok = int32(m_XML_TOK_NMTOKEN)
  15456. ptr += uintptr(1)
  15457. goto _27
  15458. _25:
  15459. ;
  15460. if 0 != 0 {
  15461. ptr += uintptr(1)
  15462. tok = int32(m_XML_TOK_NAME)
  15463. goto _27
  15464. }
  15465. if 0 != 0 {
  15466. ptr += uintptr(1)
  15467. tok = int32(m_XML_TOK_NMTOKEN)
  15468. goto _27
  15469. }
  15470. /* fall through */
  15471. _26:
  15472. ;
  15473. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15474. return m_XML_TOK_INVALID
  15475. _27:
  15476. ;
  15477. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15478. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15479. case int32(_BT_NONASCII):
  15480. if !(libc.Int32FromInt32(0) != 0) {
  15481. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15482. return m_XML_TOK_INVALID
  15483. } /* fall through */
  15484. fallthrough
  15485. case int32(_BT_NMSTRT):
  15486. fallthrough
  15487. case int32(_BT_HEX):
  15488. fallthrough
  15489. case int32(_BT_DIGIT):
  15490. fallthrough
  15491. case int32(_BT_NAME):
  15492. fallthrough
  15493. case int32(_BT_MINUS):
  15494. ptr += uintptr(1)
  15495. case int32(_BT_LEAD2):
  15496. if int64(end)-int64(ptr) < int64(2) {
  15497. return -int32(2)
  15498. }
  15499. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  15500. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15501. return m_XML_TOK_INVALID
  15502. }
  15503. ptr += uintptr(2)
  15504. case int32(_BT_LEAD3):
  15505. if int64(end)-int64(ptr) < int64(3) {
  15506. return -int32(2)
  15507. }
  15508. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  15509. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15510. return m_XML_TOK_INVALID
  15511. }
  15512. ptr += uintptr(3)
  15513. case int32(_BT_LEAD4):
  15514. if int64(end)-int64(ptr) < int64(4) {
  15515. return -int32(2)
  15516. }
  15517. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  15518. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15519. return m_XML_TOK_INVALID
  15520. }
  15521. ptr += uintptr(4)
  15522. case int32(_BT_GT):
  15523. fallthrough
  15524. case int32(_BT_RPAR):
  15525. fallthrough
  15526. case int32(_BT_COMMA):
  15527. fallthrough
  15528. case int32(_BT_VERBAR):
  15529. fallthrough
  15530. case int32(_BT_LSQB):
  15531. fallthrough
  15532. case int32(_BT_PERCNT):
  15533. fallthrough
  15534. case int32(_BT_S):
  15535. fallthrough
  15536. case int32(_BT_CR):
  15537. fallthrough
  15538. case int32(_BT_LF):
  15539. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15540. return tok
  15541. case int32(_BT_COLON):
  15542. ptr += uintptr(1)
  15543. switch tok {
  15544. case int32(m_XML_TOK_NAME):
  15545. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15546. return -int32(1)
  15547. }
  15548. tok = int32(m_XML_TOK_PREFIXED_NAME)
  15549. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15550. case int32(_BT_NONASCII):
  15551. if !(libc.Int32FromInt32(0) != 0) {
  15552. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15553. return m_XML_TOK_INVALID
  15554. } /* fall through */
  15555. fallthrough
  15556. case int32(_BT_NMSTRT):
  15557. fallthrough
  15558. case int32(_BT_HEX):
  15559. fallthrough
  15560. case int32(_BT_DIGIT):
  15561. fallthrough
  15562. case int32(_BT_NAME):
  15563. fallthrough
  15564. case int32(_BT_MINUS):
  15565. ptr += uintptr(1)
  15566. case int32(_BT_LEAD2):
  15567. if int64(end)-int64(ptr) < int64(2) {
  15568. return -int32(2)
  15569. }
  15570. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  15571. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15572. return m_XML_TOK_INVALID
  15573. }
  15574. ptr += uintptr(2)
  15575. case int32(_BT_LEAD3):
  15576. if int64(end)-int64(ptr) < int64(3) {
  15577. return -int32(2)
  15578. }
  15579. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  15580. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15581. return m_XML_TOK_INVALID
  15582. }
  15583. ptr += uintptr(3)
  15584. case int32(_BT_LEAD4):
  15585. if int64(end)-int64(ptr) < int64(4) {
  15586. return -int32(2)
  15587. }
  15588. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  15589. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15590. return m_XML_TOK_INVALID
  15591. }
  15592. ptr += uintptr(4)
  15593. default:
  15594. tok = int32(m_XML_TOK_NMTOKEN)
  15595. break
  15596. }
  15597. case int32(m_XML_TOK_PREFIXED_NAME):
  15598. tok = int32(m_XML_TOK_NMTOKEN)
  15599. break
  15600. }
  15601. case int32(_BT_PLUS):
  15602. if tok == int32(m_XML_TOK_NMTOKEN) {
  15603. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15604. return m_XML_TOK_INVALID
  15605. }
  15606. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15607. return int32(m_XML_TOK_NAME_PLUS)
  15608. case int32(_BT_AST):
  15609. if tok == int32(m_XML_TOK_NMTOKEN) {
  15610. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15611. return m_XML_TOK_INVALID
  15612. }
  15613. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15614. return int32(m_XML_TOK_NAME_ASTERISK)
  15615. case int32(_BT_QUEST):
  15616. if tok == int32(m_XML_TOK_NMTOKEN) {
  15617. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15618. return m_XML_TOK_INVALID
  15619. }
  15620. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15621. return int32(m_XML_TOK_NAME_QUESTION)
  15622. default:
  15623. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15624. return m_XML_TOK_INVALID
  15625. }
  15626. }
  15627. return -tok
  15628. }
  15629. func _normal_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15630. var start uintptr
  15631. _ = start
  15632. if ptr >= end {
  15633. return -int32(4)
  15634. } else {
  15635. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15636. /* This line cannot be executed. The incoming data has already
  15637. * been tokenized once, so incomplete characters like this have
  15638. * already been eliminated from the input. Retaining the paranoia
  15639. * check is still valuable, however.
  15640. */
  15641. return -int32(1) /* LCOV_EXCL_LINE */
  15642. }
  15643. }
  15644. start = ptr
  15645. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15646. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15647. case int32(_BT_LEAD2):
  15648. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  15649. case int32(_BT_LEAD3):
  15650. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  15651. case int32(_BT_LEAD4):
  15652. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  15653. case int32(_BT_AMP):
  15654. if ptr == start {
  15655. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15656. }
  15657. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15658. return int32(m_XML_TOK_DATA_CHARS)
  15659. case int32(_BT_LT):
  15660. /* this is for inside entity references */
  15661. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15662. return m_XML_TOK_INVALID
  15663. case int32(_BT_LF):
  15664. if ptr == start {
  15665. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15666. return int32(m_XML_TOK_DATA_NEWLINE)
  15667. }
  15668. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15669. return int32(m_XML_TOK_DATA_CHARS)
  15670. case int32(_BT_CR):
  15671. if ptr == start {
  15672. ptr += uintptr(1)
  15673. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15674. return -int32(3)
  15675. }
  15676. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  15677. ptr += uintptr(1)
  15678. }
  15679. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15680. return int32(m_XML_TOK_DATA_NEWLINE)
  15681. }
  15682. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15683. return int32(m_XML_TOK_DATA_CHARS)
  15684. case int32(_BT_S):
  15685. if ptr == start {
  15686. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15687. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  15688. }
  15689. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15690. return int32(m_XML_TOK_DATA_CHARS)
  15691. default:
  15692. ptr += uintptr(1)
  15693. break
  15694. }
  15695. }
  15696. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15697. return int32(m_XML_TOK_DATA_CHARS)
  15698. }
  15699. func _normal_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15700. var start uintptr
  15701. var tok, v1 int32
  15702. _, _, _ = start, tok, v1
  15703. if ptr >= end {
  15704. return -int32(4)
  15705. } else {
  15706. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15707. /* This line cannot be executed. The incoming data has already
  15708. * been tokenized once, so incomplete characters like this have
  15709. * already been eliminated from the input. Retaining the paranoia
  15710. * check is still valuable, however.
  15711. */
  15712. return -int32(1) /* LCOV_EXCL_LINE */
  15713. }
  15714. }
  15715. start = ptr
  15716. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15717. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15718. case int32(_BT_LEAD2):
  15719. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  15720. case int32(_BT_LEAD3):
  15721. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  15722. case int32(_BT_LEAD4):
  15723. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  15724. case int32(_BT_AMP):
  15725. if ptr == start {
  15726. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15727. }
  15728. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15729. return int32(m_XML_TOK_DATA_CHARS)
  15730. case int32(_BT_PERCNT):
  15731. if ptr == start {
  15732. tok = _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15733. if tok == int32(m_XML_TOK_PERCENT) {
  15734. v1 = m_XML_TOK_INVALID
  15735. } else {
  15736. v1 = tok
  15737. }
  15738. return v1
  15739. }
  15740. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15741. return int32(m_XML_TOK_DATA_CHARS)
  15742. case int32(_BT_LF):
  15743. if ptr == start {
  15744. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15745. return int32(m_XML_TOK_DATA_NEWLINE)
  15746. }
  15747. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15748. return int32(m_XML_TOK_DATA_CHARS)
  15749. case int32(_BT_CR):
  15750. if ptr == start {
  15751. ptr += uintptr(1)
  15752. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15753. return -int32(3)
  15754. }
  15755. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  15756. ptr += uintptr(1)
  15757. }
  15758. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15759. return int32(m_XML_TOK_DATA_NEWLINE)
  15760. }
  15761. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15762. return int32(m_XML_TOK_DATA_CHARS)
  15763. default:
  15764. ptr += uintptr(1)
  15765. break
  15766. }
  15767. }
  15768. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15769. return int32(m_XML_TOK_DATA_CHARS)
  15770. }
  15771. func _normal_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15772. var level int32
  15773. var n Tsize_t
  15774. _, _ = level, n
  15775. level = 0
  15776. if int32(1) > int32(1) {
  15777. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  15778. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  15779. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  15780. end = ptr + uintptr(n)
  15781. }
  15782. }
  15783. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15784. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15785. case int32(_BT_LEAD2):
  15786. if int64(end)-int64(ptr) < int64(2) {
  15787. return -int32(2)
  15788. }
  15789. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15790. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15791. return m_XML_TOK_INVALID
  15792. }
  15793. ptr += uintptr(2)
  15794. case int32(_BT_LEAD3):
  15795. if int64(end)-int64(ptr) < int64(3) {
  15796. return -int32(2)
  15797. }
  15798. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15799. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15800. return m_XML_TOK_INVALID
  15801. }
  15802. ptr += uintptr(3)
  15803. case int32(_BT_LEAD4):
  15804. if int64(end)-int64(ptr) < int64(4) {
  15805. return -int32(2)
  15806. }
  15807. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15808. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15809. return m_XML_TOK_INVALID
  15810. }
  15811. ptr += uintptr(4)
  15812. case int32(_BT_NONXML):
  15813. fallthrough
  15814. case int32(_BT_MALFORM):
  15815. fallthrough
  15816. case int32(_BT_TRAIL):
  15817. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15818. return m_XML_TOK_INVALID
  15819. case int32(_BT_LT):
  15820. ptr += uintptr(1)
  15821. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15822. return -int32(1)
  15823. }
  15824. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL2) {
  15825. ptr += uintptr(1)
  15826. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15827. return -int32(1)
  15828. }
  15829. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  15830. level++
  15831. ptr += uintptr(1)
  15832. }
  15833. }
  15834. case int32(_BT_RSQB):
  15835. ptr += uintptr(1)
  15836. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15837. return -int32(1)
  15838. }
  15839. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  15840. ptr += uintptr(1)
  15841. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15842. return -int32(1)
  15843. }
  15844. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  15845. ptr += uintptr(1)
  15846. if level == 0 {
  15847. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15848. return int32(m_XML_TOK_IGNORE_SECT)
  15849. }
  15850. level--
  15851. }
  15852. }
  15853. default:
  15854. ptr += uintptr(1)
  15855. break
  15856. }
  15857. }
  15858. return -int32(1)
  15859. }
  15860. func _normal_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  15861. ptr += uintptr(1)
  15862. end -= uintptr(1)
  15863. for {
  15864. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15865. break
  15866. }
  15867. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15868. case int32(_BT_DIGIT):
  15869. fallthrough
  15870. case int32(_BT_HEX):
  15871. fallthrough
  15872. case int32(_BT_MINUS):
  15873. fallthrough
  15874. case int32(_BT_APOS):
  15875. fallthrough
  15876. case int32(_BT_LPAR):
  15877. fallthrough
  15878. case int32(_BT_RPAR):
  15879. fallthrough
  15880. case int32(_BT_PLUS):
  15881. fallthrough
  15882. case int32(_BT_COMMA):
  15883. fallthrough
  15884. case int32(_BT_SOL):
  15885. fallthrough
  15886. case int32(_BT_EQUALS):
  15887. fallthrough
  15888. case int32(_BT_QUEST):
  15889. fallthrough
  15890. case int32(_BT_CR):
  15891. fallthrough
  15892. case int32(_BT_LF):
  15893. fallthrough
  15894. case int32(_BT_SEMI):
  15895. fallthrough
  15896. case int32(_BT_EXCL):
  15897. fallthrough
  15898. case int32(_BT_AST):
  15899. fallthrough
  15900. case int32(_BT_PERCNT):
  15901. fallthrough
  15902. case int32(_BT_NUM):
  15903. fallthrough
  15904. case int32(_BT_COLON):
  15905. case int32(_BT_S):
  15906. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  15907. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  15908. return 0
  15909. }
  15910. case int32(_BT_NAME):
  15911. fallthrough
  15912. case int32(_BT_NMSTRT):
  15913. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) & ^libc.Int32FromInt32(0x7f) != 0) {
  15914. break
  15915. }
  15916. /* fall through */
  15917. fallthrough
  15918. default:
  15919. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  15920. case int32(0x24): /* $ */
  15921. fallthrough
  15922. case int32(0x40): /* @ */
  15923. default:
  15924. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  15925. return 0
  15926. }
  15927. break
  15928. }
  15929. goto _1
  15930. _1:
  15931. ;
  15932. ptr += uintptr(1)
  15933. }
  15934. return int32(1)
  15935. }
  15936. /* This must only be called for a well-formed start-tag or empty
  15937. element tag. Returns the number of attributes. Pointers to the
  15938. first attsMax attributes are stored in atts.
  15939. */
  15940. func _normal_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  15941. var nAtts, open, state int32
  15942. _, _, _ = nAtts, open, state
  15943. state = 1
  15944. nAtts = 0
  15945. open = 0 /* defined when state == inValue;
  15946. initialization just to shut up compilers */
  15947. ptr += uintptr(1)
  15948. for {
  15949. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15950. case int32(_BT_LEAD2):
  15951. if state == 0 {
  15952. if nAtts < attsMax {
  15953. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  15954. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  15955. }
  15956. state = 1
  15957. }
  15958. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  15959. case int32(_BT_LEAD3):
  15960. if state == 0 {
  15961. if nAtts < attsMax {
  15962. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  15963. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  15964. }
  15965. state = 1
  15966. }
  15967. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  15968. case int32(_BT_LEAD4):
  15969. if state == 0 {
  15970. if nAtts < attsMax {
  15971. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  15972. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  15973. }
  15974. state = 1
  15975. }
  15976. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  15977. case int32(_BT_NONASCII):
  15978. fallthrough
  15979. case int32(_BT_NMSTRT):
  15980. fallthrough
  15981. case int32(_BT_HEX):
  15982. if state == 0 {
  15983. if nAtts < attsMax {
  15984. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  15985. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  15986. }
  15987. state = 1
  15988. }
  15989. case int32(_BT_QUOT):
  15990. if state != 2 {
  15991. if nAtts < attsMax {
  15992. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(1)
  15993. }
  15994. state = 2
  15995. open = int32(_BT_QUOT)
  15996. } else {
  15997. if open == int32(_BT_QUOT) {
  15998. state = 0
  15999. if nAtts < attsMax {
  16000. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  16001. }
  16002. nAtts++
  16003. }
  16004. }
  16005. case int32(_BT_APOS):
  16006. if state != 2 {
  16007. if nAtts < attsMax {
  16008. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(1)
  16009. }
  16010. state = 2
  16011. open = int32(_BT_APOS)
  16012. } else {
  16013. if open == int32(_BT_APOS) {
  16014. state = 0
  16015. if nAtts < attsMax {
  16016. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  16017. }
  16018. nAtts++
  16019. }
  16020. }
  16021. case int32(_BT_AMP):
  16022. if nAtts < attsMax {
  16023. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  16024. }
  16025. case int32(_BT_S):
  16026. if state == 1 {
  16027. state = 0
  16028. } else {
  16029. 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) {
  16030. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  16031. }
  16032. }
  16033. case int32(_BT_CR):
  16034. fallthrough
  16035. case int32(_BT_LF):
  16036. /* This case ensures that the first attribute name is counted
  16037. Apart from that we could just change state on the quote. */
  16038. if state == 1 {
  16039. state = 0
  16040. } else {
  16041. if state == 2 && nAtts < attsMax {
  16042. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  16043. }
  16044. }
  16045. case int32(_BT_GT):
  16046. fallthrough
  16047. case int32(_BT_SOL):
  16048. if state != 2 {
  16049. return nAtts
  16050. }
  16051. default:
  16052. break
  16053. }
  16054. goto _1
  16055. _1:
  16056. ;
  16057. ptr += uintptr(1)
  16058. }
  16059. /* not reached */
  16060. return r
  16061. }
  16062. func _normal_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  16063. var c, c1, result int32
  16064. _, _, _ = c, c1, result
  16065. result = 0
  16066. /* skip &# */
  16067. _ = enc
  16068. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(1))
  16069. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  16070. ptr += uintptr(1)
  16071. for {
  16072. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  16073. break
  16074. }
  16075. c = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  16076. switch c {
  16077. case int32(m_ASCII_02):
  16078. fallthrough
  16079. case int32(m_ASCII_12):
  16080. fallthrough
  16081. case int32(m_ASCII_22):
  16082. fallthrough
  16083. case int32(m_ASCII_32):
  16084. fallthrough
  16085. case int32(m_ASCII_41):
  16086. fallthrough
  16087. case int32(m_ASCII_51):
  16088. fallthrough
  16089. case int32(m_ASCII_61):
  16090. fallthrough
  16091. case int32(m_ASCII_71):
  16092. fallthrough
  16093. case int32(m_ASCII_82):
  16094. fallthrough
  16095. case int32(m_ASCII_92):
  16096. result <<= int32(4)
  16097. result |= c - int32(m_ASCII_02)
  16098. case int32(m_ASCII_A):
  16099. fallthrough
  16100. case int32(m_ASCII_B1):
  16101. fallthrough
  16102. case int32(m_ASCII_C):
  16103. fallthrough
  16104. case int32(m_ASCII_D):
  16105. fallthrough
  16106. case int32(m_ASCII_E):
  16107. fallthrough
  16108. case int32(m_ASCII_F):
  16109. result <<= int32(4)
  16110. result += int32(10) + (c - int32(m_ASCII_A))
  16111. case int32(m_ASCII_a2):
  16112. fallthrough
  16113. case int32(m_ASCII_b1):
  16114. fallthrough
  16115. case int32(m_ASCII_c2):
  16116. fallthrough
  16117. case int32(m_ASCII_d1):
  16118. fallthrough
  16119. case int32(m_ASCII_e2):
  16120. fallthrough
  16121. case int32(m_ASCII_f1):
  16122. result <<= int32(4)
  16123. result += int32(10) + (c - int32(m_ASCII_a2))
  16124. break
  16125. }
  16126. if result >= int32(0x110000) {
  16127. return -int32(1)
  16128. }
  16129. goto _1
  16130. _1:
  16131. ;
  16132. ptr += uintptr(1)
  16133. }
  16134. } else {
  16135. for {
  16136. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  16137. break
  16138. }
  16139. c1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  16140. result *= int32(10)
  16141. result += c1 - int32(m_ASCII_02)
  16142. if result >= int32(0x110000) {
  16143. return -int32(1)
  16144. }
  16145. goto _2
  16146. _2:
  16147. ;
  16148. ptr += uintptr(1)
  16149. }
  16150. }
  16151. return _checkCharRefNumber(tls, result)
  16152. }
  16153. func _normal_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  16154. _ = enc
  16155. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(1) {
  16156. case int64(2):
  16157. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_t2) {
  16158. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  16159. case int32(m_ASCII_l2):
  16160. return int32(m_ASCII_LT1)
  16161. case int32(m_ASCII_g2):
  16162. return int32(m_ASCII_GT1)
  16163. }
  16164. }
  16165. case int64(3):
  16166. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a2) {
  16167. ptr += uintptr(1)
  16168. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m2) {
  16169. ptr += uintptr(1)
  16170. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  16171. return int32(m_ASCII_AMP1)
  16172. }
  16173. }
  16174. }
  16175. case int64(4):
  16176. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  16177. case int32(m_ASCII_q1):
  16178. ptr += uintptr(1)
  16179. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  16180. ptr += uintptr(1)
  16181. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  16182. ptr += uintptr(1)
  16183. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t2) {
  16184. return int32(m_ASCII_QUOT1)
  16185. }
  16186. }
  16187. }
  16188. case int32(m_ASCII_a2):
  16189. ptr += uintptr(1)
  16190. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  16191. ptr += uintptr(1)
  16192. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  16193. ptr += uintptr(1)
  16194. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s2) {
  16195. return int32(m_ASCII_APOS1)
  16196. }
  16197. }
  16198. }
  16199. break
  16200. }
  16201. }
  16202. return 0
  16203. }
  16204. func _normal_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  16205. _ = enc
  16206. for {
  16207. if !(*(*uint8)(unsafe.Pointer(ptr2)) != 0) {
  16208. break
  16209. }
  16210. if int64(end1)-int64(ptr1) < int64(1) {
  16211. /* This line cannot be executed. The incoming data has already
  16212. * been tokenized once, so incomplete characters like this have
  16213. * already been eliminated from the input. Retaining the
  16214. * paranoia check is still valuable, however.
  16215. */
  16216. return 0 /* LCOV_EXCL_LINE */
  16217. }
  16218. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr2)))) {
  16219. return 0
  16220. }
  16221. goto _1
  16222. _1:
  16223. ;
  16224. ptr1 += uintptr(1)
  16225. ptr2++
  16226. }
  16227. return libc.BoolInt32(ptr1 == end1)
  16228. }
  16229. func _normal_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  16230. var start uintptr
  16231. _ = start
  16232. start = ptr
  16233. for {
  16234. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  16235. case int32(_BT_LEAD2):
  16236. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  16237. case int32(_BT_LEAD3):
  16238. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  16239. case int32(_BT_LEAD4):
  16240. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  16241. case int32(_BT_NONASCII):
  16242. fallthrough
  16243. case int32(_BT_NMSTRT):
  16244. fallthrough
  16245. case int32(_BT_COLON):
  16246. fallthrough
  16247. case int32(_BT_HEX):
  16248. fallthrough
  16249. case int32(_BT_DIGIT):
  16250. fallthrough
  16251. case int32(_BT_NAME):
  16252. fallthrough
  16253. case int32(_BT_MINUS):
  16254. ptr += uintptr(1)
  16255. default:
  16256. return int32(int64(ptr) - int64(start))
  16257. }
  16258. goto _1
  16259. _1:
  16260. }
  16261. return r
  16262. }
  16263. func _normal_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  16264. for {
  16265. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  16266. case int32(_BT_LF):
  16267. fallthrough
  16268. case int32(_BT_CR):
  16269. fallthrough
  16270. case int32(_BT_S):
  16271. ptr += uintptr(1)
  16272. default:
  16273. return ptr
  16274. }
  16275. goto _1
  16276. _1:
  16277. }
  16278. return r
  16279. }
  16280. func _normal_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  16281. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  16282. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  16283. case int32(_BT_LEAD2):
  16284. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  16285. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16286. case int32(_BT_LEAD3):
  16287. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  16288. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16289. case int32(_BT_LEAD4):
  16290. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  16291. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16292. case int32(_BT_LF):
  16293. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  16294. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  16295. ptr += uintptr(1)
  16296. case int32(_BT_CR):
  16297. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  16298. ptr += uintptr(1)
  16299. 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) {
  16300. ptr += uintptr(1)
  16301. }
  16302. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  16303. default:
  16304. ptr += uintptr(1)
  16305. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16306. break
  16307. }
  16308. }
  16309. }
  16310. const /* UTF8_cvalN is value of masked first byte of N byte sequence */
  16311. _UTF8_cval1 = 0
  16312. const _UTF8_cval2 = 192
  16313. const _UTF8_cval3 = 224
  16314. const _UTF8_cval4 = 240
  16315. func X_INTERNAL_trim_to_complete_utf8_characters(tls *libc.TLS, from uintptr, fromLimRef uintptr) {
  16316. var fromLim uintptr
  16317. var prev uint8
  16318. var walked Tsize_t
  16319. _, _, _ = fromLim, prev, walked
  16320. fromLim = *(*uintptr)(unsafe.Pointer(fromLimRef))
  16321. walked = uint64(0)
  16322. for {
  16323. if !(fromLim > from) {
  16324. break
  16325. }
  16326. prev = *(*uint8)(unsafe.Pointer(fromLim + uintptr(-libc.Int32FromInt32(1))))
  16327. if uint32(prev)&uint32(0xf8) == uint32(0xf0) { /* 4-byte character, lead by 0b11110xxx byte */
  16328. if walked+uint64(1) >= uint64(4) {
  16329. fromLim += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  16330. break
  16331. } else {
  16332. walked = uint64(0)
  16333. }
  16334. } else {
  16335. if uint32(prev)&uint32(0xf0) == uint32(0xe0) { /* 3-byte character, lead by 0b1110xxxx byte */
  16336. if walked+uint64(1) >= uint64(3) {
  16337. fromLim += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  16338. break
  16339. } else {
  16340. walked = uint64(0)
  16341. }
  16342. } else {
  16343. if uint32(prev)&uint32(0xe0) == uint32(0xc0) { /* 2-byte character, lead by 0b110xxxxx byte */
  16344. if walked+uint64(1) >= uint64(2) {
  16345. fromLim += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  16346. break
  16347. } else {
  16348. walked = uint64(0)
  16349. }
  16350. } else {
  16351. if uint32(prev)&uint32(0x80) == 0x00 { /* 1-byte character, matching 0b0xxxxxxx */
  16352. break
  16353. }
  16354. }
  16355. }
  16356. }
  16357. goto _1
  16358. _1:
  16359. ;
  16360. fromLim--
  16361. walked++
  16362. }
  16363. *(*uintptr)(unsafe.Pointer(fromLimRef)) = fromLim
  16364. }
  16365. func _utf8_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, _fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  16366. bp := tls.Alloc(16)
  16367. defer tls.Free(16)
  16368. *(*uintptr)(unsafe.Pointer(bp)) = _fromLim
  16369. var bytesAvailable, bytesStorable, bytesToCopy Tptrdiff_t
  16370. var fromLimBefore uintptr
  16371. var input_incomplete, output_exhausted uint8
  16372. _, _, _, _, _, _ = bytesAvailable, bytesStorable, bytesToCopy, fromLimBefore, input_incomplete, output_exhausted
  16373. input_incomplete = uint8(m_false)
  16374. output_exhausted = uint8(m_false)
  16375. /* Avoid copying partial characters (due to limited space). */
  16376. bytesAvailable = int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(*(*uintptr)(unsafe.Pointer(fromP)))
  16377. bytesStorable = int64(toLim) - int64(*(*uintptr)(unsafe.Pointer(toP)))
  16378. _ = enc
  16379. if bytesAvailable > bytesStorable {
  16380. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr(bytesStorable)
  16381. output_exhausted = uint8(m_true)
  16382. }
  16383. /* Avoid copying partial characters (from incomplete input). */
  16384. fromLimBefore = *(*uintptr)(unsafe.Pointer(bp))
  16385. X_INTERNAL_trim_to_complete_utf8_characters(tls, *(*uintptr)(unsafe.Pointer(fromP)), bp)
  16386. if *(*uintptr)(unsafe.Pointer(bp)) < fromLimBefore {
  16387. input_incomplete = uint8(m_true)
  16388. }
  16389. bytesToCopy = int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(*(*uintptr)(unsafe.Pointer(fromP)))
  16390. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), *(*uintptr)(unsafe.Pointer(fromP)), libc.Uint64FromInt64(bytesToCopy))
  16391. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(bytesToCopy)
  16392. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(bytesToCopy)
  16393. if output_exhausted != 0 { /* needs to go first */
  16394. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16395. } else {
  16396. if input_incomplete != 0 {
  16397. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16398. } else {
  16399. return int32(_XML_CONVERT_COMPLETED)
  16400. }
  16401. }
  16402. return r
  16403. }
  16404. func _utf8_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  16405. var from, to, v1, v2, v3, v4 uintptr
  16406. var n uint64
  16407. var res _XML_Convert_Result
  16408. _, _, _, _, _, _, _, _ = from, n, res, to, v1, v2, v3, v4
  16409. res = int32(_XML_CONVERT_COMPLETED)
  16410. to = *(*uintptr)(unsafe.Pointer(toP))
  16411. from = *(*uintptr)(unsafe.Pointer(fromP))
  16412. for from < fromLim && to < toLim {
  16413. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(from)))))) {
  16414. case int32(_BT_LEAD2):
  16415. if int64(fromLim)-int64(from) < int64(2) {
  16416. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16417. goto after
  16418. }
  16419. v1 = to
  16420. to += 2
  16421. *(*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))
  16422. from += uintptr(2)
  16423. case int32(_BT_LEAD3):
  16424. if int64(fromLim)-int64(from) < int64(3) {
  16425. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16426. goto after
  16427. }
  16428. v2 = to
  16429. to += 2
  16430. *(*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))
  16431. from += uintptr(3)
  16432. case int32(_BT_LEAD4):
  16433. if (int64(toLim)-int64(to))/2 < int64(2) {
  16434. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16435. goto after
  16436. }
  16437. if int64(fromLim)-int64(from) < int64(4) {
  16438. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16439. goto after
  16440. }
  16441. 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))
  16442. n -= uint64(0x10000)
  16443. *(*uint16)(unsafe.Pointer(to)) = uint16(n>>libc.Int32FromInt32(10) | libc.Uint64FromInt32(0xD800))
  16444. *(*uint16)(unsafe.Pointer(to + 1*2)) = uint16(n&libc.Uint64FromInt32(0x3FF) | libc.Uint64FromInt32(0xDC00))
  16445. to += uintptr(2) * 2
  16446. from += uintptr(4)
  16447. default:
  16448. v3 = to
  16449. to += 2
  16450. v4 = from
  16451. from++
  16452. *(*uint16)(unsafe.Pointer(v3)) = uint16(*(*uint8)(unsafe.Pointer(v4)))
  16453. break
  16454. }
  16455. }
  16456. if from < fromLim {
  16457. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16458. }
  16459. goto after
  16460. after:
  16461. ;
  16462. *(*uintptr)(unsafe.Pointer(fromP)) = from
  16463. *(*uintptr)(unsafe.Pointer(toP)) = to
  16464. return res
  16465. }
  16466. var _utf8_encoding_ns = Tnormal_encoding{
  16467. Fenc: TENCODING{
  16468. Fscanners: [4]TSCANNER{},
  16469. FliteralScanners: [2]TSCANNER{},
  16470. FminBytesPerChar: int32(1),
  16471. FisUtf8: uint8(1),
  16472. },
  16473. Ftype1: [256]uint8{
  16474. 9: uint8(_BT_S),
  16475. 10: uint8(_BT_LF),
  16476. 13: uint8(_BT_CR),
  16477. 32: uint8(_BT_S),
  16478. 33: uint8(_BT_EXCL),
  16479. 34: uint8(_BT_QUOT),
  16480. 35: uint8(_BT_NUM),
  16481. 36: uint8(_BT_OTHER),
  16482. 37: uint8(_BT_PERCNT),
  16483. 38: uint8(_BT_AMP),
  16484. 39: uint8(_BT_APOS),
  16485. 40: uint8(_BT_LPAR),
  16486. 41: uint8(_BT_RPAR),
  16487. 42: uint8(_BT_AST),
  16488. 43: uint8(_BT_PLUS),
  16489. 44: uint8(_BT_COMMA),
  16490. 45: uint8(_BT_MINUS),
  16491. 46: uint8(_BT_NAME),
  16492. 47: uint8(_BT_SOL),
  16493. 48: uint8(_BT_DIGIT),
  16494. 49: uint8(_BT_DIGIT),
  16495. 50: uint8(_BT_DIGIT),
  16496. 51: uint8(_BT_DIGIT),
  16497. 52: uint8(_BT_DIGIT),
  16498. 53: uint8(_BT_DIGIT),
  16499. 54: uint8(_BT_DIGIT),
  16500. 55: uint8(_BT_DIGIT),
  16501. 56: uint8(_BT_DIGIT),
  16502. 57: uint8(_BT_DIGIT),
  16503. 58: uint8(_BT_COLON),
  16504. 59: uint8(_BT_SEMI),
  16505. 60: uint8(_BT_LT),
  16506. 61: uint8(_BT_EQUALS),
  16507. 62: uint8(_BT_GT),
  16508. 63: uint8(_BT_QUEST),
  16509. 64: uint8(_BT_OTHER),
  16510. 65: uint8(_BT_HEX),
  16511. 66: uint8(_BT_HEX),
  16512. 67: uint8(_BT_HEX),
  16513. 68: uint8(_BT_HEX),
  16514. 69: uint8(_BT_HEX),
  16515. 70: uint8(_BT_HEX),
  16516. 71: uint8(_BT_NMSTRT),
  16517. 72: uint8(_BT_NMSTRT),
  16518. 73: uint8(_BT_NMSTRT),
  16519. 74: uint8(_BT_NMSTRT),
  16520. 75: uint8(_BT_NMSTRT),
  16521. 76: uint8(_BT_NMSTRT),
  16522. 77: uint8(_BT_NMSTRT),
  16523. 78: uint8(_BT_NMSTRT),
  16524. 79: uint8(_BT_NMSTRT),
  16525. 80: uint8(_BT_NMSTRT),
  16526. 81: uint8(_BT_NMSTRT),
  16527. 82: uint8(_BT_NMSTRT),
  16528. 83: uint8(_BT_NMSTRT),
  16529. 84: uint8(_BT_NMSTRT),
  16530. 85: uint8(_BT_NMSTRT),
  16531. 86: uint8(_BT_NMSTRT),
  16532. 87: uint8(_BT_NMSTRT),
  16533. 88: uint8(_BT_NMSTRT),
  16534. 89: uint8(_BT_NMSTRT),
  16535. 90: uint8(_BT_NMSTRT),
  16536. 91: uint8(_BT_LSQB),
  16537. 92: uint8(_BT_OTHER),
  16538. 93: uint8(_BT_RSQB),
  16539. 94: uint8(_BT_OTHER),
  16540. 95: uint8(_BT_NMSTRT),
  16541. 96: uint8(_BT_OTHER),
  16542. 97: uint8(_BT_HEX),
  16543. 98: uint8(_BT_HEX),
  16544. 99: uint8(_BT_HEX),
  16545. 100: uint8(_BT_HEX),
  16546. 101: uint8(_BT_HEX),
  16547. 102: uint8(_BT_HEX),
  16548. 103: uint8(_BT_NMSTRT),
  16549. 104: uint8(_BT_NMSTRT),
  16550. 105: uint8(_BT_NMSTRT),
  16551. 106: uint8(_BT_NMSTRT),
  16552. 107: uint8(_BT_NMSTRT),
  16553. 108: uint8(_BT_NMSTRT),
  16554. 109: uint8(_BT_NMSTRT),
  16555. 110: uint8(_BT_NMSTRT),
  16556. 111: uint8(_BT_NMSTRT),
  16557. 112: uint8(_BT_NMSTRT),
  16558. 113: uint8(_BT_NMSTRT),
  16559. 114: uint8(_BT_NMSTRT),
  16560. 115: uint8(_BT_NMSTRT),
  16561. 116: uint8(_BT_NMSTRT),
  16562. 117: uint8(_BT_NMSTRT),
  16563. 118: uint8(_BT_NMSTRT),
  16564. 119: uint8(_BT_NMSTRT),
  16565. 120: uint8(_BT_NMSTRT),
  16566. 121: uint8(_BT_NMSTRT),
  16567. 122: uint8(_BT_NMSTRT),
  16568. 123: uint8(_BT_OTHER),
  16569. 124: uint8(_BT_VERBAR),
  16570. 125: uint8(_BT_OTHER),
  16571. 126: uint8(_BT_OTHER),
  16572. 127: uint8(_BT_OTHER),
  16573. 128: uint8(_BT_TRAIL),
  16574. 129: uint8(_BT_TRAIL),
  16575. 130: uint8(_BT_TRAIL),
  16576. 131: uint8(_BT_TRAIL),
  16577. 132: uint8(_BT_TRAIL),
  16578. 133: uint8(_BT_TRAIL),
  16579. 134: uint8(_BT_TRAIL),
  16580. 135: uint8(_BT_TRAIL),
  16581. 136: uint8(_BT_TRAIL),
  16582. 137: uint8(_BT_TRAIL),
  16583. 138: uint8(_BT_TRAIL),
  16584. 139: uint8(_BT_TRAIL),
  16585. 140: uint8(_BT_TRAIL),
  16586. 141: uint8(_BT_TRAIL),
  16587. 142: uint8(_BT_TRAIL),
  16588. 143: uint8(_BT_TRAIL),
  16589. 144: uint8(_BT_TRAIL),
  16590. 145: uint8(_BT_TRAIL),
  16591. 146: uint8(_BT_TRAIL),
  16592. 147: uint8(_BT_TRAIL),
  16593. 148: uint8(_BT_TRAIL),
  16594. 149: uint8(_BT_TRAIL),
  16595. 150: uint8(_BT_TRAIL),
  16596. 151: uint8(_BT_TRAIL),
  16597. 152: uint8(_BT_TRAIL),
  16598. 153: uint8(_BT_TRAIL),
  16599. 154: uint8(_BT_TRAIL),
  16600. 155: uint8(_BT_TRAIL),
  16601. 156: uint8(_BT_TRAIL),
  16602. 157: uint8(_BT_TRAIL),
  16603. 158: uint8(_BT_TRAIL),
  16604. 159: uint8(_BT_TRAIL),
  16605. 160: uint8(_BT_TRAIL),
  16606. 161: uint8(_BT_TRAIL),
  16607. 162: uint8(_BT_TRAIL),
  16608. 163: uint8(_BT_TRAIL),
  16609. 164: uint8(_BT_TRAIL),
  16610. 165: uint8(_BT_TRAIL),
  16611. 166: uint8(_BT_TRAIL),
  16612. 167: uint8(_BT_TRAIL),
  16613. 168: uint8(_BT_TRAIL),
  16614. 169: uint8(_BT_TRAIL),
  16615. 170: uint8(_BT_TRAIL),
  16616. 171: uint8(_BT_TRAIL),
  16617. 172: uint8(_BT_TRAIL),
  16618. 173: uint8(_BT_TRAIL),
  16619. 174: uint8(_BT_TRAIL),
  16620. 175: uint8(_BT_TRAIL),
  16621. 176: uint8(_BT_TRAIL),
  16622. 177: uint8(_BT_TRAIL),
  16623. 178: uint8(_BT_TRAIL),
  16624. 179: uint8(_BT_TRAIL),
  16625. 180: uint8(_BT_TRAIL),
  16626. 181: uint8(_BT_TRAIL),
  16627. 182: uint8(_BT_TRAIL),
  16628. 183: uint8(_BT_TRAIL),
  16629. 184: uint8(_BT_TRAIL),
  16630. 185: uint8(_BT_TRAIL),
  16631. 186: uint8(_BT_TRAIL),
  16632. 187: uint8(_BT_TRAIL),
  16633. 188: uint8(_BT_TRAIL),
  16634. 189: uint8(_BT_TRAIL),
  16635. 190: uint8(_BT_TRAIL),
  16636. 191: uint8(_BT_TRAIL),
  16637. 192: uint8(_BT_LEAD2),
  16638. 193: uint8(_BT_LEAD2),
  16639. 194: uint8(_BT_LEAD2),
  16640. 195: uint8(_BT_LEAD2),
  16641. 196: uint8(_BT_LEAD2),
  16642. 197: uint8(_BT_LEAD2),
  16643. 198: uint8(_BT_LEAD2),
  16644. 199: uint8(_BT_LEAD2),
  16645. 200: uint8(_BT_LEAD2),
  16646. 201: uint8(_BT_LEAD2),
  16647. 202: uint8(_BT_LEAD2),
  16648. 203: uint8(_BT_LEAD2),
  16649. 204: uint8(_BT_LEAD2),
  16650. 205: uint8(_BT_LEAD2),
  16651. 206: uint8(_BT_LEAD2),
  16652. 207: uint8(_BT_LEAD2),
  16653. 208: uint8(_BT_LEAD2),
  16654. 209: uint8(_BT_LEAD2),
  16655. 210: uint8(_BT_LEAD2),
  16656. 211: uint8(_BT_LEAD2),
  16657. 212: uint8(_BT_LEAD2),
  16658. 213: uint8(_BT_LEAD2),
  16659. 214: uint8(_BT_LEAD2),
  16660. 215: uint8(_BT_LEAD2),
  16661. 216: uint8(_BT_LEAD2),
  16662. 217: uint8(_BT_LEAD2),
  16663. 218: uint8(_BT_LEAD2),
  16664. 219: uint8(_BT_LEAD2),
  16665. 220: uint8(_BT_LEAD2),
  16666. 221: uint8(_BT_LEAD2),
  16667. 222: uint8(_BT_LEAD2),
  16668. 223: uint8(_BT_LEAD2),
  16669. 224: uint8(_BT_LEAD3),
  16670. 225: uint8(_BT_LEAD3),
  16671. 226: uint8(_BT_LEAD3),
  16672. 227: uint8(_BT_LEAD3),
  16673. 228: uint8(_BT_LEAD3),
  16674. 229: uint8(_BT_LEAD3),
  16675. 230: uint8(_BT_LEAD3),
  16676. 231: uint8(_BT_LEAD3),
  16677. 232: uint8(_BT_LEAD3),
  16678. 233: uint8(_BT_LEAD3),
  16679. 234: uint8(_BT_LEAD3),
  16680. 235: uint8(_BT_LEAD3),
  16681. 236: uint8(_BT_LEAD3),
  16682. 237: uint8(_BT_LEAD3),
  16683. 238: uint8(_BT_LEAD3),
  16684. 239: uint8(_BT_LEAD3),
  16685. 240: uint8(_BT_LEAD4),
  16686. 241: uint8(_BT_LEAD4),
  16687. 242: uint8(_BT_LEAD4),
  16688. 243: uint8(_BT_LEAD4),
  16689. 244: uint8(_BT_LEAD4),
  16690. 254: uint8(_BT_MALFORM),
  16691. 255: uint8(_BT_MALFORM),
  16692. },
  16693. }
  16694. func init() {
  16695. p := unsafe.Pointer(&_utf8_encoding_ns)
  16696. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  16697. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  16698. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  16699. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  16700. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  16701. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  16702. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  16703. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  16704. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  16705. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  16706. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  16707. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  16708. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  16709. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  16710. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  16711. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  16712. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  16713. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  16714. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  16715. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  16716. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  16717. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  16718. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  16719. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  16720. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  16721. }
  16722. var _utf8_encoding = Tnormal_encoding{
  16723. Fenc: TENCODING{
  16724. Fscanners: [4]TSCANNER{},
  16725. FliteralScanners: [2]TSCANNER{},
  16726. FminBytesPerChar: int32(1),
  16727. FisUtf8: uint8(1),
  16728. },
  16729. Ftype1: [256]uint8{
  16730. 9: uint8(_BT_S),
  16731. 10: uint8(_BT_LF),
  16732. 13: uint8(_BT_CR),
  16733. 32: uint8(_BT_S),
  16734. 33: uint8(_BT_EXCL),
  16735. 34: uint8(_BT_QUOT),
  16736. 35: uint8(_BT_NUM),
  16737. 36: uint8(_BT_OTHER),
  16738. 37: uint8(_BT_PERCNT),
  16739. 38: uint8(_BT_AMP),
  16740. 39: uint8(_BT_APOS),
  16741. 40: uint8(_BT_LPAR),
  16742. 41: uint8(_BT_RPAR),
  16743. 42: uint8(_BT_AST),
  16744. 43: uint8(_BT_PLUS),
  16745. 44: uint8(_BT_COMMA),
  16746. 45: uint8(_BT_MINUS),
  16747. 46: uint8(_BT_NAME),
  16748. 47: uint8(_BT_SOL),
  16749. 48: uint8(_BT_DIGIT),
  16750. 49: uint8(_BT_DIGIT),
  16751. 50: uint8(_BT_DIGIT),
  16752. 51: uint8(_BT_DIGIT),
  16753. 52: uint8(_BT_DIGIT),
  16754. 53: uint8(_BT_DIGIT),
  16755. 54: uint8(_BT_DIGIT),
  16756. 55: uint8(_BT_DIGIT),
  16757. 56: uint8(_BT_DIGIT),
  16758. 57: uint8(_BT_DIGIT),
  16759. 58: uint8(_BT_NMSTRT),
  16760. 59: uint8(_BT_SEMI),
  16761. 60: uint8(_BT_LT),
  16762. 61: uint8(_BT_EQUALS),
  16763. 62: uint8(_BT_GT),
  16764. 63: uint8(_BT_QUEST),
  16765. 64: uint8(_BT_OTHER),
  16766. 65: uint8(_BT_HEX),
  16767. 66: uint8(_BT_HEX),
  16768. 67: uint8(_BT_HEX),
  16769. 68: uint8(_BT_HEX),
  16770. 69: uint8(_BT_HEX),
  16771. 70: uint8(_BT_HEX),
  16772. 71: uint8(_BT_NMSTRT),
  16773. 72: uint8(_BT_NMSTRT),
  16774. 73: uint8(_BT_NMSTRT),
  16775. 74: uint8(_BT_NMSTRT),
  16776. 75: uint8(_BT_NMSTRT),
  16777. 76: uint8(_BT_NMSTRT),
  16778. 77: uint8(_BT_NMSTRT),
  16779. 78: uint8(_BT_NMSTRT),
  16780. 79: uint8(_BT_NMSTRT),
  16781. 80: uint8(_BT_NMSTRT),
  16782. 81: uint8(_BT_NMSTRT),
  16783. 82: uint8(_BT_NMSTRT),
  16784. 83: uint8(_BT_NMSTRT),
  16785. 84: uint8(_BT_NMSTRT),
  16786. 85: uint8(_BT_NMSTRT),
  16787. 86: uint8(_BT_NMSTRT),
  16788. 87: uint8(_BT_NMSTRT),
  16789. 88: uint8(_BT_NMSTRT),
  16790. 89: uint8(_BT_NMSTRT),
  16791. 90: uint8(_BT_NMSTRT),
  16792. 91: uint8(_BT_LSQB),
  16793. 92: uint8(_BT_OTHER),
  16794. 93: uint8(_BT_RSQB),
  16795. 94: uint8(_BT_OTHER),
  16796. 95: uint8(_BT_NMSTRT),
  16797. 96: uint8(_BT_OTHER),
  16798. 97: uint8(_BT_HEX),
  16799. 98: uint8(_BT_HEX),
  16800. 99: uint8(_BT_HEX),
  16801. 100: uint8(_BT_HEX),
  16802. 101: uint8(_BT_HEX),
  16803. 102: uint8(_BT_HEX),
  16804. 103: uint8(_BT_NMSTRT),
  16805. 104: uint8(_BT_NMSTRT),
  16806. 105: uint8(_BT_NMSTRT),
  16807. 106: uint8(_BT_NMSTRT),
  16808. 107: uint8(_BT_NMSTRT),
  16809. 108: uint8(_BT_NMSTRT),
  16810. 109: uint8(_BT_NMSTRT),
  16811. 110: uint8(_BT_NMSTRT),
  16812. 111: uint8(_BT_NMSTRT),
  16813. 112: uint8(_BT_NMSTRT),
  16814. 113: uint8(_BT_NMSTRT),
  16815. 114: uint8(_BT_NMSTRT),
  16816. 115: uint8(_BT_NMSTRT),
  16817. 116: uint8(_BT_NMSTRT),
  16818. 117: uint8(_BT_NMSTRT),
  16819. 118: uint8(_BT_NMSTRT),
  16820. 119: uint8(_BT_NMSTRT),
  16821. 120: uint8(_BT_NMSTRT),
  16822. 121: uint8(_BT_NMSTRT),
  16823. 122: uint8(_BT_NMSTRT),
  16824. 123: uint8(_BT_OTHER),
  16825. 124: uint8(_BT_VERBAR),
  16826. 125: uint8(_BT_OTHER),
  16827. 126: uint8(_BT_OTHER),
  16828. 127: uint8(_BT_OTHER),
  16829. 128: uint8(_BT_TRAIL),
  16830. 129: uint8(_BT_TRAIL),
  16831. 130: uint8(_BT_TRAIL),
  16832. 131: uint8(_BT_TRAIL),
  16833. 132: uint8(_BT_TRAIL),
  16834. 133: uint8(_BT_TRAIL),
  16835. 134: uint8(_BT_TRAIL),
  16836. 135: uint8(_BT_TRAIL),
  16837. 136: uint8(_BT_TRAIL),
  16838. 137: uint8(_BT_TRAIL),
  16839. 138: uint8(_BT_TRAIL),
  16840. 139: uint8(_BT_TRAIL),
  16841. 140: uint8(_BT_TRAIL),
  16842. 141: uint8(_BT_TRAIL),
  16843. 142: uint8(_BT_TRAIL),
  16844. 143: uint8(_BT_TRAIL),
  16845. 144: uint8(_BT_TRAIL),
  16846. 145: uint8(_BT_TRAIL),
  16847. 146: uint8(_BT_TRAIL),
  16848. 147: uint8(_BT_TRAIL),
  16849. 148: uint8(_BT_TRAIL),
  16850. 149: uint8(_BT_TRAIL),
  16851. 150: uint8(_BT_TRAIL),
  16852. 151: uint8(_BT_TRAIL),
  16853. 152: uint8(_BT_TRAIL),
  16854. 153: uint8(_BT_TRAIL),
  16855. 154: uint8(_BT_TRAIL),
  16856. 155: uint8(_BT_TRAIL),
  16857. 156: uint8(_BT_TRAIL),
  16858. 157: uint8(_BT_TRAIL),
  16859. 158: uint8(_BT_TRAIL),
  16860. 159: uint8(_BT_TRAIL),
  16861. 160: uint8(_BT_TRAIL),
  16862. 161: uint8(_BT_TRAIL),
  16863. 162: uint8(_BT_TRAIL),
  16864. 163: uint8(_BT_TRAIL),
  16865. 164: uint8(_BT_TRAIL),
  16866. 165: uint8(_BT_TRAIL),
  16867. 166: uint8(_BT_TRAIL),
  16868. 167: uint8(_BT_TRAIL),
  16869. 168: uint8(_BT_TRAIL),
  16870. 169: uint8(_BT_TRAIL),
  16871. 170: uint8(_BT_TRAIL),
  16872. 171: uint8(_BT_TRAIL),
  16873. 172: uint8(_BT_TRAIL),
  16874. 173: uint8(_BT_TRAIL),
  16875. 174: uint8(_BT_TRAIL),
  16876. 175: uint8(_BT_TRAIL),
  16877. 176: uint8(_BT_TRAIL),
  16878. 177: uint8(_BT_TRAIL),
  16879. 178: uint8(_BT_TRAIL),
  16880. 179: uint8(_BT_TRAIL),
  16881. 180: uint8(_BT_TRAIL),
  16882. 181: uint8(_BT_TRAIL),
  16883. 182: uint8(_BT_TRAIL),
  16884. 183: uint8(_BT_TRAIL),
  16885. 184: uint8(_BT_TRAIL),
  16886. 185: uint8(_BT_TRAIL),
  16887. 186: uint8(_BT_TRAIL),
  16888. 187: uint8(_BT_TRAIL),
  16889. 188: uint8(_BT_TRAIL),
  16890. 189: uint8(_BT_TRAIL),
  16891. 190: uint8(_BT_TRAIL),
  16892. 191: uint8(_BT_TRAIL),
  16893. 192: uint8(_BT_LEAD2),
  16894. 193: uint8(_BT_LEAD2),
  16895. 194: uint8(_BT_LEAD2),
  16896. 195: uint8(_BT_LEAD2),
  16897. 196: uint8(_BT_LEAD2),
  16898. 197: uint8(_BT_LEAD2),
  16899. 198: uint8(_BT_LEAD2),
  16900. 199: uint8(_BT_LEAD2),
  16901. 200: uint8(_BT_LEAD2),
  16902. 201: uint8(_BT_LEAD2),
  16903. 202: uint8(_BT_LEAD2),
  16904. 203: uint8(_BT_LEAD2),
  16905. 204: uint8(_BT_LEAD2),
  16906. 205: uint8(_BT_LEAD2),
  16907. 206: uint8(_BT_LEAD2),
  16908. 207: uint8(_BT_LEAD2),
  16909. 208: uint8(_BT_LEAD2),
  16910. 209: uint8(_BT_LEAD2),
  16911. 210: uint8(_BT_LEAD2),
  16912. 211: uint8(_BT_LEAD2),
  16913. 212: uint8(_BT_LEAD2),
  16914. 213: uint8(_BT_LEAD2),
  16915. 214: uint8(_BT_LEAD2),
  16916. 215: uint8(_BT_LEAD2),
  16917. 216: uint8(_BT_LEAD2),
  16918. 217: uint8(_BT_LEAD2),
  16919. 218: uint8(_BT_LEAD2),
  16920. 219: uint8(_BT_LEAD2),
  16921. 220: uint8(_BT_LEAD2),
  16922. 221: uint8(_BT_LEAD2),
  16923. 222: uint8(_BT_LEAD2),
  16924. 223: uint8(_BT_LEAD2),
  16925. 224: uint8(_BT_LEAD3),
  16926. 225: uint8(_BT_LEAD3),
  16927. 226: uint8(_BT_LEAD3),
  16928. 227: uint8(_BT_LEAD3),
  16929. 228: uint8(_BT_LEAD3),
  16930. 229: uint8(_BT_LEAD3),
  16931. 230: uint8(_BT_LEAD3),
  16932. 231: uint8(_BT_LEAD3),
  16933. 232: uint8(_BT_LEAD3),
  16934. 233: uint8(_BT_LEAD3),
  16935. 234: uint8(_BT_LEAD3),
  16936. 235: uint8(_BT_LEAD3),
  16937. 236: uint8(_BT_LEAD3),
  16938. 237: uint8(_BT_LEAD3),
  16939. 238: uint8(_BT_LEAD3),
  16940. 239: uint8(_BT_LEAD3),
  16941. 240: uint8(_BT_LEAD4),
  16942. 241: uint8(_BT_LEAD4),
  16943. 242: uint8(_BT_LEAD4),
  16944. 243: uint8(_BT_LEAD4),
  16945. 244: uint8(_BT_LEAD4),
  16946. 254: uint8(_BT_MALFORM),
  16947. 255: uint8(_BT_MALFORM),
  16948. },
  16949. }
  16950. func init() {
  16951. p := unsafe.Pointer(&_utf8_encoding)
  16952. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  16953. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  16954. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  16955. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  16956. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  16957. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  16958. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  16959. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  16960. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  16961. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  16962. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  16963. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  16964. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  16965. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  16966. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  16967. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  16968. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  16969. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  16970. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  16971. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  16972. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  16973. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  16974. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  16975. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  16976. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  16977. }
  16978. var _internal_utf8_encoding_ns = Tnormal_encoding{
  16979. Fenc: TENCODING{
  16980. Fscanners: [4]TSCANNER{},
  16981. FliteralScanners: [2]TSCANNER{},
  16982. FminBytesPerChar: int32(1),
  16983. FisUtf8: uint8(1),
  16984. },
  16985. Ftype1: [256]uint8{
  16986. 9: uint8(_BT_S),
  16987. 10: uint8(_BT_LF),
  16988. 13: uint8(_BT_S),
  16989. 32: uint8(_BT_S),
  16990. 33: uint8(_BT_EXCL),
  16991. 34: uint8(_BT_QUOT),
  16992. 35: uint8(_BT_NUM),
  16993. 36: uint8(_BT_OTHER),
  16994. 37: uint8(_BT_PERCNT),
  16995. 38: uint8(_BT_AMP),
  16996. 39: uint8(_BT_APOS),
  16997. 40: uint8(_BT_LPAR),
  16998. 41: uint8(_BT_RPAR),
  16999. 42: uint8(_BT_AST),
  17000. 43: uint8(_BT_PLUS),
  17001. 44: uint8(_BT_COMMA),
  17002. 45: uint8(_BT_MINUS),
  17003. 46: uint8(_BT_NAME),
  17004. 47: uint8(_BT_SOL),
  17005. 48: uint8(_BT_DIGIT),
  17006. 49: uint8(_BT_DIGIT),
  17007. 50: uint8(_BT_DIGIT),
  17008. 51: uint8(_BT_DIGIT),
  17009. 52: uint8(_BT_DIGIT),
  17010. 53: uint8(_BT_DIGIT),
  17011. 54: uint8(_BT_DIGIT),
  17012. 55: uint8(_BT_DIGIT),
  17013. 56: uint8(_BT_DIGIT),
  17014. 57: uint8(_BT_DIGIT),
  17015. 58: uint8(_BT_COLON),
  17016. 59: uint8(_BT_SEMI),
  17017. 60: uint8(_BT_LT),
  17018. 61: uint8(_BT_EQUALS),
  17019. 62: uint8(_BT_GT),
  17020. 63: uint8(_BT_QUEST),
  17021. 64: uint8(_BT_OTHER),
  17022. 65: uint8(_BT_HEX),
  17023. 66: uint8(_BT_HEX),
  17024. 67: uint8(_BT_HEX),
  17025. 68: uint8(_BT_HEX),
  17026. 69: uint8(_BT_HEX),
  17027. 70: uint8(_BT_HEX),
  17028. 71: uint8(_BT_NMSTRT),
  17029. 72: uint8(_BT_NMSTRT),
  17030. 73: uint8(_BT_NMSTRT),
  17031. 74: uint8(_BT_NMSTRT),
  17032. 75: uint8(_BT_NMSTRT),
  17033. 76: uint8(_BT_NMSTRT),
  17034. 77: uint8(_BT_NMSTRT),
  17035. 78: uint8(_BT_NMSTRT),
  17036. 79: uint8(_BT_NMSTRT),
  17037. 80: uint8(_BT_NMSTRT),
  17038. 81: uint8(_BT_NMSTRT),
  17039. 82: uint8(_BT_NMSTRT),
  17040. 83: uint8(_BT_NMSTRT),
  17041. 84: uint8(_BT_NMSTRT),
  17042. 85: uint8(_BT_NMSTRT),
  17043. 86: uint8(_BT_NMSTRT),
  17044. 87: uint8(_BT_NMSTRT),
  17045. 88: uint8(_BT_NMSTRT),
  17046. 89: uint8(_BT_NMSTRT),
  17047. 90: uint8(_BT_NMSTRT),
  17048. 91: uint8(_BT_LSQB),
  17049. 92: uint8(_BT_OTHER),
  17050. 93: uint8(_BT_RSQB),
  17051. 94: uint8(_BT_OTHER),
  17052. 95: uint8(_BT_NMSTRT),
  17053. 96: uint8(_BT_OTHER),
  17054. 97: uint8(_BT_HEX),
  17055. 98: uint8(_BT_HEX),
  17056. 99: uint8(_BT_HEX),
  17057. 100: uint8(_BT_HEX),
  17058. 101: uint8(_BT_HEX),
  17059. 102: uint8(_BT_HEX),
  17060. 103: uint8(_BT_NMSTRT),
  17061. 104: uint8(_BT_NMSTRT),
  17062. 105: uint8(_BT_NMSTRT),
  17063. 106: uint8(_BT_NMSTRT),
  17064. 107: uint8(_BT_NMSTRT),
  17065. 108: uint8(_BT_NMSTRT),
  17066. 109: uint8(_BT_NMSTRT),
  17067. 110: uint8(_BT_NMSTRT),
  17068. 111: uint8(_BT_NMSTRT),
  17069. 112: uint8(_BT_NMSTRT),
  17070. 113: uint8(_BT_NMSTRT),
  17071. 114: uint8(_BT_NMSTRT),
  17072. 115: uint8(_BT_NMSTRT),
  17073. 116: uint8(_BT_NMSTRT),
  17074. 117: uint8(_BT_NMSTRT),
  17075. 118: uint8(_BT_NMSTRT),
  17076. 119: uint8(_BT_NMSTRT),
  17077. 120: uint8(_BT_NMSTRT),
  17078. 121: uint8(_BT_NMSTRT),
  17079. 122: uint8(_BT_NMSTRT),
  17080. 123: uint8(_BT_OTHER),
  17081. 124: uint8(_BT_VERBAR),
  17082. 125: uint8(_BT_OTHER),
  17083. 126: uint8(_BT_OTHER),
  17084. 127: uint8(_BT_OTHER),
  17085. 128: uint8(_BT_TRAIL),
  17086. 129: uint8(_BT_TRAIL),
  17087. 130: uint8(_BT_TRAIL),
  17088. 131: uint8(_BT_TRAIL),
  17089. 132: uint8(_BT_TRAIL),
  17090. 133: uint8(_BT_TRAIL),
  17091. 134: uint8(_BT_TRAIL),
  17092. 135: uint8(_BT_TRAIL),
  17093. 136: uint8(_BT_TRAIL),
  17094. 137: uint8(_BT_TRAIL),
  17095. 138: uint8(_BT_TRAIL),
  17096. 139: uint8(_BT_TRAIL),
  17097. 140: uint8(_BT_TRAIL),
  17098. 141: uint8(_BT_TRAIL),
  17099. 142: uint8(_BT_TRAIL),
  17100. 143: uint8(_BT_TRAIL),
  17101. 144: uint8(_BT_TRAIL),
  17102. 145: uint8(_BT_TRAIL),
  17103. 146: uint8(_BT_TRAIL),
  17104. 147: uint8(_BT_TRAIL),
  17105. 148: uint8(_BT_TRAIL),
  17106. 149: uint8(_BT_TRAIL),
  17107. 150: uint8(_BT_TRAIL),
  17108. 151: uint8(_BT_TRAIL),
  17109. 152: uint8(_BT_TRAIL),
  17110. 153: uint8(_BT_TRAIL),
  17111. 154: uint8(_BT_TRAIL),
  17112. 155: uint8(_BT_TRAIL),
  17113. 156: uint8(_BT_TRAIL),
  17114. 157: uint8(_BT_TRAIL),
  17115. 158: uint8(_BT_TRAIL),
  17116. 159: uint8(_BT_TRAIL),
  17117. 160: uint8(_BT_TRAIL),
  17118. 161: uint8(_BT_TRAIL),
  17119. 162: uint8(_BT_TRAIL),
  17120. 163: uint8(_BT_TRAIL),
  17121. 164: uint8(_BT_TRAIL),
  17122. 165: uint8(_BT_TRAIL),
  17123. 166: uint8(_BT_TRAIL),
  17124. 167: uint8(_BT_TRAIL),
  17125. 168: uint8(_BT_TRAIL),
  17126. 169: uint8(_BT_TRAIL),
  17127. 170: uint8(_BT_TRAIL),
  17128. 171: uint8(_BT_TRAIL),
  17129. 172: uint8(_BT_TRAIL),
  17130. 173: uint8(_BT_TRAIL),
  17131. 174: uint8(_BT_TRAIL),
  17132. 175: uint8(_BT_TRAIL),
  17133. 176: uint8(_BT_TRAIL),
  17134. 177: uint8(_BT_TRAIL),
  17135. 178: uint8(_BT_TRAIL),
  17136. 179: uint8(_BT_TRAIL),
  17137. 180: uint8(_BT_TRAIL),
  17138. 181: uint8(_BT_TRAIL),
  17139. 182: uint8(_BT_TRAIL),
  17140. 183: uint8(_BT_TRAIL),
  17141. 184: uint8(_BT_TRAIL),
  17142. 185: uint8(_BT_TRAIL),
  17143. 186: uint8(_BT_TRAIL),
  17144. 187: uint8(_BT_TRAIL),
  17145. 188: uint8(_BT_TRAIL),
  17146. 189: uint8(_BT_TRAIL),
  17147. 190: uint8(_BT_TRAIL),
  17148. 191: uint8(_BT_TRAIL),
  17149. 192: uint8(_BT_LEAD2),
  17150. 193: uint8(_BT_LEAD2),
  17151. 194: uint8(_BT_LEAD2),
  17152. 195: uint8(_BT_LEAD2),
  17153. 196: uint8(_BT_LEAD2),
  17154. 197: uint8(_BT_LEAD2),
  17155. 198: uint8(_BT_LEAD2),
  17156. 199: uint8(_BT_LEAD2),
  17157. 200: uint8(_BT_LEAD2),
  17158. 201: uint8(_BT_LEAD2),
  17159. 202: uint8(_BT_LEAD2),
  17160. 203: uint8(_BT_LEAD2),
  17161. 204: uint8(_BT_LEAD2),
  17162. 205: uint8(_BT_LEAD2),
  17163. 206: uint8(_BT_LEAD2),
  17164. 207: uint8(_BT_LEAD2),
  17165. 208: uint8(_BT_LEAD2),
  17166. 209: uint8(_BT_LEAD2),
  17167. 210: uint8(_BT_LEAD2),
  17168. 211: uint8(_BT_LEAD2),
  17169. 212: uint8(_BT_LEAD2),
  17170. 213: uint8(_BT_LEAD2),
  17171. 214: uint8(_BT_LEAD2),
  17172. 215: uint8(_BT_LEAD2),
  17173. 216: uint8(_BT_LEAD2),
  17174. 217: uint8(_BT_LEAD2),
  17175. 218: uint8(_BT_LEAD2),
  17176. 219: uint8(_BT_LEAD2),
  17177. 220: uint8(_BT_LEAD2),
  17178. 221: uint8(_BT_LEAD2),
  17179. 222: uint8(_BT_LEAD2),
  17180. 223: uint8(_BT_LEAD2),
  17181. 224: uint8(_BT_LEAD3),
  17182. 225: uint8(_BT_LEAD3),
  17183. 226: uint8(_BT_LEAD3),
  17184. 227: uint8(_BT_LEAD3),
  17185. 228: uint8(_BT_LEAD3),
  17186. 229: uint8(_BT_LEAD3),
  17187. 230: uint8(_BT_LEAD3),
  17188. 231: uint8(_BT_LEAD3),
  17189. 232: uint8(_BT_LEAD3),
  17190. 233: uint8(_BT_LEAD3),
  17191. 234: uint8(_BT_LEAD3),
  17192. 235: uint8(_BT_LEAD3),
  17193. 236: uint8(_BT_LEAD3),
  17194. 237: uint8(_BT_LEAD3),
  17195. 238: uint8(_BT_LEAD3),
  17196. 239: uint8(_BT_LEAD3),
  17197. 240: uint8(_BT_LEAD4),
  17198. 241: uint8(_BT_LEAD4),
  17199. 242: uint8(_BT_LEAD4),
  17200. 243: uint8(_BT_LEAD4),
  17201. 244: uint8(_BT_LEAD4),
  17202. 254: uint8(_BT_MALFORM),
  17203. 255: uint8(_BT_MALFORM),
  17204. },
  17205. }
  17206. func init() {
  17207. p := unsafe.Pointer(&_internal_utf8_encoding_ns)
  17208. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17209. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  17210. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  17211. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  17212. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  17213. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  17214. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  17215. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  17216. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  17217. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  17218. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  17219. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  17220. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  17221. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  17222. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  17223. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  17224. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  17225. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  17226. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  17227. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  17228. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  17229. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  17230. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  17231. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  17232. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  17233. }
  17234. var _internal_utf8_encoding = Tnormal_encoding{
  17235. Fenc: TENCODING{
  17236. Fscanners: [4]TSCANNER{},
  17237. FliteralScanners: [2]TSCANNER{},
  17238. FminBytesPerChar: int32(1),
  17239. FisUtf8: uint8(1),
  17240. },
  17241. Ftype1: [256]uint8{
  17242. 9: uint8(_BT_S),
  17243. 10: uint8(_BT_LF),
  17244. 13: uint8(_BT_S),
  17245. 32: uint8(_BT_S),
  17246. 33: uint8(_BT_EXCL),
  17247. 34: uint8(_BT_QUOT),
  17248. 35: uint8(_BT_NUM),
  17249. 36: uint8(_BT_OTHER),
  17250. 37: uint8(_BT_PERCNT),
  17251. 38: uint8(_BT_AMP),
  17252. 39: uint8(_BT_APOS),
  17253. 40: uint8(_BT_LPAR),
  17254. 41: uint8(_BT_RPAR),
  17255. 42: uint8(_BT_AST),
  17256. 43: uint8(_BT_PLUS),
  17257. 44: uint8(_BT_COMMA),
  17258. 45: uint8(_BT_MINUS),
  17259. 46: uint8(_BT_NAME),
  17260. 47: uint8(_BT_SOL),
  17261. 48: uint8(_BT_DIGIT),
  17262. 49: uint8(_BT_DIGIT),
  17263. 50: uint8(_BT_DIGIT),
  17264. 51: uint8(_BT_DIGIT),
  17265. 52: uint8(_BT_DIGIT),
  17266. 53: uint8(_BT_DIGIT),
  17267. 54: uint8(_BT_DIGIT),
  17268. 55: uint8(_BT_DIGIT),
  17269. 56: uint8(_BT_DIGIT),
  17270. 57: uint8(_BT_DIGIT),
  17271. 58: uint8(_BT_NMSTRT),
  17272. 59: uint8(_BT_SEMI),
  17273. 60: uint8(_BT_LT),
  17274. 61: uint8(_BT_EQUALS),
  17275. 62: uint8(_BT_GT),
  17276. 63: uint8(_BT_QUEST),
  17277. 64: uint8(_BT_OTHER),
  17278. 65: uint8(_BT_HEX),
  17279. 66: uint8(_BT_HEX),
  17280. 67: uint8(_BT_HEX),
  17281. 68: uint8(_BT_HEX),
  17282. 69: uint8(_BT_HEX),
  17283. 70: uint8(_BT_HEX),
  17284. 71: uint8(_BT_NMSTRT),
  17285. 72: uint8(_BT_NMSTRT),
  17286. 73: uint8(_BT_NMSTRT),
  17287. 74: uint8(_BT_NMSTRT),
  17288. 75: uint8(_BT_NMSTRT),
  17289. 76: uint8(_BT_NMSTRT),
  17290. 77: uint8(_BT_NMSTRT),
  17291. 78: uint8(_BT_NMSTRT),
  17292. 79: uint8(_BT_NMSTRT),
  17293. 80: uint8(_BT_NMSTRT),
  17294. 81: uint8(_BT_NMSTRT),
  17295. 82: uint8(_BT_NMSTRT),
  17296. 83: uint8(_BT_NMSTRT),
  17297. 84: uint8(_BT_NMSTRT),
  17298. 85: uint8(_BT_NMSTRT),
  17299. 86: uint8(_BT_NMSTRT),
  17300. 87: uint8(_BT_NMSTRT),
  17301. 88: uint8(_BT_NMSTRT),
  17302. 89: uint8(_BT_NMSTRT),
  17303. 90: uint8(_BT_NMSTRT),
  17304. 91: uint8(_BT_LSQB),
  17305. 92: uint8(_BT_OTHER),
  17306. 93: uint8(_BT_RSQB),
  17307. 94: uint8(_BT_OTHER),
  17308. 95: uint8(_BT_NMSTRT),
  17309. 96: uint8(_BT_OTHER),
  17310. 97: uint8(_BT_HEX),
  17311. 98: uint8(_BT_HEX),
  17312. 99: uint8(_BT_HEX),
  17313. 100: uint8(_BT_HEX),
  17314. 101: uint8(_BT_HEX),
  17315. 102: uint8(_BT_HEX),
  17316. 103: uint8(_BT_NMSTRT),
  17317. 104: uint8(_BT_NMSTRT),
  17318. 105: uint8(_BT_NMSTRT),
  17319. 106: uint8(_BT_NMSTRT),
  17320. 107: uint8(_BT_NMSTRT),
  17321. 108: uint8(_BT_NMSTRT),
  17322. 109: uint8(_BT_NMSTRT),
  17323. 110: uint8(_BT_NMSTRT),
  17324. 111: uint8(_BT_NMSTRT),
  17325. 112: uint8(_BT_NMSTRT),
  17326. 113: uint8(_BT_NMSTRT),
  17327. 114: uint8(_BT_NMSTRT),
  17328. 115: uint8(_BT_NMSTRT),
  17329. 116: uint8(_BT_NMSTRT),
  17330. 117: uint8(_BT_NMSTRT),
  17331. 118: uint8(_BT_NMSTRT),
  17332. 119: uint8(_BT_NMSTRT),
  17333. 120: uint8(_BT_NMSTRT),
  17334. 121: uint8(_BT_NMSTRT),
  17335. 122: uint8(_BT_NMSTRT),
  17336. 123: uint8(_BT_OTHER),
  17337. 124: uint8(_BT_VERBAR),
  17338. 125: uint8(_BT_OTHER),
  17339. 126: uint8(_BT_OTHER),
  17340. 127: uint8(_BT_OTHER),
  17341. 128: uint8(_BT_TRAIL),
  17342. 129: uint8(_BT_TRAIL),
  17343. 130: uint8(_BT_TRAIL),
  17344. 131: uint8(_BT_TRAIL),
  17345. 132: uint8(_BT_TRAIL),
  17346. 133: uint8(_BT_TRAIL),
  17347. 134: uint8(_BT_TRAIL),
  17348. 135: uint8(_BT_TRAIL),
  17349. 136: uint8(_BT_TRAIL),
  17350. 137: uint8(_BT_TRAIL),
  17351. 138: uint8(_BT_TRAIL),
  17352. 139: uint8(_BT_TRAIL),
  17353. 140: uint8(_BT_TRAIL),
  17354. 141: uint8(_BT_TRAIL),
  17355. 142: uint8(_BT_TRAIL),
  17356. 143: uint8(_BT_TRAIL),
  17357. 144: uint8(_BT_TRAIL),
  17358. 145: uint8(_BT_TRAIL),
  17359. 146: uint8(_BT_TRAIL),
  17360. 147: uint8(_BT_TRAIL),
  17361. 148: uint8(_BT_TRAIL),
  17362. 149: uint8(_BT_TRAIL),
  17363. 150: uint8(_BT_TRAIL),
  17364. 151: uint8(_BT_TRAIL),
  17365. 152: uint8(_BT_TRAIL),
  17366. 153: uint8(_BT_TRAIL),
  17367. 154: uint8(_BT_TRAIL),
  17368. 155: uint8(_BT_TRAIL),
  17369. 156: uint8(_BT_TRAIL),
  17370. 157: uint8(_BT_TRAIL),
  17371. 158: uint8(_BT_TRAIL),
  17372. 159: uint8(_BT_TRAIL),
  17373. 160: uint8(_BT_TRAIL),
  17374. 161: uint8(_BT_TRAIL),
  17375. 162: uint8(_BT_TRAIL),
  17376. 163: uint8(_BT_TRAIL),
  17377. 164: uint8(_BT_TRAIL),
  17378. 165: uint8(_BT_TRAIL),
  17379. 166: uint8(_BT_TRAIL),
  17380. 167: uint8(_BT_TRAIL),
  17381. 168: uint8(_BT_TRAIL),
  17382. 169: uint8(_BT_TRAIL),
  17383. 170: uint8(_BT_TRAIL),
  17384. 171: uint8(_BT_TRAIL),
  17385. 172: uint8(_BT_TRAIL),
  17386. 173: uint8(_BT_TRAIL),
  17387. 174: uint8(_BT_TRAIL),
  17388. 175: uint8(_BT_TRAIL),
  17389. 176: uint8(_BT_TRAIL),
  17390. 177: uint8(_BT_TRAIL),
  17391. 178: uint8(_BT_TRAIL),
  17392. 179: uint8(_BT_TRAIL),
  17393. 180: uint8(_BT_TRAIL),
  17394. 181: uint8(_BT_TRAIL),
  17395. 182: uint8(_BT_TRAIL),
  17396. 183: uint8(_BT_TRAIL),
  17397. 184: uint8(_BT_TRAIL),
  17398. 185: uint8(_BT_TRAIL),
  17399. 186: uint8(_BT_TRAIL),
  17400. 187: uint8(_BT_TRAIL),
  17401. 188: uint8(_BT_TRAIL),
  17402. 189: uint8(_BT_TRAIL),
  17403. 190: uint8(_BT_TRAIL),
  17404. 191: uint8(_BT_TRAIL),
  17405. 192: uint8(_BT_LEAD2),
  17406. 193: uint8(_BT_LEAD2),
  17407. 194: uint8(_BT_LEAD2),
  17408. 195: uint8(_BT_LEAD2),
  17409. 196: uint8(_BT_LEAD2),
  17410. 197: uint8(_BT_LEAD2),
  17411. 198: uint8(_BT_LEAD2),
  17412. 199: uint8(_BT_LEAD2),
  17413. 200: uint8(_BT_LEAD2),
  17414. 201: uint8(_BT_LEAD2),
  17415. 202: uint8(_BT_LEAD2),
  17416. 203: uint8(_BT_LEAD2),
  17417. 204: uint8(_BT_LEAD2),
  17418. 205: uint8(_BT_LEAD2),
  17419. 206: uint8(_BT_LEAD2),
  17420. 207: uint8(_BT_LEAD2),
  17421. 208: uint8(_BT_LEAD2),
  17422. 209: uint8(_BT_LEAD2),
  17423. 210: uint8(_BT_LEAD2),
  17424. 211: uint8(_BT_LEAD2),
  17425. 212: uint8(_BT_LEAD2),
  17426. 213: uint8(_BT_LEAD2),
  17427. 214: uint8(_BT_LEAD2),
  17428. 215: uint8(_BT_LEAD2),
  17429. 216: uint8(_BT_LEAD2),
  17430. 217: uint8(_BT_LEAD2),
  17431. 218: uint8(_BT_LEAD2),
  17432. 219: uint8(_BT_LEAD2),
  17433. 220: uint8(_BT_LEAD2),
  17434. 221: uint8(_BT_LEAD2),
  17435. 222: uint8(_BT_LEAD2),
  17436. 223: uint8(_BT_LEAD2),
  17437. 224: uint8(_BT_LEAD3),
  17438. 225: uint8(_BT_LEAD3),
  17439. 226: uint8(_BT_LEAD3),
  17440. 227: uint8(_BT_LEAD3),
  17441. 228: uint8(_BT_LEAD3),
  17442. 229: uint8(_BT_LEAD3),
  17443. 230: uint8(_BT_LEAD3),
  17444. 231: uint8(_BT_LEAD3),
  17445. 232: uint8(_BT_LEAD3),
  17446. 233: uint8(_BT_LEAD3),
  17447. 234: uint8(_BT_LEAD3),
  17448. 235: uint8(_BT_LEAD3),
  17449. 236: uint8(_BT_LEAD3),
  17450. 237: uint8(_BT_LEAD3),
  17451. 238: uint8(_BT_LEAD3),
  17452. 239: uint8(_BT_LEAD3),
  17453. 240: uint8(_BT_LEAD4),
  17454. 241: uint8(_BT_LEAD4),
  17455. 242: uint8(_BT_LEAD4),
  17456. 243: uint8(_BT_LEAD4),
  17457. 244: uint8(_BT_LEAD4),
  17458. 254: uint8(_BT_MALFORM),
  17459. 255: uint8(_BT_MALFORM),
  17460. },
  17461. }
  17462. func init() {
  17463. p := unsafe.Pointer(&_internal_utf8_encoding)
  17464. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17465. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  17466. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  17467. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  17468. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  17469. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  17470. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  17471. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  17472. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  17473. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  17474. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  17475. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  17476. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  17477. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  17478. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  17479. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  17480. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  17481. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  17482. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  17483. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  17484. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  17485. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  17486. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  17487. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  17488. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  17489. }
  17490. func _latin1_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  17491. var c uint8
  17492. var v2, v3, v4, v5, v6, v7, v8, v9 uintptr
  17493. _, _, _, _, _, _, _, _, _ = c, v2, v3, v4, v5, v6, v7, v8, v9
  17494. _ = enc
  17495. for {
  17496. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  17497. return int32(_XML_CONVERT_COMPLETED)
  17498. }
  17499. c = *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))
  17500. if libc.Int32FromUint8(c)&int32(0x80) != 0 {
  17501. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  17502. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17503. }
  17504. v3 = toP
  17505. v2 = *(*uintptr)(unsafe.Pointer(v3))
  17506. *(*uintptr)(unsafe.Pointer(v3))++
  17507. *(*uint8)(unsafe.Pointer(v2)) = libc.Uint8FromInt32(libc.Int32FromUint8(c)>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  17508. v5 = toP
  17509. v4 = *(*uintptr)(unsafe.Pointer(v5))
  17510. *(*uintptr)(unsafe.Pointer(v5))++
  17511. *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(libc.Int32FromUint8(c)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  17512. *(*uintptr)(unsafe.Pointer(fromP))++
  17513. } else {
  17514. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  17515. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17516. }
  17517. v7 = toP
  17518. v6 = *(*uintptr)(unsafe.Pointer(v7))
  17519. *(*uintptr)(unsafe.Pointer(v7))++
  17520. v9 = fromP
  17521. v8 = *(*uintptr)(unsafe.Pointer(v9))
  17522. *(*uintptr)(unsafe.Pointer(v9))++
  17523. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(v8))
  17524. }
  17525. goto _1
  17526. _1:
  17527. }
  17528. return r
  17529. }
  17530. func _latin1_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  17531. var v1, v2, v3, v4 uintptr
  17532. _, _, _, _ = v1, v2, v3, v4
  17533. _ = enc
  17534. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  17535. v2 = toP
  17536. v1 = *(*uintptr)(unsafe.Pointer(v2))
  17537. *(*uintptr)(unsafe.Pointer(v2)) += 2
  17538. v4 = fromP
  17539. v3 = *(*uintptr)(unsafe.Pointer(v4))
  17540. *(*uintptr)(unsafe.Pointer(v4))++
  17541. *(*uint16)(unsafe.Pointer(v1)) = uint16(*(*uint8)(unsafe.Pointer(v3)))
  17542. }
  17543. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  17544. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17545. } else {
  17546. return int32(_XML_CONVERT_COMPLETED)
  17547. }
  17548. return r
  17549. }
  17550. var _latin1_encoding_ns = Tnormal_encoding{
  17551. Fenc: TENCODING{
  17552. Fscanners: [4]TSCANNER{},
  17553. FliteralScanners: [2]TSCANNER{},
  17554. FminBytesPerChar: int32(1),
  17555. },
  17556. Ftype1: [256]uint8{
  17557. 9: uint8(_BT_S),
  17558. 10: uint8(_BT_LF),
  17559. 13: uint8(_BT_CR),
  17560. 32: uint8(_BT_S),
  17561. 33: uint8(_BT_EXCL),
  17562. 34: uint8(_BT_QUOT),
  17563. 35: uint8(_BT_NUM),
  17564. 36: uint8(_BT_OTHER),
  17565. 37: uint8(_BT_PERCNT),
  17566. 38: uint8(_BT_AMP),
  17567. 39: uint8(_BT_APOS),
  17568. 40: uint8(_BT_LPAR),
  17569. 41: uint8(_BT_RPAR),
  17570. 42: uint8(_BT_AST),
  17571. 43: uint8(_BT_PLUS),
  17572. 44: uint8(_BT_COMMA),
  17573. 45: uint8(_BT_MINUS),
  17574. 46: uint8(_BT_NAME),
  17575. 47: uint8(_BT_SOL),
  17576. 48: uint8(_BT_DIGIT),
  17577. 49: uint8(_BT_DIGIT),
  17578. 50: uint8(_BT_DIGIT),
  17579. 51: uint8(_BT_DIGIT),
  17580. 52: uint8(_BT_DIGIT),
  17581. 53: uint8(_BT_DIGIT),
  17582. 54: uint8(_BT_DIGIT),
  17583. 55: uint8(_BT_DIGIT),
  17584. 56: uint8(_BT_DIGIT),
  17585. 57: uint8(_BT_DIGIT),
  17586. 58: uint8(_BT_COLON),
  17587. 59: uint8(_BT_SEMI),
  17588. 60: uint8(_BT_LT),
  17589. 61: uint8(_BT_EQUALS),
  17590. 62: uint8(_BT_GT),
  17591. 63: uint8(_BT_QUEST),
  17592. 64: uint8(_BT_OTHER),
  17593. 65: uint8(_BT_HEX),
  17594. 66: uint8(_BT_HEX),
  17595. 67: uint8(_BT_HEX),
  17596. 68: uint8(_BT_HEX),
  17597. 69: uint8(_BT_HEX),
  17598. 70: uint8(_BT_HEX),
  17599. 71: uint8(_BT_NMSTRT),
  17600. 72: uint8(_BT_NMSTRT),
  17601. 73: uint8(_BT_NMSTRT),
  17602. 74: uint8(_BT_NMSTRT),
  17603. 75: uint8(_BT_NMSTRT),
  17604. 76: uint8(_BT_NMSTRT),
  17605. 77: uint8(_BT_NMSTRT),
  17606. 78: uint8(_BT_NMSTRT),
  17607. 79: uint8(_BT_NMSTRT),
  17608. 80: uint8(_BT_NMSTRT),
  17609. 81: uint8(_BT_NMSTRT),
  17610. 82: uint8(_BT_NMSTRT),
  17611. 83: uint8(_BT_NMSTRT),
  17612. 84: uint8(_BT_NMSTRT),
  17613. 85: uint8(_BT_NMSTRT),
  17614. 86: uint8(_BT_NMSTRT),
  17615. 87: uint8(_BT_NMSTRT),
  17616. 88: uint8(_BT_NMSTRT),
  17617. 89: uint8(_BT_NMSTRT),
  17618. 90: uint8(_BT_NMSTRT),
  17619. 91: uint8(_BT_LSQB),
  17620. 92: uint8(_BT_OTHER),
  17621. 93: uint8(_BT_RSQB),
  17622. 94: uint8(_BT_OTHER),
  17623. 95: uint8(_BT_NMSTRT),
  17624. 96: uint8(_BT_OTHER),
  17625. 97: uint8(_BT_HEX),
  17626. 98: uint8(_BT_HEX),
  17627. 99: uint8(_BT_HEX),
  17628. 100: uint8(_BT_HEX),
  17629. 101: uint8(_BT_HEX),
  17630. 102: uint8(_BT_HEX),
  17631. 103: uint8(_BT_NMSTRT),
  17632. 104: uint8(_BT_NMSTRT),
  17633. 105: uint8(_BT_NMSTRT),
  17634. 106: uint8(_BT_NMSTRT),
  17635. 107: uint8(_BT_NMSTRT),
  17636. 108: uint8(_BT_NMSTRT),
  17637. 109: uint8(_BT_NMSTRT),
  17638. 110: uint8(_BT_NMSTRT),
  17639. 111: uint8(_BT_NMSTRT),
  17640. 112: uint8(_BT_NMSTRT),
  17641. 113: uint8(_BT_NMSTRT),
  17642. 114: uint8(_BT_NMSTRT),
  17643. 115: uint8(_BT_NMSTRT),
  17644. 116: uint8(_BT_NMSTRT),
  17645. 117: uint8(_BT_NMSTRT),
  17646. 118: uint8(_BT_NMSTRT),
  17647. 119: uint8(_BT_NMSTRT),
  17648. 120: uint8(_BT_NMSTRT),
  17649. 121: uint8(_BT_NMSTRT),
  17650. 122: uint8(_BT_NMSTRT),
  17651. 123: uint8(_BT_OTHER),
  17652. 124: uint8(_BT_VERBAR),
  17653. 125: uint8(_BT_OTHER),
  17654. 126: uint8(_BT_OTHER),
  17655. 127: uint8(_BT_OTHER),
  17656. 128: uint8(_BT_OTHER),
  17657. 129: uint8(_BT_OTHER),
  17658. 130: uint8(_BT_OTHER),
  17659. 131: uint8(_BT_OTHER),
  17660. 132: uint8(_BT_OTHER),
  17661. 133: uint8(_BT_OTHER),
  17662. 134: uint8(_BT_OTHER),
  17663. 135: uint8(_BT_OTHER),
  17664. 136: uint8(_BT_OTHER),
  17665. 137: uint8(_BT_OTHER),
  17666. 138: uint8(_BT_OTHER),
  17667. 139: uint8(_BT_OTHER),
  17668. 140: uint8(_BT_OTHER),
  17669. 141: uint8(_BT_OTHER),
  17670. 142: uint8(_BT_OTHER),
  17671. 143: uint8(_BT_OTHER),
  17672. 144: uint8(_BT_OTHER),
  17673. 145: uint8(_BT_OTHER),
  17674. 146: uint8(_BT_OTHER),
  17675. 147: uint8(_BT_OTHER),
  17676. 148: uint8(_BT_OTHER),
  17677. 149: uint8(_BT_OTHER),
  17678. 150: uint8(_BT_OTHER),
  17679. 151: uint8(_BT_OTHER),
  17680. 152: uint8(_BT_OTHER),
  17681. 153: uint8(_BT_OTHER),
  17682. 154: uint8(_BT_OTHER),
  17683. 155: uint8(_BT_OTHER),
  17684. 156: uint8(_BT_OTHER),
  17685. 157: uint8(_BT_OTHER),
  17686. 158: uint8(_BT_OTHER),
  17687. 159: uint8(_BT_OTHER),
  17688. 160: uint8(_BT_OTHER),
  17689. 161: uint8(_BT_OTHER),
  17690. 162: uint8(_BT_OTHER),
  17691. 163: uint8(_BT_OTHER),
  17692. 164: uint8(_BT_OTHER),
  17693. 165: uint8(_BT_OTHER),
  17694. 166: uint8(_BT_OTHER),
  17695. 167: uint8(_BT_OTHER),
  17696. 168: uint8(_BT_OTHER),
  17697. 169: uint8(_BT_OTHER),
  17698. 170: uint8(_BT_NMSTRT),
  17699. 171: uint8(_BT_OTHER),
  17700. 172: uint8(_BT_OTHER),
  17701. 173: uint8(_BT_OTHER),
  17702. 174: uint8(_BT_OTHER),
  17703. 175: uint8(_BT_OTHER),
  17704. 176: uint8(_BT_OTHER),
  17705. 177: uint8(_BT_OTHER),
  17706. 178: uint8(_BT_OTHER),
  17707. 179: uint8(_BT_OTHER),
  17708. 180: uint8(_BT_OTHER),
  17709. 181: uint8(_BT_NMSTRT),
  17710. 182: uint8(_BT_OTHER),
  17711. 183: uint8(_BT_NAME),
  17712. 184: uint8(_BT_OTHER),
  17713. 185: uint8(_BT_OTHER),
  17714. 186: uint8(_BT_NMSTRT),
  17715. 187: uint8(_BT_OTHER),
  17716. 188: uint8(_BT_OTHER),
  17717. 189: uint8(_BT_OTHER),
  17718. 190: uint8(_BT_OTHER),
  17719. 191: uint8(_BT_OTHER),
  17720. 192: uint8(_BT_NMSTRT),
  17721. 193: uint8(_BT_NMSTRT),
  17722. 194: uint8(_BT_NMSTRT),
  17723. 195: uint8(_BT_NMSTRT),
  17724. 196: uint8(_BT_NMSTRT),
  17725. 197: uint8(_BT_NMSTRT),
  17726. 198: uint8(_BT_NMSTRT),
  17727. 199: uint8(_BT_NMSTRT),
  17728. 200: uint8(_BT_NMSTRT),
  17729. 201: uint8(_BT_NMSTRT),
  17730. 202: uint8(_BT_NMSTRT),
  17731. 203: uint8(_BT_NMSTRT),
  17732. 204: uint8(_BT_NMSTRT),
  17733. 205: uint8(_BT_NMSTRT),
  17734. 206: uint8(_BT_NMSTRT),
  17735. 207: uint8(_BT_NMSTRT),
  17736. 208: uint8(_BT_NMSTRT),
  17737. 209: uint8(_BT_NMSTRT),
  17738. 210: uint8(_BT_NMSTRT),
  17739. 211: uint8(_BT_NMSTRT),
  17740. 212: uint8(_BT_NMSTRT),
  17741. 213: uint8(_BT_NMSTRT),
  17742. 214: uint8(_BT_NMSTRT),
  17743. 215: uint8(_BT_OTHER),
  17744. 216: uint8(_BT_NMSTRT),
  17745. 217: uint8(_BT_NMSTRT),
  17746. 218: uint8(_BT_NMSTRT),
  17747. 219: uint8(_BT_NMSTRT),
  17748. 220: uint8(_BT_NMSTRT),
  17749. 221: uint8(_BT_NMSTRT),
  17750. 222: uint8(_BT_NMSTRT),
  17751. 223: uint8(_BT_NMSTRT),
  17752. 224: uint8(_BT_NMSTRT),
  17753. 225: uint8(_BT_NMSTRT),
  17754. 226: uint8(_BT_NMSTRT),
  17755. 227: uint8(_BT_NMSTRT),
  17756. 228: uint8(_BT_NMSTRT),
  17757. 229: uint8(_BT_NMSTRT),
  17758. 230: uint8(_BT_NMSTRT),
  17759. 231: uint8(_BT_NMSTRT),
  17760. 232: uint8(_BT_NMSTRT),
  17761. 233: uint8(_BT_NMSTRT),
  17762. 234: uint8(_BT_NMSTRT),
  17763. 235: uint8(_BT_NMSTRT),
  17764. 236: uint8(_BT_NMSTRT),
  17765. 237: uint8(_BT_NMSTRT),
  17766. 238: uint8(_BT_NMSTRT),
  17767. 239: uint8(_BT_NMSTRT),
  17768. 240: uint8(_BT_NMSTRT),
  17769. 241: uint8(_BT_NMSTRT),
  17770. 242: uint8(_BT_NMSTRT),
  17771. 243: uint8(_BT_NMSTRT),
  17772. 244: uint8(_BT_NMSTRT),
  17773. 245: uint8(_BT_NMSTRT),
  17774. 246: uint8(_BT_NMSTRT),
  17775. 247: uint8(_BT_OTHER),
  17776. 248: uint8(_BT_NMSTRT),
  17777. 249: uint8(_BT_NMSTRT),
  17778. 250: uint8(_BT_NMSTRT),
  17779. 251: uint8(_BT_NMSTRT),
  17780. 252: uint8(_BT_NMSTRT),
  17781. 253: uint8(_BT_NMSTRT),
  17782. 254: uint8(_BT_NMSTRT),
  17783. 255: uint8(_BT_NMSTRT),
  17784. },
  17785. }
  17786. func init() {
  17787. p := unsafe.Pointer(&_latin1_encoding_ns)
  17788. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17789. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  17790. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  17791. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  17792. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  17793. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  17794. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  17795. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  17796. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  17797. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  17798. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  17799. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  17800. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  17801. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  17802. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_latin1_toUtf8)
  17803. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  17804. }
  17805. var _latin1_encoding = Tnormal_encoding{
  17806. Fenc: TENCODING{
  17807. Fscanners: [4]TSCANNER{},
  17808. FliteralScanners: [2]TSCANNER{},
  17809. FminBytesPerChar: int32(1),
  17810. },
  17811. Ftype1: [256]uint8{
  17812. 9: uint8(_BT_S),
  17813. 10: uint8(_BT_LF),
  17814. 13: uint8(_BT_CR),
  17815. 32: uint8(_BT_S),
  17816. 33: uint8(_BT_EXCL),
  17817. 34: uint8(_BT_QUOT),
  17818. 35: uint8(_BT_NUM),
  17819. 36: uint8(_BT_OTHER),
  17820. 37: uint8(_BT_PERCNT),
  17821. 38: uint8(_BT_AMP),
  17822. 39: uint8(_BT_APOS),
  17823. 40: uint8(_BT_LPAR),
  17824. 41: uint8(_BT_RPAR),
  17825. 42: uint8(_BT_AST),
  17826. 43: uint8(_BT_PLUS),
  17827. 44: uint8(_BT_COMMA),
  17828. 45: uint8(_BT_MINUS),
  17829. 46: uint8(_BT_NAME),
  17830. 47: uint8(_BT_SOL),
  17831. 48: uint8(_BT_DIGIT),
  17832. 49: uint8(_BT_DIGIT),
  17833. 50: uint8(_BT_DIGIT),
  17834. 51: uint8(_BT_DIGIT),
  17835. 52: uint8(_BT_DIGIT),
  17836. 53: uint8(_BT_DIGIT),
  17837. 54: uint8(_BT_DIGIT),
  17838. 55: uint8(_BT_DIGIT),
  17839. 56: uint8(_BT_DIGIT),
  17840. 57: uint8(_BT_DIGIT),
  17841. 58: uint8(_BT_NMSTRT),
  17842. 59: uint8(_BT_SEMI),
  17843. 60: uint8(_BT_LT),
  17844. 61: uint8(_BT_EQUALS),
  17845. 62: uint8(_BT_GT),
  17846. 63: uint8(_BT_QUEST),
  17847. 64: uint8(_BT_OTHER),
  17848. 65: uint8(_BT_HEX),
  17849. 66: uint8(_BT_HEX),
  17850. 67: uint8(_BT_HEX),
  17851. 68: uint8(_BT_HEX),
  17852. 69: uint8(_BT_HEX),
  17853. 70: uint8(_BT_HEX),
  17854. 71: uint8(_BT_NMSTRT),
  17855. 72: uint8(_BT_NMSTRT),
  17856. 73: uint8(_BT_NMSTRT),
  17857. 74: uint8(_BT_NMSTRT),
  17858. 75: uint8(_BT_NMSTRT),
  17859. 76: uint8(_BT_NMSTRT),
  17860. 77: uint8(_BT_NMSTRT),
  17861. 78: uint8(_BT_NMSTRT),
  17862. 79: uint8(_BT_NMSTRT),
  17863. 80: uint8(_BT_NMSTRT),
  17864. 81: uint8(_BT_NMSTRT),
  17865. 82: uint8(_BT_NMSTRT),
  17866. 83: uint8(_BT_NMSTRT),
  17867. 84: uint8(_BT_NMSTRT),
  17868. 85: uint8(_BT_NMSTRT),
  17869. 86: uint8(_BT_NMSTRT),
  17870. 87: uint8(_BT_NMSTRT),
  17871. 88: uint8(_BT_NMSTRT),
  17872. 89: uint8(_BT_NMSTRT),
  17873. 90: uint8(_BT_NMSTRT),
  17874. 91: uint8(_BT_LSQB),
  17875. 92: uint8(_BT_OTHER),
  17876. 93: uint8(_BT_RSQB),
  17877. 94: uint8(_BT_OTHER),
  17878. 95: uint8(_BT_NMSTRT),
  17879. 96: uint8(_BT_OTHER),
  17880. 97: uint8(_BT_HEX),
  17881. 98: uint8(_BT_HEX),
  17882. 99: uint8(_BT_HEX),
  17883. 100: uint8(_BT_HEX),
  17884. 101: uint8(_BT_HEX),
  17885. 102: uint8(_BT_HEX),
  17886. 103: uint8(_BT_NMSTRT),
  17887. 104: uint8(_BT_NMSTRT),
  17888. 105: uint8(_BT_NMSTRT),
  17889. 106: uint8(_BT_NMSTRT),
  17890. 107: uint8(_BT_NMSTRT),
  17891. 108: uint8(_BT_NMSTRT),
  17892. 109: uint8(_BT_NMSTRT),
  17893. 110: uint8(_BT_NMSTRT),
  17894. 111: uint8(_BT_NMSTRT),
  17895. 112: uint8(_BT_NMSTRT),
  17896. 113: uint8(_BT_NMSTRT),
  17897. 114: uint8(_BT_NMSTRT),
  17898. 115: uint8(_BT_NMSTRT),
  17899. 116: uint8(_BT_NMSTRT),
  17900. 117: uint8(_BT_NMSTRT),
  17901. 118: uint8(_BT_NMSTRT),
  17902. 119: uint8(_BT_NMSTRT),
  17903. 120: uint8(_BT_NMSTRT),
  17904. 121: uint8(_BT_NMSTRT),
  17905. 122: uint8(_BT_NMSTRT),
  17906. 123: uint8(_BT_OTHER),
  17907. 124: uint8(_BT_VERBAR),
  17908. 125: uint8(_BT_OTHER),
  17909. 126: uint8(_BT_OTHER),
  17910. 127: uint8(_BT_OTHER),
  17911. 128: uint8(_BT_OTHER),
  17912. 129: uint8(_BT_OTHER),
  17913. 130: uint8(_BT_OTHER),
  17914. 131: uint8(_BT_OTHER),
  17915. 132: uint8(_BT_OTHER),
  17916. 133: uint8(_BT_OTHER),
  17917. 134: uint8(_BT_OTHER),
  17918. 135: uint8(_BT_OTHER),
  17919. 136: uint8(_BT_OTHER),
  17920. 137: uint8(_BT_OTHER),
  17921. 138: uint8(_BT_OTHER),
  17922. 139: uint8(_BT_OTHER),
  17923. 140: uint8(_BT_OTHER),
  17924. 141: uint8(_BT_OTHER),
  17925. 142: uint8(_BT_OTHER),
  17926. 143: uint8(_BT_OTHER),
  17927. 144: uint8(_BT_OTHER),
  17928. 145: uint8(_BT_OTHER),
  17929. 146: uint8(_BT_OTHER),
  17930. 147: uint8(_BT_OTHER),
  17931. 148: uint8(_BT_OTHER),
  17932. 149: uint8(_BT_OTHER),
  17933. 150: uint8(_BT_OTHER),
  17934. 151: uint8(_BT_OTHER),
  17935. 152: uint8(_BT_OTHER),
  17936. 153: uint8(_BT_OTHER),
  17937. 154: uint8(_BT_OTHER),
  17938. 155: uint8(_BT_OTHER),
  17939. 156: uint8(_BT_OTHER),
  17940. 157: uint8(_BT_OTHER),
  17941. 158: uint8(_BT_OTHER),
  17942. 159: uint8(_BT_OTHER),
  17943. 160: uint8(_BT_OTHER),
  17944. 161: uint8(_BT_OTHER),
  17945. 162: uint8(_BT_OTHER),
  17946. 163: uint8(_BT_OTHER),
  17947. 164: uint8(_BT_OTHER),
  17948. 165: uint8(_BT_OTHER),
  17949. 166: uint8(_BT_OTHER),
  17950. 167: uint8(_BT_OTHER),
  17951. 168: uint8(_BT_OTHER),
  17952. 169: uint8(_BT_OTHER),
  17953. 170: uint8(_BT_NMSTRT),
  17954. 171: uint8(_BT_OTHER),
  17955. 172: uint8(_BT_OTHER),
  17956. 173: uint8(_BT_OTHER),
  17957. 174: uint8(_BT_OTHER),
  17958. 175: uint8(_BT_OTHER),
  17959. 176: uint8(_BT_OTHER),
  17960. 177: uint8(_BT_OTHER),
  17961. 178: uint8(_BT_OTHER),
  17962. 179: uint8(_BT_OTHER),
  17963. 180: uint8(_BT_OTHER),
  17964. 181: uint8(_BT_NMSTRT),
  17965. 182: uint8(_BT_OTHER),
  17966. 183: uint8(_BT_NAME),
  17967. 184: uint8(_BT_OTHER),
  17968. 185: uint8(_BT_OTHER),
  17969. 186: uint8(_BT_NMSTRT),
  17970. 187: uint8(_BT_OTHER),
  17971. 188: uint8(_BT_OTHER),
  17972. 189: uint8(_BT_OTHER),
  17973. 190: uint8(_BT_OTHER),
  17974. 191: uint8(_BT_OTHER),
  17975. 192: uint8(_BT_NMSTRT),
  17976. 193: uint8(_BT_NMSTRT),
  17977. 194: uint8(_BT_NMSTRT),
  17978. 195: uint8(_BT_NMSTRT),
  17979. 196: uint8(_BT_NMSTRT),
  17980. 197: uint8(_BT_NMSTRT),
  17981. 198: uint8(_BT_NMSTRT),
  17982. 199: uint8(_BT_NMSTRT),
  17983. 200: uint8(_BT_NMSTRT),
  17984. 201: uint8(_BT_NMSTRT),
  17985. 202: uint8(_BT_NMSTRT),
  17986. 203: uint8(_BT_NMSTRT),
  17987. 204: uint8(_BT_NMSTRT),
  17988. 205: uint8(_BT_NMSTRT),
  17989. 206: uint8(_BT_NMSTRT),
  17990. 207: uint8(_BT_NMSTRT),
  17991. 208: uint8(_BT_NMSTRT),
  17992. 209: uint8(_BT_NMSTRT),
  17993. 210: uint8(_BT_NMSTRT),
  17994. 211: uint8(_BT_NMSTRT),
  17995. 212: uint8(_BT_NMSTRT),
  17996. 213: uint8(_BT_NMSTRT),
  17997. 214: uint8(_BT_NMSTRT),
  17998. 215: uint8(_BT_OTHER),
  17999. 216: uint8(_BT_NMSTRT),
  18000. 217: uint8(_BT_NMSTRT),
  18001. 218: uint8(_BT_NMSTRT),
  18002. 219: uint8(_BT_NMSTRT),
  18003. 220: uint8(_BT_NMSTRT),
  18004. 221: uint8(_BT_NMSTRT),
  18005. 222: uint8(_BT_NMSTRT),
  18006. 223: uint8(_BT_NMSTRT),
  18007. 224: uint8(_BT_NMSTRT),
  18008. 225: uint8(_BT_NMSTRT),
  18009. 226: uint8(_BT_NMSTRT),
  18010. 227: uint8(_BT_NMSTRT),
  18011. 228: uint8(_BT_NMSTRT),
  18012. 229: uint8(_BT_NMSTRT),
  18013. 230: uint8(_BT_NMSTRT),
  18014. 231: uint8(_BT_NMSTRT),
  18015. 232: uint8(_BT_NMSTRT),
  18016. 233: uint8(_BT_NMSTRT),
  18017. 234: uint8(_BT_NMSTRT),
  18018. 235: uint8(_BT_NMSTRT),
  18019. 236: uint8(_BT_NMSTRT),
  18020. 237: uint8(_BT_NMSTRT),
  18021. 238: uint8(_BT_NMSTRT),
  18022. 239: uint8(_BT_NMSTRT),
  18023. 240: uint8(_BT_NMSTRT),
  18024. 241: uint8(_BT_NMSTRT),
  18025. 242: uint8(_BT_NMSTRT),
  18026. 243: uint8(_BT_NMSTRT),
  18027. 244: uint8(_BT_NMSTRT),
  18028. 245: uint8(_BT_NMSTRT),
  18029. 246: uint8(_BT_NMSTRT),
  18030. 247: uint8(_BT_OTHER),
  18031. 248: uint8(_BT_NMSTRT),
  18032. 249: uint8(_BT_NMSTRT),
  18033. 250: uint8(_BT_NMSTRT),
  18034. 251: uint8(_BT_NMSTRT),
  18035. 252: uint8(_BT_NMSTRT),
  18036. 253: uint8(_BT_NMSTRT),
  18037. 254: uint8(_BT_NMSTRT),
  18038. 255: uint8(_BT_NMSTRT),
  18039. },
  18040. }
  18041. func init() {
  18042. p := unsafe.Pointer(&_latin1_encoding)
  18043. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18044. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18045. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18046. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18047. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18048. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18049. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18050. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18051. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18052. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18053. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18054. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18055. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18056. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18057. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_latin1_toUtf8)
  18058. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  18059. }
  18060. func _ascii_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18061. var v1, v2, v3, v4 uintptr
  18062. _, _, _, _ = v1, v2, v3, v4
  18063. _ = enc
  18064. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  18065. v2 = toP
  18066. v1 = *(*uintptr)(unsafe.Pointer(v2))
  18067. *(*uintptr)(unsafe.Pointer(v2))++
  18068. v4 = fromP
  18069. v3 = *(*uintptr)(unsafe.Pointer(v4))
  18070. *(*uintptr)(unsafe.Pointer(v4))++
  18071. *(*uint8)(unsafe.Pointer(v1)) = *(*uint8)(unsafe.Pointer(v3))
  18072. }
  18073. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18074. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18075. } else {
  18076. return int32(_XML_CONVERT_COMPLETED)
  18077. }
  18078. return r
  18079. }
  18080. var _ascii_encoding_ns = Tnormal_encoding{
  18081. Fenc: TENCODING{
  18082. Fscanners: [4]TSCANNER{},
  18083. FliteralScanners: [2]TSCANNER{},
  18084. FminBytesPerChar: int32(1),
  18085. FisUtf8: uint8(1),
  18086. },
  18087. Ftype1: [256]uint8{
  18088. 9: uint8(_BT_S),
  18089. 10: uint8(_BT_LF),
  18090. 13: uint8(_BT_CR),
  18091. 32: uint8(_BT_S),
  18092. 33: uint8(_BT_EXCL),
  18093. 34: uint8(_BT_QUOT),
  18094. 35: uint8(_BT_NUM),
  18095. 36: uint8(_BT_OTHER),
  18096. 37: uint8(_BT_PERCNT),
  18097. 38: uint8(_BT_AMP),
  18098. 39: uint8(_BT_APOS),
  18099. 40: uint8(_BT_LPAR),
  18100. 41: uint8(_BT_RPAR),
  18101. 42: uint8(_BT_AST),
  18102. 43: uint8(_BT_PLUS),
  18103. 44: uint8(_BT_COMMA),
  18104. 45: uint8(_BT_MINUS),
  18105. 46: uint8(_BT_NAME),
  18106. 47: uint8(_BT_SOL),
  18107. 48: uint8(_BT_DIGIT),
  18108. 49: uint8(_BT_DIGIT),
  18109. 50: uint8(_BT_DIGIT),
  18110. 51: uint8(_BT_DIGIT),
  18111. 52: uint8(_BT_DIGIT),
  18112. 53: uint8(_BT_DIGIT),
  18113. 54: uint8(_BT_DIGIT),
  18114. 55: uint8(_BT_DIGIT),
  18115. 56: uint8(_BT_DIGIT),
  18116. 57: uint8(_BT_DIGIT),
  18117. 58: uint8(_BT_COLON),
  18118. 59: uint8(_BT_SEMI),
  18119. 60: uint8(_BT_LT),
  18120. 61: uint8(_BT_EQUALS),
  18121. 62: uint8(_BT_GT),
  18122. 63: uint8(_BT_QUEST),
  18123. 64: uint8(_BT_OTHER),
  18124. 65: uint8(_BT_HEX),
  18125. 66: uint8(_BT_HEX),
  18126. 67: uint8(_BT_HEX),
  18127. 68: uint8(_BT_HEX),
  18128. 69: uint8(_BT_HEX),
  18129. 70: uint8(_BT_HEX),
  18130. 71: uint8(_BT_NMSTRT),
  18131. 72: uint8(_BT_NMSTRT),
  18132. 73: uint8(_BT_NMSTRT),
  18133. 74: uint8(_BT_NMSTRT),
  18134. 75: uint8(_BT_NMSTRT),
  18135. 76: uint8(_BT_NMSTRT),
  18136. 77: uint8(_BT_NMSTRT),
  18137. 78: uint8(_BT_NMSTRT),
  18138. 79: uint8(_BT_NMSTRT),
  18139. 80: uint8(_BT_NMSTRT),
  18140. 81: uint8(_BT_NMSTRT),
  18141. 82: uint8(_BT_NMSTRT),
  18142. 83: uint8(_BT_NMSTRT),
  18143. 84: uint8(_BT_NMSTRT),
  18144. 85: uint8(_BT_NMSTRT),
  18145. 86: uint8(_BT_NMSTRT),
  18146. 87: uint8(_BT_NMSTRT),
  18147. 88: uint8(_BT_NMSTRT),
  18148. 89: uint8(_BT_NMSTRT),
  18149. 90: uint8(_BT_NMSTRT),
  18150. 91: uint8(_BT_LSQB),
  18151. 92: uint8(_BT_OTHER),
  18152. 93: uint8(_BT_RSQB),
  18153. 94: uint8(_BT_OTHER),
  18154. 95: uint8(_BT_NMSTRT),
  18155. 96: uint8(_BT_OTHER),
  18156. 97: uint8(_BT_HEX),
  18157. 98: uint8(_BT_HEX),
  18158. 99: uint8(_BT_HEX),
  18159. 100: uint8(_BT_HEX),
  18160. 101: uint8(_BT_HEX),
  18161. 102: uint8(_BT_HEX),
  18162. 103: uint8(_BT_NMSTRT),
  18163. 104: uint8(_BT_NMSTRT),
  18164. 105: uint8(_BT_NMSTRT),
  18165. 106: uint8(_BT_NMSTRT),
  18166. 107: uint8(_BT_NMSTRT),
  18167. 108: uint8(_BT_NMSTRT),
  18168. 109: uint8(_BT_NMSTRT),
  18169. 110: uint8(_BT_NMSTRT),
  18170. 111: uint8(_BT_NMSTRT),
  18171. 112: uint8(_BT_NMSTRT),
  18172. 113: uint8(_BT_NMSTRT),
  18173. 114: uint8(_BT_NMSTRT),
  18174. 115: uint8(_BT_NMSTRT),
  18175. 116: uint8(_BT_NMSTRT),
  18176. 117: uint8(_BT_NMSTRT),
  18177. 118: uint8(_BT_NMSTRT),
  18178. 119: uint8(_BT_NMSTRT),
  18179. 120: uint8(_BT_NMSTRT),
  18180. 121: uint8(_BT_NMSTRT),
  18181. 122: uint8(_BT_NMSTRT),
  18182. 123: uint8(_BT_OTHER),
  18183. 124: uint8(_BT_VERBAR),
  18184. 125: uint8(_BT_OTHER),
  18185. 126: uint8(_BT_OTHER),
  18186. 127: uint8(_BT_OTHER),
  18187. },
  18188. }
  18189. func init() {
  18190. p := unsafe.Pointer(&_ascii_encoding_ns)
  18191. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18192. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18193. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18194. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18195. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18196. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18197. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18198. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18199. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18200. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18201. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18202. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18203. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18204. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18205. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_ascii_toUtf8)
  18206. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  18207. }
  18208. var _ascii_encoding = Tnormal_encoding{
  18209. Fenc: TENCODING{
  18210. Fscanners: [4]TSCANNER{},
  18211. FliteralScanners: [2]TSCANNER{},
  18212. FminBytesPerChar: int32(1),
  18213. FisUtf8: uint8(1),
  18214. },
  18215. Ftype1: [256]uint8{
  18216. 9: uint8(_BT_S),
  18217. 10: uint8(_BT_LF),
  18218. 13: uint8(_BT_CR),
  18219. 32: uint8(_BT_S),
  18220. 33: uint8(_BT_EXCL),
  18221. 34: uint8(_BT_QUOT),
  18222. 35: uint8(_BT_NUM),
  18223. 36: uint8(_BT_OTHER),
  18224. 37: uint8(_BT_PERCNT),
  18225. 38: uint8(_BT_AMP),
  18226. 39: uint8(_BT_APOS),
  18227. 40: uint8(_BT_LPAR),
  18228. 41: uint8(_BT_RPAR),
  18229. 42: uint8(_BT_AST),
  18230. 43: uint8(_BT_PLUS),
  18231. 44: uint8(_BT_COMMA),
  18232. 45: uint8(_BT_MINUS),
  18233. 46: uint8(_BT_NAME),
  18234. 47: uint8(_BT_SOL),
  18235. 48: uint8(_BT_DIGIT),
  18236. 49: uint8(_BT_DIGIT),
  18237. 50: uint8(_BT_DIGIT),
  18238. 51: uint8(_BT_DIGIT),
  18239. 52: uint8(_BT_DIGIT),
  18240. 53: uint8(_BT_DIGIT),
  18241. 54: uint8(_BT_DIGIT),
  18242. 55: uint8(_BT_DIGIT),
  18243. 56: uint8(_BT_DIGIT),
  18244. 57: uint8(_BT_DIGIT),
  18245. 58: uint8(_BT_NMSTRT),
  18246. 59: uint8(_BT_SEMI),
  18247. 60: uint8(_BT_LT),
  18248. 61: uint8(_BT_EQUALS),
  18249. 62: uint8(_BT_GT),
  18250. 63: uint8(_BT_QUEST),
  18251. 64: uint8(_BT_OTHER),
  18252. 65: uint8(_BT_HEX),
  18253. 66: uint8(_BT_HEX),
  18254. 67: uint8(_BT_HEX),
  18255. 68: uint8(_BT_HEX),
  18256. 69: uint8(_BT_HEX),
  18257. 70: uint8(_BT_HEX),
  18258. 71: uint8(_BT_NMSTRT),
  18259. 72: uint8(_BT_NMSTRT),
  18260. 73: uint8(_BT_NMSTRT),
  18261. 74: uint8(_BT_NMSTRT),
  18262. 75: uint8(_BT_NMSTRT),
  18263. 76: uint8(_BT_NMSTRT),
  18264. 77: uint8(_BT_NMSTRT),
  18265. 78: uint8(_BT_NMSTRT),
  18266. 79: uint8(_BT_NMSTRT),
  18267. 80: uint8(_BT_NMSTRT),
  18268. 81: uint8(_BT_NMSTRT),
  18269. 82: uint8(_BT_NMSTRT),
  18270. 83: uint8(_BT_NMSTRT),
  18271. 84: uint8(_BT_NMSTRT),
  18272. 85: uint8(_BT_NMSTRT),
  18273. 86: uint8(_BT_NMSTRT),
  18274. 87: uint8(_BT_NMSTRT),
  18275. 88: uint8(_BT_NMSTRT),
  18276. 89: uint8(_BT_NMSTRT),
  18277. 90: uint8(_BT_NMSTRT),
  18278. 91: uint8(_BT_LSQB),
  18279. 92: uint8(_BT_OTHER),
  18280. 93: uint8(_BT_RSQB),
  18281. 94: uint8(_BT_OTHER),
  18282. 95: uint8(_BT_NMSTRT),
  18283. 96: uint8(_BT_OTHER),
  18284. 97: uint8(_BT_HEX),
  18285. 98: uint8(_BT_HEX),
  18286. 99: uint8(_BT_HEX),
  18287. 100: uint8(_BT_HEX),
  18288. 101: uint8(_BT_HEX),
  18289. 102: uint8(_BT_HEX),
  18290. 103: uint8(_BT_NMSTRT),
  18291. 104: uint8(_BT_NMSTRT),
  18292. 105: uint8(_BT_NMSTRT),
  18293. 106: uint8(_BT_NMSTRT),
  18294. 107: uint8(_BT_NMSTRT),
  18295. 108: uint8(_BT_NMSTRT),
  18296. 109: uint8(_BT_NMSTRT),
  18297. 110: uint8(_BT_NMSTRT),
  18298. 111: uint8(_BT_NMSTRT),
  18299. 112: uint8(_BT_NMSTRT),
  18300. 113: uint8(_BT_NMSTRT),
  18301. 114: uint8(_BT_NMSTRT),
  18302. 115: uint8(_BT_NMSTRT),
  18303. 116: uint8(_BT_NMSTRT),
  18304. 117: uint8(_BT_NMSTRT),
  18305. 118: uint8(_BT_NMSTRT),
  18306. 119: uint8(_BT_NMSTRT),
  18307. 120: uint8(_BT_NMSTRT),
  18308. 121: uint8(_BT_NMSTRT),
  18309. 122: uint8(_BT_NMSTRT),
  18310. 123: uint8(_BT_OTHER),
  18311. 124: uint8(_BT_VERBAR),
  18312. 125: uint8(_BT_OTHER),
  18313. 126: uint8(_BT_OTHER),
  18314. 127: uint8(_BT_OTHER),
  18315. },
  18316. }
  18317. func init() {
  18318. p := unsafe.Pointer(&_ascii_encoding)
  18319. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18320. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18321. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18322. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18323. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18324. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18325. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18326. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18327. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18328. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18329. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18330. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18331. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18332. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18333. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_ascii_toUtf8)
  18334. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  18335. }
  18336. func _unicode_byte_type(tls *libc.TLS, hi uint8, lo uint8) (r int32) {
  18337. switch libc.Int32FromUint8(hi) {
  18338. /* 0xD800-0xDBFF first 16-bit code unit or high surrogate (W1) */
  18339. case int32(0xD8):
  18340. fallthrough
  18341. case int32(0xD9):
  18342. fallthrough
  18343. case int32(0xDA):
  18344. fallthrough
  18345. case int32(0xDB):
  18346. return int32(_BT_LEAD4)
  18347. /* 0xDC00-0xDFFF second 16-bit code unit or low surrogate (W2) */
  18348. fallthrough
  18349. case int32(0xDC):
  18350. fallthrough
  18351. case int32(0xDD):
  18352. fallthrough
  18353. case int32(0xDE):
  18354. fallthrough
  18355. case int32(0xDF):
  18356. return int32(_BT_TRAIL)
  18357. case int32(0xFF):
  18358. switch libc.Int32FromUint8(lo) {
  18359. case int32(0xFF): /* noncharacter-FFFF */
  18360. fallthrough
  18361. case int32(0xFE): /* noncharacter-FFFE */
  18362. return int32(_BT_NONXML)
  18363. }
  18364. break
  18365. }
  18366. return int32(_BT_NONASCII)
  18367. }
  18368. func _little2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18369. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  18370. var hi, lo, lo2 uint8
  18371. var plane int32
  18372. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  18373. from = *(*uintptr)(unsafe.Pointer(fromP))
  18374. _ = enc
  18375. fromLim = from + uintptr((int64(fromLim)-int64(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  18376. for {
  18377. if !(from < fromLim) {
  18378. break
  18379. }
  18380. lo = *(*uint8)(unsafe.Pointer(from))
  18381. hi = *(*uint8)(unsafe.Pointer(from + 1))
  18382. switch libc.Int32FromUint8(hi) {
  18383. case 0:
  18384. if libc.Int32FromUint8(lo) < int32(0x80) {
  18385. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  18386. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18387. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18388. }
  18389. v3 = toP
  18390. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18391. *(*uintptr)(unsafe.Pointer(v3))++
  18392. *(*uint8)(unsafe.Pointer(v2)) = lo
  18393. break
  18394. } /* fall through */
  18395. fallthrough
  18396. case int32(0x1):
  18397. fallthrough
  18398. case int32(0x2):
  18399. fallthrough
  18400. case int32(0x3):
  18401. fallthrough
  18402. case int32(0x4):
  18403. fallthrough
  18404. case int32(0x5):
  18405. fallthrough
  18406. case int32(0x6):
  18407. fallthrough
  18408. case int32(0x7):
  18409. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  18410. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18411. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18412. }
  18413. v5 = toP
  18414. v4 = *(*uintptr)(unsafe.Pointer(v5))
  18415. *(*uintptr)(unsafe.Pointer(v5))++
  18416. *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  18417. v7 = toP
  18418. v6 = *(*uintptr)(unsafe.Pointer(v7))
  18419. *(*uintptr)(unsafe.Pointer(v7))++
  18420. *(*uint8)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18421. default:
  18422. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(3) {
  18423. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18424. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18425. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  18426. v9 = toP
  18427. v8 = *(*uintptr)(unsafe.Pointer(v9))
  18428. *(*uintptr)(unsafe.Pointer(v9))++
  18429. *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  18430. v11 = toP
  18431. v10 = *(*uintptr)(unsafe.Pointer(v11))
  18432. *(*uintptr)(unsafe.Pointer(v11))++
  18433. *(*uint8)(unsafe.Pointer(v10)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18434. v13 = toP
  18435. v12 = *(*uintptr)(unsafe.Pointer(v13))
  18436. *(*uintptr)(unsafe.Pointer(v13))++
  18437. *(*uint8)(unsafe.Pointer(v12)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18438. case int32(0xD8):
  18439. fallthrough
  18440. case int32(0xD9):
  18441. fallthrough
  18442. case int32(0xDA):
  18443. fallthrough
  18444. case int32(0xDB):
  18445. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(4) {
  18446. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18447. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18448. }
  18449. if int64(fromLim)-int64(from) < int64(4) {
  18450. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18451. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18452. }
  18453. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  18454. v15 = toP
  18455. v14 = *(*uintptr)(unsafe.Pointer(v15))
  18456. *(*uintptr)(unsafe.Pointer(v15))++
  18457. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  18458. v17 = toP
  18459. v16 = *(*uintptr)(unsafe.Pointer(v17))
  18460. *(*uintptr)(unsafe.Pointer(v17))++
  18461. *(*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))
  18462. from += uintptr(2)
  18463. lo2 = *(*uint8)(unsafe.Pointer(from))
  18464. v19 = toP
  18465. v18 = *(*uintptr)(unsafe.Pointer(v19))
  18466. *(*uintptr)(unsafe.Pointer(v19))++
  18467. *(*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))
  18468. v21 = toP
  18469. v20 = *(*uintptr)(unsafe.Pointer(v21))
  18470. *(*uintptr)(unsafe.Pointer(v21))++
  18471. *(*uint8)(unsafe.Pointer(v20)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18472. break
  18473. }
  18474. goto _1
  18475. _1:
  18476. ;
  18477. from += uintptr(2)
  18478. }
  18479. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18480. if from < fromLim {
  18481. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18482. } else {
  18483. return int32(_XML_CONVERT_COMPLETED)
  18484. }
  18485. return r
  18486. }
  18487. func _little2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18488. var res _XML_Convert_Result
  18489. var v2, v3 uintptr
  18490. _, _, _ = res, v2, v3
  18491. res = int32(_XML_CONVERT_COMPLETED)
  18492. _ = enc
  18493. 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 */
  18494. 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) {
  18495. fromLim -= uintptr(2)
  18496. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18497. }
  18498. for {
  18499. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  18500. break
  18501. }
  18502. v3 = toP
  18503. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18504. *(*uintptr)(unsafe.Pointer(v3)) += 2
  18505. *(*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))))))
  18506. goto _1
  18507. _1:
  18508. ;
  18509. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  18510. }
  18511. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18512. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18513. } else {
  18514. return res
  18515. }
  18516. return r
  18517. }
  18518. func _big2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18519. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  18520. var hi, lo, lo2 uint8
  18521. var plane int32
  18522. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  18523. from = *(*uintptr)(unsafe.Pointer(fromP))
  18524. _ = enc
  18525. fromLim = from + uintptr((int64(fromLim)-int64(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  18526. for {
  18527. if !(from < fromLim) {
  18528. break
  18529. }
  18530. lo = *(*uint8)(unsafe.Pointer(from + 1))
  18531. hi = *(*uint8)(unsafe.Pointer(from))
  18532. switch libc.Int32FromUint8(hi) {
  18533. case 0:
  18534. if libc.Int32FromUint8(lo) < int32(0x80) {
  18535. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  18536. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18537. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18538. }
  18539. v3 = toP
  18540. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18541. *(*uintptr)(unsafe.Pointer(v3))++
  18542. *(*uint8)(unsafe.Pointer(v2)) = lo
  18543. break
  18544. } /* fall through */
  18545. fallthrough
  18546. case int32(0x1):
  18547. fallthrough
  18548. case int32(0x2):
  18549. fallthrough
  18550. case int32(0x3):
  18551. fallthrough
  18552. case int32(0x4):
  18553. fallthrough
  18554. case int32(0x5):
  18555. fallthrough
  18556. case int32(0x6):
  18557. fallthrough
  18558. case int32(0x7):
  18559. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  18560. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18561. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18562. }
  18563. v5 = toP
  18564. v4 = *(*uintptr)(unsafe.Pointer(v5))
  18565. *(*uintptr)(unsafe.Pointer(v5))++
  18566. *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  18567. v7 = toP
  18568. v6 = *(*uintptr)(unsafe.Pointer(v7))
  18569. *(*uintptr)(unsafe.Pointer(v7))++
  18570. *(*uint8)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18571. default:
  18572. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(3) {
  18573. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18574. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18575. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  18576. v9 = toP
  18577. v8 = *(*uintptr)(unsafe.Pointer(v9))
  18578. *(*uintptr)(unsafe.Pointer(v9))++
  18579. *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  18580. v11 = toP
  18581. v10 = *(*uintptr)(unsafe.Pointer(v11))
  18582. *(*uintptr)(unsafe.Pointer(v11))++
  18583. *(*uint8)(unsafe.Pointer(v10)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18584. v13 = toP
  18585. v12 = *(*uintptr)(unsafe.Pointer(v13))
  18586. *(*uintptr)(unsafe.Pointer(v13))++
  18587. *(*uint8)(unsafe.Pointer(v12)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18588. case int32(0xD8):
  18589. fallthrough
  18590. case int32(0xD9):
  18591. fallthrough
  18592. case int32(0xDA):
  18593. fallthrough
  18594. case int32(0xDB):
  18595. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(4) {
  18596. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18597. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18598. }
  18599. if int64(fromLim)-int64(from) < int64(4) {
  18600. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18601. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18602. }
  18603. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  18604. v15 = toP
  18605. v14 = *(*uintptr)(unsafe.Pointer(v15))
  18606. *(*uintptr)(unsafe.Pointer(v15))++
  18607. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  18608. v17 = toP
  18609. v16 = *(*uintptr)(unsafe.Pointer(v17))
  18610. *(*uintptr)(unsafe.Pointer(v17))++
  18611. *(*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))
  18612. from += uintptr(2)
  18613. lo2 = *(*uint8)(unsafe.Pointer(from + 1))
  18614. v19 = toP
  18615. v18 = *(*uintptr)(unsafe.Pointer(v19))
  18616. *(*uintptr)(unsafe.Pointer(v19))++
  18617. *(*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))
  18618. v21 = toP
  18619. v20 = *(*uintptr)(unsafe.Pointer(v21))
  18620. *(*uintptr)(unsafe.Pointer(v21))++
  18621. *(*uint8)(unsafe.Pointer(v20)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18622. break
  18623. }
  18624. goto _1
  18625. _1:
  18626. ;
  18627. from += uintptr(2)
  18628. }
  18629. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18630. if from < fromLim {
  18631. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18632. } else {
  18633. return int32(_XML_CONVERT_COMPLETED)
  18634. }
  18635. return r
  18636. }
  18637. func _big2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18638. var res _XML_Convert_Result
  18639. var v2, v3 uintptr
  18640. _, _, _ = res, v2, v3
  18641. res = int32(_XML_CONVERT_COMPLETED)
  18642. _ = enc
  18643. 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 */
  18644. 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) {
  18645. fromLim -= uintptr(2)
  18646. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18647. }
  18648. for {
  18649. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  18650. break
  18651. }
  18652. v3 = toP
  18653. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18654. *(*uintptr)(unsafe.Pointer(v3)) += 2
  18655. *(*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))))
  18656. goto _1
  18657. _1:
  18658. ;
  18659. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  18660. }
  18661. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18662. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18663. } else {
  18664. return res
  18665. }
  18666. return r
  18667. }
  18668. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  18669. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  18670. __ __ _
  18671. ___\ \/ /_ __ __ _| |_
  18672. / _ \\ /| '_ \ / _` | __|
  18673. | __// \| |_) | (_| | |_
  18674. \___/_/\_\ .__/ \__,_|\__|
  18675. |_| XML parser
  18676. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  18677. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  18678. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  18679. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  18680. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  18681. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  18682. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  18683. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  18684. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  18685. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  18686. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  18687. Licensed under the MIT license:
  18688. Permission is hereby granted, free of charge, to any person obtaining
  18689. a copy of this software and associated documentation files (the
  18690. "Software"), to deal in the Software without restriction, including
  18691. without limitation the rights to use, copy, modify, merge, publish,
  18692. distribute, sublicense, and/or sell copies of the Software, and to permit
  18693. persons to whom the Software is furnished to do so, subject to the
  18694. following conditions:
  18695. The above copyright notice and this permission notice shall be included
  18696. in all copies or substantial portions of the Software.
  18697. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18698. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18699. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  18700. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  18701. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  18702. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  18703. USE OR OTHER DEALINGS IN THE SOFTWARE.
  18704. */
  18705. /* ptr points to character following "<!-" */
  18706. func _little2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18707. var v1 int32
  18708. _ = v1
  18709. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18710. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1)) {
  18711. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18712. return m_XML_TOK_INVALID
  18713. }
  18714. ptr += uintptr(2)
  18715. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18716. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18717. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18718. } else {
  18719. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18720. }
  18721. switch v1 {
  18722. case int32(_BT_LEAD2):
  18723. if int64(end)-int64(ptr) < int64(2) {
  18724. return -int32(2)
  18725. }
  18726. if 0 != 0 {
  18727. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18728. return m_XML_TOK_INVALID
  18729. }
  18730. ptr += uintptr(2)
  18731. case int32(_BT_LEAD3):
  18732. if int64(end)-int64(ptr) < int64(3) {
  18733. return -int32(2)
  18734. }
  18735. if 0 != 0 {
  18736. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18737. return m_XML_TOK_INVALID
  18738. }
  18739. ptr += uintptr(3)
  18740. case int32(_BT_LEAD4):
  18741. if int64(end)-int64(ptr) < int64(4) {
  18742. return -int32(2)
  18743. }
  18744. if 0 != 0 {
  18745. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18746. return m_XML_TOK_INVALID
  18747. }
  18748. ptr += uintptr(4)
  18749. case int32(_BT_NONXML):
  18750. fallthrough
  18751. case int32(_BT_MALFORM):
  18752. fallthrough
  18753. case int32(_BT_TRAIL):
  18754. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18755. return m_XML_TOK_INVALID
  18756. case int32(_BT_MINUS):
  18757. ptr += uintptr(2)
  18758. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18759. return -int32(1)
  18760. }
  18761. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  18762. ptr += uintptr(2)
  18763. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18764. return -int32(1)
  18765. }
  18766. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  18767. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18768. return m_XML_TOK_INVALID
  18769. }
  18770. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18771. return int32(m_XML_TOK_COMMENT)
  18772. }
  18773. default:
  18774. ptr += uintptr(2)
  18775. break
  18776. }
  18777. }
  18778. }
  18779. return -int32(1)
  18780. }
  18781. /* ptr points to character following "<!" */
  18782. func _little2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18783. var v1, v2, v3 int32
  18784. _, _, _ = v1, v2, v3
  18785. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18786. return -int32(1)
  18787. }
  18788. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18789. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18790. } else {
  18791. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18792. }
  18793. switch v1 {
  18794. case int32(_BT_MINUS):
  18795. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18796. case int32(_BT_LSQB):
  18797. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18798. return int32(m_XML_TOK_COND_SECT_OPEN)
  18799. case int32(_BT_NMSTRT):
  18800. fallthrough
  18801. case int32(_BT_HEX):
  18802. ptr += uintptr(2)
  18803. default:
  18804. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18805. return m_XML_TOK_INVALID
  18806. }
  18807. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18808. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18809. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18810. } else {
  18811. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18812. }
  18813. switch v2 {
  18814. case int32(_BT_PERCNT):
  18815. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  18816. return -int32(1)
  18817. }
  18818. /* don't allow <!ENTITY% foo "whatever"> */
  18819. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  18820. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))))))
  18821. } else {
  18822. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  18823. }
  18824. switch v3 {
  18825. case int32(_BT_S):
  18826. fallthrough
  18827. case int32(_BT_CR):
  18828. fallthrough
  18829. case int32(_BT_LF):
  18830. fallthrough
  18831. case int32(_BT_PERCNT):
  18832. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18833. return m_XML_TOK_INVALID
  18834. }
  18835. /* fall through */
  18836. fallthrough
  18837. case int32(_BT_S):
  18838. fallthrough
  18839. case int32(_BT_CR):
  18840. fallthrough
  18841. case int32(_BT_LF):
  18842. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18843. return int32(m_XML_TOK_DECL_OPEN)
  18844. case int32(_BT_NMSTRT):
  18845. fallthrough
  18846. case int32(_BT_HEX):
  18847. ptr += uintptr(2)
  18848. default:
  18849. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18850. return m_XML_TOK_INVALID
  18851. }
  18852. }
  18853. return -int32(1)
  18854. }
  18855. func _little2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  18856. var upper, v1, v2, v3 int32
  18857. _, _, _, _ = upper, v1, v2, v3
  18858. upper = 0
  18859. _ = enc
  18860. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  18861. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(3)) {
  18862. return int32(1)
  18863. }
  18864. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18865. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  18866. } else {
  18867. v1 = -int32(1)
  18868. }
  18869. switch v1 {
  18870. case int32(m_ASCII_x2):
  18871. case int32(m_ASCII_X):
  18872. upper = int32(1)
  18873. default:
  18874. return int32(1)
  18875. }
  18876. ptr += uintptr(2)
  18877. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18878. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  18879. } else {
  18880. v2 = -int32(1)
  18881. }
  18882. switch v2 {
  18883. case int32(m_ASCII_m2):
  18884. case int32(m_ASCII_M):
  18885. upper = int32(1)
  18886. default:
  18887. return int32(1)
  18888. }
  18889. ptr += uintptr(2)
  18890. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18891. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  18892. } else {
  18893. v3 = -int32(1)
  18894. }
  18895. switch v3 {
  18896. case int32(m_ASCII_l2):
  18897. case int32(m_ASCII_L):
  18898. upper = int32(1)
  18899. default:
  18900. return int32(1)
  18901. }
  18902. if upper != 0 {
  18903. return 0
  18904. }
  18905. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  18906. return int32(1)
  18907. }
  18908. /* ptr points to character following "<?" */
  18909. func _little2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18910. bp := tls.Alloc(16)
  18911. defer tls.Free(16)
  18912. var target uintptr
  18913. var v1, v2, v3 int32
  18914. var _ /* tok at bp+0 */ int32
  18915. _, _, _, _ = target, v1, v2, v3
  18916. target = ptr
  18917. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18918. return -int32(1)
  18919. }
  18920. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18921. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18922. } else {
  18923. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18924. }
  18925. switch v1 {
  18926. case int32(_BT_NONASCII):
  18927. 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) {
  18928. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18929. return m_XML_TOK_INVALID
  18930. } /* fall through */
  18931. fallthrough
  18932. case int32(_BT_NMSTRT):
  18933. fallthrough
  18934. case int32(_BT_HEX):
  18935. ptr += uintptr(2)
  18936. case int32(_BT_LEAD2):
  18937. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  18938. return -int32(2)
  18939. }
  18940. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  18941. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18942. return m_XML_TOK_INVALID
  18943. }
  18944. ptr += uintptr(2)
  18945. case int32(_BT_LEAD3):
  18946. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  18947. return -int32(2)
  18948. }
  18949. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  18950. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18951. return m_XML_TOK_INVALID
  18952. }
  18953. ptr += uintptr(3)
  18954. case int32(_BT_LEAD4):
  18955. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  18956. return -int32(2)
  18957. }
  18958. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  18959. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18960. return m_XML_TOK_INVALID
  18961. }
  18962. ptr += uintptr(4)
  18963. default:
  18964. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18965. return m_XML_TOK_INVALID
  18966. }
  18967. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18968. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18969. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18970. } else {
  18971. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18972. }
  18973. switch v2 {
  18974. case int32(_BT_NONASCII):
  18975. 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) {
  18976. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18977. return m_XML_TOK_INVALID
  18978. } /* fall through */
  18979. fallthrough
  18980. case int32(_BT_NMSTRT):
  18981. fallthrough
  18982. case int32(_BT_HEX):
  18983. fallthrough
  18984. case int32(_BT_DIGIT):
  18985. fallthrough
  18986. case int32(_BT_NAME):
  18987. fallthrough
  18988. case int32(_BT_MINUS):
  18989. ptr += uintptr(2)
  18990. case int32(_BT_LEAD2):
  18991. if int64(end)-int64(ptr) < int64(2) {
  18992. return -int32(2)
  18993. }
  18994. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  18995. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18996. return m_XML_TOK_INVALID
  18997. }
  18998. ptr += uintptr(2)
  18999. case int32(_BT_LEAD3):
  19000. if int64(end)-int64(ptr) < int64(3) {
  19001. return -int32(2)
  19002. }
  19003. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19004. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19005. return m_XML_TOK_INVALID
  19006. }
  19007. ptr += uintptr(3)
  19008. case int32(_BT_LEAD4):
  19009. if int64(end)-int64(ptr) < int64(4) {
  19010. return -int32(2)
  19011. }
  19012. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19013. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19014. return m_XML_TOK_INVALID
  19015. }
  19016. ptr += uintptr(4)
  19017. case int32(_BT_S):
  19018. fallthrough
  19019. case int32(_BT_CR):
  19020. fallthrough
  19021. case int32(_BT_LF):
  19022. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  19023. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19024. return m_XML_TOK_INVALID
  19025. }
  19026. ptr += uintptr(2)
  19027. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19028. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19029. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19030. } else {
  19031. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19032. }
  19033. switch v3 {
  19034. case int32(_BT_LEAD2):
  19035. if int64(end)-int64(ptr) < int64(2) {
  19036. return -int32(2)
  19037. }
  19038. if 0 != 0 {
  19039. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19040. return m_XML_TOK_INVALID
  19041. }
  19042. ptr += uintptr(2)
  19043. case int32(_BT_LEAD3):
  19044. if int64(end)-int64(ptr) < int64(3) {
  19045. return -int32(2)
  19046. }
  19047. if 0 != 0 {
  19048. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19049. return m_XML_TOK_INVALID
  19050. }
  19051. ptr += uintptr(3)
  19052. case int32(_BT_LEAD4):
  19053. if int64(end)-int64(ptr) < int64(4) {
  19054. return -int32(2)
  19055. }
  19056. if 0 != 0 {
  19057. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19058. return m_XML_TOK_INVALID
  19059. }
  19060. ptr += uintptr(4)
  19061. case int32(_BT_NONXML):
  19062. fallthrough
  19063. case int32(_BT_MALFORM):
  19064. fallthrough
  19065. case int32(_BT_TRAIL):
  19066. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19067. return m_XML_TOK_INVALID
  19068. case int32(_BT_QUEST):
  19069. ptr += uintptr(2)
  19070. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19071. return -int32(1)
  19072. }
  19073. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  19074. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19075. return *(*int32)(unsafe.Pointer(bp))
  19076. }
  19077. default:
  19078. ptr += uintptr(2)
  19079. break
  19080. }
  19081. }
  19082. return -int32(1)
  19083. case int32(_BT_QUEST):
  19084. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  19085. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19086. return m_XML_TOK_INVALID
  19087. }
  19088. ptr += uintptr(2)
  19089. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19090. return -int32(1)
  19091. }
  19092. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  19093. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19094. return *(*int32)(unsafe.Pointer(bp))
  19095. }
  19096. /* fall through */
  19097. fallthrough
  19098. default:
  19099. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19100. return m_XML_TOK_INVALID
  19101. }
  19102. }
  19103. return -int32(1)
  19104. }
  19105. func _little2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19106. var i int32
  19107. _ = i
  19108. _ = enc
  19109. /* CDATA[ */
  19110. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))) {
  19111. return -int32(1)
  19112. }
  19113. i = 0
  19114. for {
  19115. if !(i < int32(6)) {
  19116. break
  19117. }
  19118. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromUint8(_CDATA_LSQB1[i])) {
  19119. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19120. return m_XML_TOK_INVALID
  19121. }
  19122. goto _1
  19123. _1:
  19124. ;
  19125. i++
  19126. ptr += uintptr(2)
  19127. }
  19128. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19129. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  19130. }
  19131. var _CDATA_LSQB1 = [6]uint8{
  19132. 0: uint8(m_ASCII_C),
  19133. 1: uint8(m_ASCII_D),
  19134. 2: uint8(m_ASCII_A),
  19135. 3: uint8(m_ASCII_T),
  19136. 4: uint8(m_ASCII_A),
  19137. 5: uint8(m_ASCII_LSQB1),
  19138. }
  19139. func _little2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19140. var n Tsize_t
  19141. var v1, v2, v3 int32
  19142. _, _, _, _ = n, v1, v2, v3
  19143. if ptr >= end {
  19144. return -int32(4)
  19145. }
  19146. if int32(2) > int32(1) {
  19147. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  19148. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  19149. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  19150. if n == uint64(0) {
  19151. return -int32(1)
  19152. }
  19153. end = ptr + uintptr(n)
  19154. }
  19155. }
  19156. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19157. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19158. } else {
  19159. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19160. }
  19161. switch v1 {
  19162. case int32(_BT_RSQB):
  19163. ptr += uintptr(2)
  19164. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19165. return -int32(1)
  19166. }
  19167. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  19168. break
  19169. }
  19170. ptr += uintptr(2)
  19171. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19172. return -int32(1)
  19173. }
  19174. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  19175. ptr -= uintptr(2)
  19176. break
  19177. }
  19178. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19179. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  19180. case int32(_BT_CR):
  19181. ptr += uintptr(2)
  19182. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19183. return -int32(1)
  19184. }
  19185. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19186. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19187. } else {
  19188. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19189. }
  19190. if v2 == int32(_BT_LF) {
  19191. ptr += uintptr(2)
  19192. }
  19193. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19194. return int32(m_XML_TOK_DATA_NEWLINE)
  19195. case int32(_BT_LF):
  19196. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19197. return int32(m_XML_TOK_DATA_NEWLINE)
  19198. case int32(_BT_LEAD2):
  19199. if int64(end)-int64(ptr) < int64(2) {
  19200. return -int32(2)
  19201. }
  19202. if 0 != 0 {
  19203. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19204. return m_XML_TOK_INVALID
  19205. }
  19206. ptr += uintptr(2)
  19207. case int32(_BT_LEAD3):
  19208. if int64(end)-int64(ptr) < int64(3) {
  19209. return -int32(2)
  19210. }
  19211. if 0 != 0 {
  19212. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19213. return m_XML_TOK_INVALID
  19214. }
  19215. ptr += uintptr(3)
  19216. case int32(_BT_LEAD4):
  19217. if int64(end)-int64(ptr) < int64(4) {
  19218. return -int32(2)
  19219. }
  19220. if 0 != 0 {
  19221. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19222. return m_XML_TOK_INVALID
  19223. }
  19224. ptr += uintptr(4)
  19225. case int32(_BT_NONXML):
  19226. fallthrough
  19227. case int32(_BT_MALFORM):
  19228. fallthrough
  19229. case int32(_BT_TRAIL):
  19230. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19231. return m_XML_TOK_INVALID
  19232. default:
  19233. ptr += uintptr(2)
  19234. break
  19235. }
  19236. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19237. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19238. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19239. } else {
  19240. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19241. }
  19242. switch v3 {
  19243. case int32(_BT_LEAD2):
  19244. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  19245. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19246. return int32(m_XML_TOK_DATA_CHARS)
  19247. }
  19248. ptr += uintptr(2)
  19249. case int32(_BT_LEAD3):
  19250. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  19251. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19252. return int32(m_XML_TOK_DATA_CHARS)
  19253. }
  19254. ptr += uintptr(3)
  19255. case int32(_BT_LEAD4):
  19256. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  19257. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19258. return int32(m_XML_TOK_DATA_CHARS)
  19259. }
  19260. ptr += uintptr(4)
  19261. case int32(_BT_NONXML):
  19262. fallthrough
  19263. case int32(_BT_MALFORM):
  19264. fallthrough
  19265. case int32(_BT_TRAIL):
  19266. fallthrough
  19267. case int32(_BT_CR):
  19268. fallthrough
  19269. case int32(_BT_LF):
  19270. fallthrough
  19271. case int32(_BT_RSQB):
  19272. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19273. return int32(m_XML_TOK_DATA_CHARS)
  19274. default:
  19275. ptr += uintptr(2)
  19276. break
  19277. }
  19278. }
  19279. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19280. return int32(m_XML_TOK_DATA_CHARS)
  19281. }
  19282. /* ptr points to character following "</" */
  19283. func _little2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19284. var v1, v2, v22 int32
  19285. _, _, _ = v1, v2, v22
  19286. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19287. return -int32(1)
  19288. }
  19289. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19290. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19291. } else {
  19292. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19293. }
  19294. switch v1 {
  19295. case int32(_BT_NONASCII):
  19296. 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) {
  19297. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19298. return m_XML_TOK_INVALID
  19299. } /* fall through */
  19300. fallthrough
  19301. case int32(_BT_NMSTRT):
  19302. fallthrough
  19303. case int32(_BT_HEX):
  19304. ptr += uintptr(2)
  19305. case int32(_BT_LEAD2):
  19306. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  19307. return -int32(2)
  19308. }
  19309. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19310. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19311. return m_XML_TOK_INVALID
  19312. }
  19313. ptr += uintptr(2)
  19314. case int32(_BT_LEAD3):
  19315. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  19316. return -int32(2)
  19317. }
  19318. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19319. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19320. return m_XML_TOK_INVALID
  19321. }
  19322. ptr += uintptr(3)
  19323. case int32(_BT_LEAD4):
  19324. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  19325. return -int32(2)
  19326. }
  19327. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19328. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19329. return m_XML_TOK_INVALID
  19330. }
  19331. ptr += uintptr(4)
  19332. default:
  19333. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19334. return m_XML_TOK_INVALID
  19335. }
  19336. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19337. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19338. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19339. } else {
  19340. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19341. }
  19342. switch v2 {
  19343. case int32(_BT_NONASCII):
  19344. goto _3
  19345. case int32(_BT_MINUS):
  19346. goto _4
  19347. case int32(_BT_NAME):
  19348. goto _5
  19349. case int32(_BT_DIGIT):
  19350. goto _6
  19351. case int32(_BT_HEX):
  19352. goto _7
  19353. case int32(_BT_NMSTRT):
  19354. goto _8
  19355. case int32(_BT_LEAD2):
  19356. goto _9
  19357. case int32(_BT_LEAD3):
  19358. goto _10
  19359. case int32(_BT_LEAD4):
  19360. goto _11
  19361. case int32(_BT_LF):
  19362. goto _12
  19363. case int32(_BT_CR):
  19364. goto _13
  19365. case int32(_BT_S):
  19366. goto _14
  19367. case int32(_BT_COLON):
  19368. goto _15
  19369. case int32(_BT_GT):
  19370. goto _16
  19371. default:
  19372. goto _17
  19373. }
  19374. goto _18
  19375. _3:
  19376. ;
  19377. 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) {
  19378. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19379. return m_XML_TOK_INVALID
  19380. } /* fall through */
  19381. _8:
  19382. ;
  19383. _7:
  19384. ;
  19385. _6:
  19386. ;
  19387. _5:
  19388. ;
  19389. _4:
  19390. ;
  19391. ptr += uintptr(2)
  19392. goto _18
  19393. _9:
  19394. ;
  19395. if int64(end)-int64(ptr) < int64(2) {
  19396. return -int32(2)
  19397. }
  19398. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19399. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19400. return m_XML_TOK_INVALID
  19401. }
  19402. ptr += uintptr(2)
  19403. goto _18
  19404. _10:
  19405. ;
  19406. if int64(end)-int64(ptr) < int64(3) {
  19407. return -int32(2)
  19408. }
  19409. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19410. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19411. return m_XML_TOK_INVALID
  19412. }
  19413. ptr += uintptr(3)
  19414. goto _18
  19415. _11:
  19416. ;
  19417. if int64(end)-int64(ptr) < int64(4) {
  19418. return -int32(2)
  19419. }
  19420. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19421. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19422. return m_XML_TOK_INVALID
  19423. }
  19424. ptr += uintptr(4)
  19425. goto _18
  19426. _14:
  19427. ;
  19428. _13:
  19429. ;
  19430. _12:
  19431. ;
  19432. ptr += uintptr(2)
  19433. _21:
  19434. ;
  19435. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19436. goto _19
  19437. }
  19438. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19439. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19440. } else {
  19441. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19442. }
  19443. switch v22 {
  19444. case int32(_BT_S):
  19445. fallthrough
  19446. case int32(_BT_CR):
  19447. fallthrough
  19448. case int32(_BT_LF):
  19449. case int32(_BT_GT):
  19450. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19451. return int32(m_XML_TOK_END_TAG)
  19452. default:
  19453. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19454. return m_XML_TOK_INVALID
  19455. }
  19456. goto _20
  19457. _20:
  19458. ;
  19459. ptr += uintptr(2)
  19460. goto _21
  19461. goto _19
  19462. _19:
  19463. ;
  19464. return -int32(1)
  19465. _15:
  19466. ;
  19467. /* no need to check qname syntax here,
  19468. since end-tag must match exactly */
  19469. ptr += uintptr(2)
  19470. goto _18
  19471. _16:
  19472. ;
  19473. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19474. return int32(m_XML_TOK_END_TAG)
  19475. _17:
  19476. ;
  19477. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19478. return m_XML_TOK_INVALID
  19479. _18:
  19480. }
  19481. return -int32(1)
  19482. }
  19483. /* ptr points to character following "&#X" */
  19484. func _little2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19485. var v1, v3 int32
  19486. _, _ = v1, v3
  19487. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19488. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19489. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19490. } else {
  19491. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19492. }
  19493. switch v1 {
  19494. case int32(_BT_DIGIT):
  19495. fallthrough
  19496. case int32(_BT_HEX):
  19497. default:
  19498. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19499. return m_XML_TOK_INVALID
  19500. }
  19501. ptr += uintptr(2)
  19502. for {
  19503. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19504. break
  19505. }
  19506. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19507. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19508. } else {
  19509. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19510. }
  19511. switch v3 {
  19512. case int32(_BT_DIGIT):
  19513. fallthrough
  19514. case int32(_BT_HEX):
  19515. case int32(_BT_SEMI):
  19516. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19517. return int32(m_XML_TOK_CHAR_REF)
  19518. default:
  19519. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19520. return m_XML_TOK_INVALID
  19521. }
  19522. goto _2
  19523. _2:
  19524. ;
  19525. ptr += uintptr(2)
  19526. }
  19527. }
  19528. return -int32(1)
  19529. }
  19530. /* ptr points to character following "&#" */
  19531. func _little2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19532. var v1, v3 int32
  19533. _, _ = v1, v3
  19534. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19535. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  19536. return _little2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19537. }
  19538. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19539. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19540. } else {
  19541. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19542. }
  19543. switch v1 {
  19544. case int32(_BT_DIGIT):
  19545. default:
  19546. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19547. return m_XML_TOK_INVALID
  19548. }
  19549. ptr += uintptr(2)
  19550. for {
  19551. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19552. break
  19553. }
  19554. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19555. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19556. } else {
  19557. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19558. }
  19559. switch v3 {
  19560. case int32(_BT_DIGIT):
  19561. case int32(_BT_SEMI):
  19562. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19563. return int32(m_XML_TOK_CHAR_REF)
  19564. default:
  19565. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19566. return m_XML_TOK_INVALID
  19567. }
  19568. goto _2
  19569. _2:
  19570. ;
  19571. ptr += uintptr(2)
  19572. }
  19573. }
  19574. return -int32(1)
  19575. }
  19576. /* ptr points to character following "&" */
  19577. func _little2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19578. var v1, v2 int32
  19579. _, _ = v1, v2
  19580. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19581. return -int32(1)
  19582. }
  19583. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19584. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19585. } else {
  19586. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19587. }
  19588. switch v1 {
  19589. case int32(_BT_NONASCII):
  19590. 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) {
  19591. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19592. return m_XML_TOK_INVALID
  19593. } /* fall through */
  19594. fallthrough
  19595. case int32(_BT_NMSTRT):
  19596. fallthrough
  19597. case int32(_BT_HEX):
  19598. ptr += uintptr(2)
  19599. case int32(_BT_LEAD2):
  19600. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  19601. return -int32(2)
  19602. }
  19603. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19604. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19605. return m_XML_TOK_INVALID
  19606. }
  19607. ptr += uintptr(2)
  19608. case int32(_BT_LEAD3):
  19609. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  19610. return -int32(2)
  19611. }
  19612. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19613. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19614. return m_XML_TOK_INVALID
  19615. }
  19616. ptr += uintptr(3)
  19617. case int32(_BT_LEAD4):
  19618. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  19619. return -int32(2)
  19620. }
  19621. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19622. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19623. return m_XML_TOK_INVALID
  19624. }
  19625. ptr += uintptr(4)
  19626. case int32(_BT_NUM):
  19627. return _little2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19628. default:
  19629. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19630. return m_XML_TOK_INVALID
  19631. }
  19632. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19633. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19634. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19635. } else {
  19636. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19637. }
  19638. switch v2 {
  19639. case int32(_BT_NONASCII):
  19640. 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) {
  19641. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19642. return m_XML_TOK_INVALID
  19643. } /* fall through */
  19644. fallthrough
  19645. case int32(_BT_NMSTRT):
  19646. fallthrough
  19647. case int32(_BT_HEX):
  19648. fallthrough
  19649. case int32(_BT_DIGIT):
  19650. fallthrough
  19651. case int32(_BT_NAME):
  19652. fallthrough
  19653. case int32(_BT_MINUS):
  19654. ptr += uintptr(2)
  19655. case int32(_BT_LEAD2):
  19656. if int64(end)-int64(ptr) < int64(2) {
  19657. return -int32(2)
  19658. }
  19659. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19660. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19661. return m_XML_TOK_INVALID
  19662. }
  19663. ptr += uintptr(2)
  19664. case int32(_BT_LEAD3):
  19665. if int64(end)-int64(ptr) < int64(3) {
  19666. return -int32(2)
  19667. }
  19668. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19669. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19670. return m_XML_TOK_INVALID
  19671. }
  19672. ptr += uintptr(3)
  19673. case int32(_BT_LEAD4):
  19674. if int64(end)-int64(ptr) < int64(4) {
  19675. return -int32(2)
  19676. }
  19677. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19678. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19679. return m_XML_TOK_INVALID
  19680. }
  19681. ptr += uintptr(4)
  19682. case int32(_BT_SEMI):
  19683. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19684. return int32(m_XML_TOK_ENTITY_REF)
  19685. default:
  19686. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19687. return m_XML_TOK_INVALID
  19688. }
  19689. }
  19690. return -int32(1)
  19691. }
  19692. /* ptr points to character following first character of attribute name */
  19693. func _little2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19694. bp := tls.Alloc(16)
  19695. defer tls.Free(16)
  19696. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  19697. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  19698. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  19699. hadColon = 0
  19700. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19701. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19702. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  19703. } else {
  19704. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19705. }
  19706. switch v1 {
  19707. case int32(_BT_NONASCII):
  19708. goto _2
  19709. case int32(_BT_MINUS):
  19710. goto _3
  19711. case int32(_BT_NAME):
  19712. goto _4
  19713. case int32(_BT_DIGIT):
  19714. goto _5
  19715. case int32(_BT_HEX):
  19716. goto _6
  19717. case int32(_BT_NMSTRT):
  19718. goto _7
  19719. case int32(_BT_LEAD2):
  19720. goto _8
  19721. case int32(_BT_LEAD3):
  19722. goto _9
  19723. case int32(_BT_LEAD4):
  19724. goto _10
  19725. case int32(_BT_COLON):
  19726. goto _11
  19727. case int32(_BT_LF):
  19728. goto _12
  19729. case int32(_BT_CR):
  19730. goto _13
  19731. case int32(_BT_S):
  19732. goto _14
  19733. case int32(_BT_EQUALS):
  19734. goto _15
  19735. default:
  19736. goto _16
  19737. }
  19738. goto _17
  19739. _2:
  19740. ;
  19741. 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) {
  19742. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19743. return m_XML_TOK_INVALID
  19744. } /* fall through */
  19745. _7:
  19746. ;
  19747. _6:
  19748. ;
  19749. _5:
  19750. ;
  19751. _4:
  19752. ;
  19753. _3:
  19754. ;
  19755. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19756. goto _17
  19757. _8:
  19758. ;
  19759. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  19760. return -int32(2)
  19761. }
  19762. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19763. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19764. return m_XML_TOK_INVALID
  19765. }
  19766. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19767. goto _17
  19768. _9:
  19769. ;
  19770. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  19771. return -int32(2)
  19772. }
  19773. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19774. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19775. return m_XML_TOK_INVALID
  19776. }
  19777. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  19778. goto _17
  19779. _10:
  19780. ;
  19781. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  19782. return -int32(2)
  19783. }
  19784. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19785. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19786. return m_XML_TOK_INVALID
  19787. }
  19788. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  19789. goto _17
  19790. _11:
  19791. ;
  19792. if hadColon != 0 {
  19793. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19794. return m_XML_TOK_INVALID
  19795. }
  19796. hadColon = int32(1)
  19797. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19798. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19799. return -int32(1)
  19800. }
  19801. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19802. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  19803. } else {
  19804. v18 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19805. }
  19806. switch v18 {
  19807. case int32(_BT_NONASCII):
  19808. 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) {
  19809. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19810. return m_XML_TOK_INVALID
  19811. } /* fall through */
  19812. fallthrough
  19813. case int32(_BT_NMSTRT):
  19814. fallthrough
  19815. case int32(_BT_HEX):
  19816. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19817. case int32(_BT_LEAD2):
  19818. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  19819. return -int32(2)
  19820. }
  19821. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19822. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19823. return m_XML_TOK_INVALID
  19824. }
  19825. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19826. case int32(_BT_LEAD3):
  19827. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  19828. return -int32(2)
  19829. }
  19830. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19831. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19832. return m_XML_TOK_INVALID
  19833. }
  19834. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  19835. case int32(_BT_LEAD4):
  19836. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  19837. return -int32(2)
  19838. }
  19839. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19840. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19841. return m_XML_TOK_INVALID
  19842. }
  19843. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  19844. default:
  19845. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19846. return m_XML_TOK_INVALID
  19847. }
  19848. goto _17
  19849. _14:
  19850. ;
  19851. _13:
  19852. ;
  19853. _12:
  19854. ;
  19855. _21:
  19856. ;
  19857. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19858. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19859. return -int32(1)
  19860. }
  19861. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19862. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  19863. } else {
  19864. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19865. }
  19866. t = v22
  19867. if t == int32(_BT_EQUALS) {
  19868. goto _19
  19869. }
  19870. switch t {
  19871. case int32(_BT_S):
  19872. fallthrough
  19873. case int32(_BT_LF):
  19874. fallthrough
  19875. case int32(_BT_CR):
  19876. default:
  19877. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19878. return m_XML_TOK_INVALID
  19879. }
  19880. goto _20
  19881. _20:
  19882. ;
  19883. goto _21
  19884. goto _19
  19885. _19:
  19886. ;
  19887. /* fall through */
  19888. _15:
  19889. ;
  19890. hadColon = 0
  19891. for {
  19892. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19893. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19894. return -int32(1)
  19895. }
  19896. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19897. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  19898. } else {
  19899. v24 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19900. }
  19901. open = v24
  19902. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  19903. break
  19904. }
  19905. switch open {
  19906. case int32(_BT_S):
  19907. fallthrough
  19908. case int32(_BT_LF):
  19909. fallthrough
  19910. case int32(_BT_CR):
  19911. default:
  19912. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19913. return m_XML_TOK_INVALID
  19914. }
  19915. goto _23
  19916. _23:
  19917. }
  19918. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19919. /* in attribute value */
  19920. for {
  19921. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19922. return -int32(1)
  19923. }
  19924. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19925. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  19926. } else {
  19927. v26 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19928. }
  19929. t1 = v26
  19930. if t1 == open {
  19931. break
  19932. }
  19933. switch t1 {
  19934. case int32(_BT_LEAD2):
  19935. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  19936. return -int32(2)
  19937. }
  19938. if 0 != 0 {
  19939. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19940. return m_XML_TOK_INVALID
  19941. }
  19942. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19943. case int32(_BT_LEAD3):
  19944. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  19945. return -int32(2)
  19946. }
  19947. if 0 != 0 {
  19948. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19949. return m_XML_TOK_INVALID
  19950. }
  19951. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  19952. case int32(_BT_LEAD4):
  19953. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  19954. return -int32(2)
  19955. }
  19956. if 0 != 0 {
  19957. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19958. return m_XML_TOK_INVALID
  19959. }
  19960. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  19961. case int32(_BT_NONXML):
  19962. fallthrough
  19963. case int32(_BT_MALFORM):
  19964. fallthrough
  19965. case int32(_BT_TRAIL):
  19966. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19967. return m_XML_TOK_INVALID
  19968. case int32(_BT_AMP):
  19969. tok = _little2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  19970. if tok <= 0 {
  19971. if tok == m_XML_TOK_INVALID {
  19972. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19973. }
  19974. return tok
  19975. }
  19976. case int32(_BT_LT):
  19977. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19978. return m_XML_TOK_INVALID
  19979. default:
  19980. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19981. break
  19982. }
  19983. goto _25
  19984. _25:
  19985. }
  19986. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19987. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19988. return -int32(1)
  19989. }
  19990. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19991. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  19992. } else {
  19993. v27 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19994. }
  19995. switch v27 {
  19996. case int32(_BT_S):
  19997. fallthrough
  19998. case int32(_BT_CR):
  19999. fallthrough
  20000. case int32(_BT_LF):
  20001. case int32(_BT_SOL):
  20002. goto sol
  20003. case int32(_BT_GT):
  20004. goto gt
  20005. default:
  20006. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20007. return m_XML_TOK_INVALID
  20008. }
  20009. /* ptr points to closing quote */
  20010. _30:
  20011. ;
  20012. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20013. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20014. return -int32(1)
  20015. }
  20016. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20017. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  20018. } else {
  20019. v31 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20020. }
  20021. switch v31 {
  20022. case int32(_BT_NONASCII):
  20023. goto _32
  20024. case int32(_BT_HEX):
  20025. goto _33
  20026. case int32(_BT_NMSTRT):
  20027. goto _34
  20028. case int32(_BT_LEAD2):
  20029. goto _35
  20030. case int32(_BT_LEAD3):
  20031. goto _36
  20032. case int32(_BT_LEAD4):
  20033. goto _37
  20034. case int32(_BT_LF):
  20035. goto _38
  20036. case int32(_BT_CR):
  20037. goto _39
  20038. case int32(_BT_S):
  20039. goto _40
  20040. case int32(_BT_GT):
  20041. goto _41
  20042. case int32(_BT_SOL):
  20043. goto _42
  20044. default:
  20045. goto _43
  20046. }
  20047. goto _44
  20048. _32:
  20049. ;
  20050. 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) {
  20051. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20052. return m_XML_TOK_INVALID
  20053. } /* fall through */
  20054. _34:
  20055. ;
  20056. _33:
  20057. ;
  20058. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20059. goto _44
  20060. _35:
  20061. ;
  20062. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  20063. return -int32(2)
  20064. }
  20065. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20066. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20067. return m_XML_TOK_INVALID
  20068. }
  20069. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20070. goto _44
  20071. _36:
  20072. ;
  20073. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  20074. return -int32(2)
  20075. }
  20076. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20077. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20078. return m_XML_TOK_INVALID
  20079. }
  20080. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  20081. goto _44
  20082. _37:
  20083. ;
  20084. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  20085. return -int32(2)
  20086. }
  20087. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20088. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20089. return m_XML_TOK_INVALID
  20090. }
  20091. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  20092. goto _44
  20093. _40:
  20094. ;
  20095. _39:
  20096. ;
  20097. _38:
  20098. ;
  20099. goto _29
  20100. _41:
  20101. ;
  20102. goto gt
  20103. gt:
  20104. ;
  20105. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  20106. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  20107. _42:
  20108. ;
  20109. goto sol
  20110. sol:
  20111. ;
  20112. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20113. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20114. return -int32(1)
  20115. }
  20116. 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)) {
  20117. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20118. return m_XML_TOK_INVALID
  20119. }
  20120. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  20121. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  20122. _43:
  20123. ;
  20124. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20125. return m_XML_TOK_INVALID
  20126. _44:
  20127. ;
  20128. goto _28
  20129. goto _29
  20130. _29:
  20131. ;
  20132. goto _30
  20133. goto _28
  20134. _28:
  20135. ;
  20136. goto _17
  20137. _16:
  20138. ;
  20139. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20140. return m_XML_TOK_INVALID
  20141. _17:
  20142. }
  20143. return -int32(1)
  20144. }
  20145. /* ptr points to character following "<" */
  20146. func _little2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20147. var hadColon, v1, v2, v21, v22, v3 int32
  20148. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  20149. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20150. return -int32(1)
  20151. }
  20152. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20153. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20154. } else {
  20155. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20156. }
  20157. switch v1 {
  20158. case int32(_BT_NONASCII):
  20159. 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) {
  20160. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20161. return m_XML_TOK_INVALID
  20162. } /* fall through */
  20163. fallthrough
  20164. case int32(_BT_NMSTRT):
  20165. fallthrough
  20166. case int32(_BT_HEX):
  20167. ptr += uintptr(2)
  20168. case int32(_BT_LEAD2):
  20169. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20170. return -int32(2)
  20171. }
  20172. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20173. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20174. return m_XML_TOK_INVALID
  20175. }
  20176. ptr += uintptr(2)
  20177. case int32(_BT_LEAD3):
  20178. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20179. return -int32(2)
  20180. }
  20181. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20182. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20183. return m_XML_TOK_INVALID
  20184. }
  20185. ptr += uintptr(3)
  20186. case int32(_BT_LEAD4):
  20187. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20188. return -int32(2)
  20189. }
  20190. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20191. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20192. return m_XML_TOK_INVALID
  20193. }
  20194. ptr += uintptr(4)
  20195. case int32(_BT_EXCL):
  20196. ptr += uintptr(2)
  20197. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20198. return -int32(1)
  20199. }
  20200. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20201. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20202. } else {
  20203. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20204. }
  20205. switch v2 {
  20206. case int32(_BT_MINUS):
  20207. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20208. case int32(_BT_LSQB):
  20209. return _little2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20210. }
  20211. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20212. return m_XML_TOK_INVALID
  20213. case int32(_BT_QUEST):
  20214. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20215. case int32(_BT_SOL):
  20216. return _little2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20217. default:
  20218. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20219. return m_XML_TOK_INVALID
  20220. }
  20221. hadColon = 0
  20222. /* we have a start-tag */
  20223. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20224. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20225. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20226. } else {
  20227. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20228. }
  20229. switch v3 {
  20230. case int32(_BT_NONASCII):
  20231. goto _4
  20232. case int32(_BT_MINUS):
  20233. goto _5
  20234. case int32(_BT_NAME):
  20235. goto _6
  20236. case int32(_BT_DIGIT):
  20237. goto _7
  20238. case int32(_BT_HEX):
  20239. goto _8
  20240. case int32(_BT_NMSTRT):
  20241. goto _9
  20242. case int32(_BT_LEAD2):
  20243. goto _10
  20244. case int32(_BT_LEAD3):
  20245. goto _11
  20246. case int32(_BT_LEAD4):
  20247. goto _12
  20248. case int32(_BT_COLON):
  20249. goto _13
  20250. case int32(_BT_LF):
  20251. goto _14
  20252. case int32(_BT_CR):
  20253. goto _15
  20254. case int32(_BT_S):
  20255. goto _16
  20256. case int32(_BT_GT):
  20257. goto _17
  20258. case int32(_BT_SOL):
  20259. goto _18
  20260. default:
  20261. goto _19
  20262. }
  20263. goto _20
  20264. _4:
  20265. ;
  20266. 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) {
  20267. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20268. return m_XML_TOK_INVALID
  20269. } /* fall through */
  20270. _9:
  20271. ;
  20272. _8:
  20273. ;
  20274. _7:
  20275. ;
  20276. _6:
  20277. ;
  20278. _5:
  20279. ;
  20280. ptr += uintptr(2)
  20281. goto _20
  20282. _10:
  20283. ;
  20284. if int64(end)-int64(ptr) < int64(2) {
  20285. return -int32(2)
  20286. }
  20287. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20288. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20289. return m_XML_TOK_INVALID
  20290. }
  20291. ptr += uintptr(2)
  20292. goto _20
  20293. _11:
  20294. ;
  20295. if int64(end)-int64(ptr) < int64(3) {
  20296. return -int32(2)
  20297. }
  20298. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20299. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20300. return m_XML_TOK_INVALID
  20301. }
  20302. ptr += uintptr(3)
  20303. goto _20
  20304. _12:
  20305. ;
  20306. if int64(end)-int64(ptr) < int64(4) {
  20307. return -int32(2)
  20308. }
  20309. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20310. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20311. return m_XML_TOK_INVALID
  20312. }
  20313. ptr += uintptr(4)
  20314. goto _20
  20315. _13:
  20316. ;
  20317. if hadColon != 0 {
  20318. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20319. return m_XML_TOK_INVALID
  20320. }
  20321. hadColon = int32(1)
  20322. ptr += uintptr(2)
  20323. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20324. return -int32(1)
  20325. }
  20326. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20327. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20328. } else {
  20329. v21 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20330. }
  20331. switch v21 {
  20332. case int32(_BT_NONASCII):
  20333. 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) {
  20334. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20335. return m_XML_TOK_INVALID
  20336. } /* fall through */
  20337. fallthrough
  20338. case int32(_BT_NMSTRT):
  20339. fallthrough
  20340. case int32(_BT_HEX):
  20341. ptr += uintptr(2)
  20342. case int32(_BT_LEAD2):
  20343. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20344. return -int32(2)
  20345. }
  20346. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20347. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20348. return m_XML_TOK_INVALID
  20349. }
  20350. ptr += uintptr(2)
  20351. case int32(_BT_LEAD3):
  20352. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20353. return -int32(2)
  20354. }
  20355. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20356. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20357. return m_XML_TOK_INVALID
  20358. }
  20359. ptr += uintptr(3)
  20360. case int32(_BT_LEAD4):
  20361. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20362. return -int32(2)
  20363. }
  20364. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20365. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20366. return m_XML_TOK_INVALID
  20367. }
  20368. ptr += uintptr(4)
  20369. default:
  20370. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20371. return m_XML_TOK_INVALID
  20372. }
  20373. goto _20
  20374. _16:
  20375. ;
  20376. _15:
  20377. ;
  20378. _14:
  20379. ;
  20380. ptr += uintptr(2)
  20381. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20382. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20383. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20384. } else {
  20385. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20386. }
  20387. switch v22 {
  20388. case int32(_BT_NONASCII):
  20389. 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) {
  20390. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20391. return m_XML_TOK_INVALID
  20392. } /* fall through */
  20393. fallthrough
  20394. case int32(_BT_NMSTRT):
  20395. fallthrough
  20396. case int32(_BT_HEX):
  20397. ptr += uintptr(2)
  20398. case int32(_BT_LEAD2):
  20399. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20400. return -int32(2)
  20401. }
  20402. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20403. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20404. return m_XML_TOK_INVALID
  20405. }
  20406. ptr += uintptr(2)
  20407. case int32(_BT_LEAD3):
  20408. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20409. return -int32(2)
  20410. }
  20411. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20412. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20413. return m_XML_TOK_INVALID
  20414. }
  20415. ptr += uintptr(3)
  20416. case int32(_BT_LEAD4):
  20417. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20418. return -int32(2)
  20419. }
  20420. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20421. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20422. return m_XML_TOK_INVALID
  20423. }
  20424. ptr += uintptr(4)
  20425. case int32(_BT_GT):
  20426. goto gt
  20427. case int32(_BT_SOL):
  20428. goto sol
  20429. case int32(_BT_S):
  20430. fallthrough
  20431. case int32(_BT_CR):
  20432. fallthrough
  20433. case int32(_BT_LF):
  20434. ptr += uintptr(2)
  20435. continue
  20436. default:
  20437. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20438. return m_XML_TOK_INVALID
  20439. }
  20440. return _little2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  20441. }
  20442. return -int32(1)
  20443. _17:
  20444. ;
  20445. goto gt
  20446. gt:
  20447. ;
  20448. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20449. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  20450. _18:
  20451. ;
  20452. goto sol
  20453. sol:
  20454. ;
  20455. ptr += uintptr(2)
  20456. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20457. return -int32(1)
  20458. }
  20459. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  20460. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20461. return m_XML_TOK_INVALID
  20462. }
  20463. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20464. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  20465. _19:
  20466. ;
  20467. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20468. return m_XML_TOK_INVALID
  20469. _20:
  20470. }
  20471. return -int32(1)
  20472. }
  20473. func _little2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20474. var n Tsize_t
  20475. var v1, v2, v3 int32
  20476. _, _, _, _ = n, v1, v2, v3
  20477. if ptr >= end {
  20478. return -int32(4)
  20479. }
  20480. if int32(2) > int32(1) {
  20481. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  20482. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  20483. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  20484. if n == uint64(0) {
  20485. return -int32(1)
  20486. }
  20487. end = ptr + uintptr(n)
  20488. }
  20489. }
  20490. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20491. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20492. } else {
  20493. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20494. }
  20495. switch v1 {
  20496. case int32(_BT_LT):
  20497. return _little2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20498. case int32(_BT_AMP):
  20499. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20500. case int32(_BT_CR):
  20501. ptr += uintptr(2)
  20502. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20503. return -int32(3)
  20504. }
  20505. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20506. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20507. } else {
  20508. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20509. }
  20510. if v2 == int32(_BT_LF) {
  20511. ptr += uintptr(2)
  20512. }
  20513. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20514. return int32(m_XML_TOK_DATA_NEWLINE)
  20515. case int32(_BT_LF):
  20516. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20517. return int32(m_XML_TOK_DATA_NEWLINE)
  20518. case int32(_BT_RSQB):
  20519. ptr += uintptr(2)
  20520. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20521. return -int32(5)
  20522. }
  20523. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  20524. break
  20525. }
  20526. ptr += uintptr(2)
  20527. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20528. return -int32(5)
  20529. }
  20530. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  20531. ptr -= uintptr(2)
  20532. break
  20533. }
  20534. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20535. return m_XML_TOK_INVALID
  20536. case int32(_BT_LEAD2):
  20537. if int64(end)-int64(ptr) < int64(2) {
  20538. return -int32(2)
  20539. }
  20540. if 0 != 0 {
  20541. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20542. return m_XML_TOK_INVALID
  20543. }
  20544. ptr += uintptr(2)
  20545. case int32(_BT_LEAD3):
  20546. if int64(end)-int64(ptr) < int64(3) {
  20547. return -int32(2)
  20548. }
  20549. if 0 != 0 {
  20550. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20551. return m_XML_TOK_INVALID
  20552. }
  20553. ptr += uintptr(3)
  20554. case int32(_BT_LEAD4):
  20555. if int64(end)-int64(ptr) < int64(4) {
  20556. return -int32(2)
  20557. }
  20558. if 0 != 0 {
  20559. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20560. return m_XML_TOK_INVALID
  20561. }
  20562. ptr += uintptr(4)
  20563. case int32(_BT_NONXML):
  20564. fallthrough
  20565. case int32(_BT_MALFORM):
  20566. fallthrough
  20567. case int32(_BT_TRAIL):
  20568. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20569. return m_XML_TOK_INVALID
  20570. default:
  20571. ptr += uintptr(2)
  20572. break
  20573. }
  20574. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20575. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20576. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20577. } else {
  20578. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20579. }
  20580. switch v3 {
  20581. case int32(_BT_LEAD2):
  20582. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  20583. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20584. return int32(m_XML_TOK_DATA_CHARS)
  20585. }
  20586. ptr += uintptr(2)
  20587. case int32(_BT_LEAD3):
  20588. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  20589. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20590. return int32(m_XML_TOK_DATA_CHARS)
  20591. }
  20592. ptr += uintptr(3)
  20593. case int32(_BT_LEAD4):
  20594. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  20595. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20596. return int32(m_XML_TOK_DATA_CHARS)
  20597. }
  20598. ptr += uintptr(4)
  20599. case int32(_BT_RSQB):
  20600. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  20601. 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)) {
  20602. ptr += uintptr(2)
  20603. break
  20604. }
  20605. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)) {
  20606. 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)) {
  20607. ptr += uintptr(2)
  20608. break
  20609. }
  20610. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  20611. return m_XML_TOK_INVALID
  20612. }
  20613. }
  20614. /* fall through */
  20615. fallthrough
  20616. case int32(_BT_AMP):
  20617. fallthrough
  20618. case int32(_BT_LT):
  20619. fallthrough
  20620. case int32(_BT_NONXML):
  20621. fallthrough
  20622. case int32(_BT_MALFORM):
  20623. fallthrough
  20624. case int32(_BT_TRAIL):
  20625. fallthrough
  20626. case int32(_BT_CR):
  20627. fallthrough
  20628. case int32(_BT_LF):
  20629. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20630. return int32(m_XML_TOK_DATA_CHARS)
  20631. default:
  20632. ptr += uintptr(2)
  20633. break
  20634. }
  20635. }
  20636. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20637. return int32(m_XML_TOK_DATA_CHARS)
  20638. }
  20639. /* ptr points to character following "%" */
  20640. func _little2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20641. var v1, v2 int32
  20642. _, _ = v1, v2
  20643. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20644. return -int32(1)
  20645. }
  20646. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20647. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20648. } else {
  20649. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20650. }
  20651. switch v1 {
  20652. case int32(_BT_NONASCII):
  20653. 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) {
  20654. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20655. return m_XML_TOK_INVALID
  20656. } /* fall through */
  20657. fallthrough
  20658. case int32(_BT_NMSTRT):
  20659. fallthrough
  20660. case int32(_BT_HEX):
  20661. ptr += uintptr(2)
  20662. case int32(_BT_LEAD2):
  20663. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20664. return -int32(2)
  20665. }
  20666. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20667. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20668. return m_XML_TOK_INVALID
  20669. }
  20670. ptr += uintptr(2)
  20671. case int32(_BT_LEAD3):
  20672. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20673. return -int32(2)
  20674. }
  20675. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20676. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20677. return m_XML_TOK_INVALID
  20678. }
  20679. ptr += uintptr(3)
  20680. case int32(_BT_LEAD4):
  20681. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20682. return -int32(2)
  20683. }
  20684. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20685. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20686. return m_XML_TOK_INVALID
  20687. }
  20688. ptr += uintptr(4)
  20689. case int32(_BT_S):
  20690. fallthrough
  20691. case int32(_BT_LF):
  20692. fallthrough
  20693. case int32(_BT_CR):
  20694. fallthrough
  20695. case int32(_BT_PERCNT):
  20696. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20697. return int32(m_XML_TOK_PERCENT)
  20698. default:
  20699. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20700. return m_XML_TOK_INVALID
  20701. }
  20702. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20703. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20704. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20705. } else {
  20706. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20707. }
  20708. switch v2 {
  20709. case int32(_BT_NONASCII):
  20710. 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) {
  20711. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20712. return m_XML_TOK_INVALID
  20713. } /* fall through */
  20714. fallthrough
  20715. case int32(_BT_NMSTRT):
  20716. fallthrough
  20717. case int32(_BT_HEX):
  20718. fallthrough
  20719. case int32(_BT_DIGIT):
  20720. fallthrough
  20721. case int32(_BT_NAME):
  20722. fallthrough
  20723. case int32(_BT_MINUS):
  20724. ptr += uintptr(2)
  20725. case int32(_BT_LEAD2):
  20726. if int64(end)-int64(ptr) < int64(2) {
  20727. return -int32(2)
  20728. }
  20729. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20730. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20731. return m_XML_TOK_INVALID
  20732. }
  20733. ptr += uintptr(2)
  20734. case int32(_BT_LEAD3):
  20735. if int64(end)-int64(ptr) < int64(3) {
  20736. return -int32(2)
  20737. }
  20738. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20739. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20740. return m_XML_TOK_INVALID
  20741. }
  20742. ptr += uintptr(3)
  20743. case int32(_BT_LEAD4):
  20744. if int64(end)-int64(ptr) < int64(4) {
  20745. return -int32(2)
  20746. }
  20747. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20748. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20749. return m_XML_TOK_INVALID
  20750. }
  20751. ptr += uintptr(4)
  20752. case int32(_BT_SEMI):
  20753. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20754. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  20755. default:
  20756. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20757. return m_XML_TOK_INVALID
  20758. }
  20759. }
  20760. return -int32(1)
  20761. }
  20762. func _little2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20763. var v1, v2 int32
  20764. _, _ = v1, v2
  20765. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20766. return -int32(1)
  20767. }
  20768. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20769. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20770. } else {
  20771. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20772. }
  20773. switch v1 {
  20774. case int32(_BT_NONASCII):
  20775. 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) {
  20776. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20777. return m_XML_TOK_INVALID
  20778. } /* fall through */
  20779. fallthrough
  20780. case int32(_BT_NMSTRT):
  20781. fallthrough
  20782. case int32(_BT_HEX):
  20783. ptr += uintptr(2)
  20784. case int32(_BT_LEAD2):
  20785. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20786. return -int32(2)
  20787. }
  20788. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20789. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20790. return m_XML_TOK_INVALID
  20791. }
  20792. ptr += uintptr(2)
  20793. case int32(_BT_LEAD3):
  20794. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20795. return -int32(2)
  20796. }
  20797. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20798. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20799. return m_XML_TOK_INVALID
  20800. }
  20801. ptr += uintptr(3)
  20802. case int32(_BT_LEAD4):
  20803. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20804. return -int32(2)
  20805. }
  20806. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20807. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20808. return m_XML_TOK_INVALID
  20809. }
  20810. ptr += uintptr(4)
  20811. default:
  20812. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20813. return m_XML_TOK_INVALID
  20814. }
  20815. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20816. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20817. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20818. } else {
  20819. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20820. }
  20821. switch v2 {
  20822. case int32(_BT_NONASCII):
  20823. 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) {
  20824. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20825. return m_XML_TOK_INVALID
  20826. } /* fall through */
  20827. fallthrough
  20828. case int32(_BT_NMSTRT):
  20829. fallthrough
  20830. case int32(_BT_HEX):
  20831. fallthrough
  20832. case int32(_BT_DIGIT):
  20833. fallthrough
  20834. case int32(_BT_NAME):
  20835. fallthrough
  20836. case int32(_BT_MINUS):
  20837. ptr += uintptr(2)
  20838. case int32(_BT_LEAD2):
  20839. if int64(end)-int64(ptr) < int64(2) {
  20840. return -int32(2)
  20841. }
  20842. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20843. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20844. return m_XML_TOK_INVALID
  20845. }
  20846. ptr += uintptr(2)
  20847. case int32(_BT_LEAD3):
  20848. if int64(end)-int64(ptr) < int64(3) {
  20849. return -int32(2)
  20850. }
  20851. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20852. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20853. return m_XML_TOK_INVALID
  20854. }
  20855. ptr += uintptr(3)
  20856. case int32(_BT_LEAD4):
  20857. if int64(end)-int64(ptr) < int64(4) {
  20858. return -int32(2)
  20859. }
  20860. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20861. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20862. return m_XML_TOK_INVALID
  20863. }
  20864. ptr += uintptr(4)
  20865. case int32(_BT_CR):
  20866. fallthrough
  20867. case int32(_BT_LF):
  20868. fallthrough
  20869. case int32(_BT_S):
  20870. fallthrough
  20871. case int32(_BT_RPAR):
  20872. fallthrough
  20873. case int32(_BT_GT):
  20874. fallthrough
  20875. case int32(_BT_PERCNT):
  20876. fallthrough
  20877. case int32(_BT_VERBAR):
  20878. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20879. return int32(m_XML_TOK_POUND_NAME)
  20880. default:
  20881. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20882. return m_XML_TOK_INVALID
  20883. }
  20884. }
  20885. return -int32(m_XML_TOK_POUND_NAME)
  20886. }
  20887. func _little2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20888. var t, v1, v2 int32
  20889. _, _, _ = t, v1, v2
  20890. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20891. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20892. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20893. } else {
  20894. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20895. }
  20896. t = v1
  20897. switch t {
  20898. case int32(_BT_LEAD2):
  20899. if int64(end)-int64(ptr) < int64(2) {
  20900. return -int32(2)
  20901. }
  20902. if 0 != 0 {
  20903. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20904. return m_XML_TOK_INVALID
  20905. }
  20906. ptr += uintptr(2)
  20907. case int32(_BT_LEAD3):
  20908. if int64(end)-int64(ptr) < int64(3) {
  20909. return -int32(2)
  20910. }
  20911. if 0 != 0 {
  20912. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20913. return m_XML_TOK_INVALID
  20914. }
  20915. ptr += uintptr(3)
  20916. case int32(_BT_LEAD4):
  20917. if int64(end)-int64(ptr) < int64(4) {
  20918. return -int32(2)
  20919. }
  20920. if 0 != 0 {
  20921. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20922. return m_XML_TOK_INVALID
  20923. }
  20924. ptr += uintptr(4)
  20925. case int32(_BT_NONXML):
  20926. fallthrough
  20927. case int32(_BT_MALFORM):
  20928. fallthrough
  20929. case int32(_BT_TRAIL):
  20930. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20931. return m_XML_TOK_INVALID
  20932. case int32(_BT_QUOT):
  20933. fallthrough
  20934. case int32(_BT_APOS):
  20935. ptr += uintptr(2)
  20936. if t != open {
  20937. break
  20938. }
  20939. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20940. return -int32(m_XML_TOK_LITERAL)
  20941. }
  20942. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20943. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20944. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20945. } else {
  20946. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20947. }
  20948. switch v2 {
  20949. case int32(_BT_S):
  20950. fallthrough
  20951. case int32(_BT_CR):
  20952. fallthrough
  20953. case int32(_BT_LF):
  20954. fallthrough
  20955. case int32(_BT_GT):
  20956. fallthrough
  20957. case int32(_BT_PERCNT):
  20958. fallthrough
  20959. case int32(_BT_LSQB):
  20960. return int32(m_XML_TOK_LITERAL)
  20961. default:
  20962. return m_XML_TOK_INVALID
  20963. }
  20964. fallthrough
  20965. default:
  20966. ptr += uintptr(2)
  20967. break
  20968. }
  20969. }
  20970. return -int32(1)
  20971. }
  20972. func _little2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20973. var n Tsize_t
  20974. var tok, v1, v29, v33, v34, v35, v36 int32
  20975. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  20976. if ptr >= end {
  20977. return -int32(4)
  20978. }
  20979. if int32(2) > int32(1) {
  20980. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  20981. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  20982. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  20983. if n == uint64(0) {
  20984. return -int32(1)
  20985. }
  20986. end = ptr + uintptr(n)
  20987. }
  20988. }
  20989. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20990. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20991. } else {
  20992. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20993. }
  20994. switch v1 {
  20995. case int32(_BT_QUOT):
  20996. goto _2
  20997. case int32(_BT_APOS):
  20998. goto _3
  20999. case int32(_BT_LT):
  21000. goto _4
  21001. case int32(_BT_CR):
  21002. goto _5
  21003. case int32(_BT_LF):
  21004. goto _6
  21005. case int32(_BT_S):
  21006. goto _7
  21007. case int32(_BT_PERCNT):
  21008. goto _8
  21009. case int32(_BT_COMMA):
  21010. goto _9
  21011. case int32(_BT_LSQB):
  21012. goto _10
  21013. case int32(_BT_RSQB):
  21014. goto _11
  21015. case int32(_BT_LPAR):
  21016. goto _12
  21017. case int32(_BT_RPAR):
  21018. goto _13
  21019. case int32(_BT_VERBAR):
  21020. goto _14
  21021. case int32(_BT_GT):
  21022. goto _15
  21023. case int32(_BT_NUM):
  21024. goto _16
  21025. case int32(_BT_LEAD2):
  21026. goto _17
  21027. case int32(_BT_LEAD3):
  21028. goto _18
  21029. case int32(_BT_LEAD4):
  21030. goto _19
  21031. case int32(_BT_HEX):
  21032. goto _20
  21033. case int32(_BT_NMSTRT):
  21034. goto _21
  21035. case int32(_BT_COLON):
  21036. goto _22
  21037. case int32(_BT_MINUS):
  21038. goto _23
  21039. case int32(_BT_NAME):
  21040. goto _24
  21041. case int32(_BT_DIGIT):
  21042. goto _25
  21043. case int32(_BT_NONASCII):
  21044. goto _26
  21045. default:
  21046. goto _27
  21047. }
  21048. goto _28
  21049. _2:
  21050. ;
  21051. return _little2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  21052. _3:
  21053. ;
  21054. return _little2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  21055. _4:
  21056. ;
  21057. ptr += uintptr(2)
  21058. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21059. return -int32(1)
  21060. }
  21061. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21062. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21063. } else {
  21064. v29 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21065. }
  21066. switch v29 {
  21067. case int32(_BT_EXCL):
  21068. return _little2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21069. case int32(_BT_QUEST):
  21070. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21071. case int32(_BT_NMSTRT):
  21072. fallthrough
  21073. case int32(_BT_HEX):
  21074. fallthrough
  21075. case int32(_BT_NONASCII):
  21076. fallthrough
  21077. case int32(_BT_LEAD2):
  21078. fallthrough
  21079. case int32(_BT_LEAD3):
  21080. fallthrough
  21081. case int32(_BT_LEAD4):
  21082. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  21083. return int32(m_XML_TOK_INSTANCE_START)
  21084. }
  21085. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21086. return m_XML_TOK_INVALID
  21087. _5:
  21088. ;
  21089. if ptr+uintptr(2) == end {
  21090. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  21091. /* indicate that this might be part of a CR/LF pair */
  21092. return -int32(m_XML_TOK_PROLOG_S)
  21093. }
  21094. /* fall through */
  21095. _7:
  21096. ;
  21097. _6:
  21098. ;
  21099. _32:
  21100. ;
  21101. ptr += uintptr(2)
  21102. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21103. goto _30
  21104. }
  21105. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21106. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21107. } else {
  21108. v33 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21109. }
  21110. switch v33 {
  21111. case int32(_BT_S):
  21112. fallthrough
  21113. case int32(_BT_LF):
  21114. case int32(_BT_CR):
  21115. /* don't split CR/LF pair */
  21116. if ptr+uintptr(2) != end {
  21117. break
  21118. }
  21119. /* fall through */
  21120. fallthrough
  21121. default:
  21122. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21123. return int32(m_XML_TOK_PROLOG_S)
  21124. }
  21125. goto _31
  21126. _31:
  21127. ;
  21128. goto _32
  21129. goto _30
  21130. _30:
  21131. ;
  21132. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21133. return int32(m_XML_TOK_PROLOG_S)
  21134. _8:
  21135. ;
  21136. return _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21137. _9:
  21138. ;
  21139. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21140. return int32(m_XML_TOK_COMMA)
  21141. _10:
  21142. ;
  21143. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21144. return int32(m_XML_TOK_OPEN_BRACKET)
  21145. _11:
  21146. ;
  21147. ptr += uintptr(2)
  21148. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21149. return -int32(m_XML_TOK_CLOSE_BRACKET)
  21150. }
  21151. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  21152. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  21153. return -int32(1)
  21154. }
  21155. 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) {
  21156. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  21157. return int32(m_XML_TOK_COND_SECT_CLOSE)
  21158. }
  21159. }
  21160. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21161. return int32(m_XML_TOK_CLOSE_BRACKET)
  21162. _12:
  21163. ;
  21164. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21165. return int32(m_XML_TOK_OPEN_PAREN)
  21166. _13:
  21167. ;
  21168. ptr += uintptr(2)
  21169. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21170. return -int32(m_XML_TOK_CLOSE_PAREN)
  21171. }
  21172. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21173. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21174. } else {
  21175. v34 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21176. }
  21177. switch v34 {
  21178. case int32(_BT_AST):
  21179. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21180. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  21181. case int32(_BT_QUEST):
  21182. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21183. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  21184. case int32(_BT_PLUS):
  21185. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21186. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  21187. case int32(_BT_CR):
  21188. fallthrough
  21189. case int32(_BT_LF):
  21190. fallthrough
  21191. case int32(_BT_S):
  21192. fallthrough
  21193. case int32(_BT_GT):
  21194. fallthrough
  21195. case int32(_BT_COMMA):
  21196. fallthrough
  21197. case int32(_BT_VERBAR):
  21198. fallthrough
  21199. case int32(_BT_RPAR):
  21200. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21201. return int32(m_XML_TOK_CLOSE_PAREN)
  21202. }
  21203. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21204. return m_XML_TOK_INVALID
  21205. _14:
  21206. ;
  21207. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21208. return int32(m_XML_TOK_OR)
  21209. _15:
  21210. ;
  21211. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21212. return int32(m_XML_TOK_DECL_CLOSE)
  21213. _16:
  21214. ;
  21215. return _little2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21216. _17:
  21217. ;
  21218. if int64(end)-int64(ptr) < int64(2) {
  21219. return -int32(2)
  21220. }
  21221. if 0 != 0 {
  21222. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21223. return m_XML_TOK_INVALID
  21224. }
  21225. if 0 != 0 {
  21226. ptr += uintptr(2)
  21227. tok = int32(m_XML_TOK_NAME)
  21228. goto _28
  21229. }
  21230. if 0 != 0 {
  21231. ptr += uintptr(2)
  21232. tok = int32(m_XML_TOK_NMTOKEN)
  21233. goto _28
  21234. }
  21235. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21236. return m_XML_TOK_INVALID
  21237. _18:
  21238. ;
  21239. if int64(end)-int64(ptr) < int64(3) {
  21240. return -int32(2)
  21241. }
  21242. if 0 != 0 {
  21243. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21244. return m_XML_TOK_INVALID
  21245. }
  21246. if 0 != 0 {
  21247. ptr += uintptr(3)
  21248. tok = int32(m_XML_TOK_NAME)
  21249. goto _28
  21250. }
  21251. if 0 != 0 {
  21252. ptr += uintptr(3)
  21253. tok = int32(m_XML_TOK_NMTOKEN)
  21254. goto _28
  21255. }
  21256. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21257. return m_XML_TOK_INVALID
  21258. _19:
  21259. ;
  21260. if int64(end)-int64(ptr) < int64(4) {
  21261. return -int32(2)
  21262. }
  21263. if 0 != 0 {
  21264. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21265. return m_XML_TOK_INVALID
  21266. }
  21267. if 0 != 0 {
  21268. ptr += uintptr(4)
  21269. tok = int32(m_XML_TOK_NAME)
  21270. goto _28
  21271. }
  21272. if 0 != 0 {
  21273. ptr += uintptr(4)
  21274. tok = int32(m_XML_TOK_NMTOKEN)
  21275. goto _28
  21276. }
  21277. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21278. return m_XML_TOK_INVALID
  21279. _21:
  21280. ;
  21281. _20:
  21282. ;
  21283. tok = int32(m_XML_TOK_NAME)
  21284. ptr += uintptr(2)
  21285. goto _28
  21286. _25:
  21287. ;
  21288. _24:
  21289. ;
  21290. _23:
  21291. ;
  21292. _22:
  21293. ;
  21294. tok = int32(m_XML_TOK_NMTOKEN)
  21295. ptr += uintptr(2)
  21296. goto _28
  21297. _26:
  21298. ;
  21299. 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 {
  21300. ptr += uintptr(2)
  21301. tok = int32(m_XML_TOK_NAME)
  21302. goto _28
  21303. }
  21304. 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 {
  21305. ptr += uintptr(2)
  21306. tok = int32(m_XML_TOK_NMTOKEN)
  21307. goto _28
  21308. }
  21309. /* fall through */
  21310. _27:
  21311. ;
  21312. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21313. return m_XML_TOK_INVALID
  21314. _28:
  21315. ;
  21316. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21317. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21318. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21319. } else {
  21320. v35 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21321. }
  21322. switch v35 {
  21323. case int32(_BT_NONASCII):
  21324. 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) {
  21325. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21326. return m_XML_TOK_INVALID
  21327. } /* fall through */
  21328. fallthrough
  21329. case int32(_BT_NMSTRT):
  21330. fallthrough
  21331. case int32(_BT_HEX):
  21332. fallthrough
  21333. case int32(_BT_DIGIT):
  21334. fallthrough
  21335. case int32(_BT_NAME):
  21336. fallthrough
  21337. case int32(_BT_MINUS):
  21338. ptr += uintptr(2)
  21339. case int32(_BT_LEAD2):
  21340. if int64(end)-int64(ptr) < int64(2) {
  21341. return -int32(2)
  21342. }
  21343. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21344. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21345. return m_XML_TOK_INVALID
  21346. }
  21347. ptr += uintptr(2)
  21348. case int32(_BT_LEAD3):
  21349. if int64(end)-int64(ptr) < int64(3) {
  21350. return -int32(2)
  21351. }
  21352. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21353. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21354. return m_XML_TOK_INVALID
  21355. }
  21356. ptr += uintptr(3)
  21357. case int32(_BT_LEAD4):
  21358. if int64(end)-int64(ptr) < int64(4) {
  21359. return -int32(2)
  21360. }
  21361. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21362. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21363. return m_XML_TOK_INVALID
  21364. }
  21365. ptr += uintptr(4)
  21366. case int32(_BT_GT):
  21367. fallthrough
  21368. case int32(_BT_RPAR):
  21369. fallthrough
  21370. case int32(_BT_COMMA):
  21371. fallthrough
  21372. case int32(_BT_VERBAR):
  21373. fallthrough
  21374. case int32(_BT_LSQB):
  21375. fallthrough
  21376. case int32(_BT_PERCNT):
  21377. fallthrough
  21378. case int32(_BT_S):
  21379. fallthrough
  21380. case int32(_BT_CR):
  21381. fallthrough
  21382. case int32(_BT_LF):
  21383. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21384. return tok
  21385. case int32(_BT_COLON):
  21386. ptr += uintptr(2)
  21387. switch tok {
  21388. case int32(m_XML_TOK_NAME):
  21389. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21390. return -int32(1)
  21391. }
  21392. tok = int32(m_XML_TOK_PREFIXED_NAME)
  21393. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21394. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21395. } else {
  21396. v36 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21397. }
  21398. switch v36 {
  21399. case int32(_BT_NONASCII):
  21400. 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) {
  21401. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21402. return m_XML_TOK_INVALID
  21403. } /* fall through */
  21404. fallthrough
  21405. case int32(_BT_NMSTRT):
  21406. fallthrough
  21407. case int32(_BT_HEX):
  21408. fallthrough
  21409. case int32(_BT_DIGIT):
  21410. fallthrough
  21411. case int32(_BT_NAME):
  21412. fallthrough
  21413. case int32(_BT_MINUS):
  21414. ptr += uintptr(2)
  21415. case int32(_BT_LEAD2):
  21416. if int64(end)-int64(ptr) < int64(2) {
  21417. return -int32(2)
  21418. }
  21419. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21420. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21421. return m_XML_TOK_INVALID
  21422. }
  21423. ptr += uintptr(2)
  21424. case int32(_BT_LEAD3):
  21425. if int64(end)-int64(ptr) < int64(3) {
  21426. return -int32(2)
  21427. }
  21428. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21429. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21430. return m_XML_TOK_INVALID
  21431. }
  21432. ptr += uintptr(3)
  21433. case int32(_BT_LEAD4):
  21434. if int64(end)-int64(ptr) < int64(4) {
  21435. return -int32(2)
  21436. }
  21437. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21438. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21439. return m_XML_TOK_INVALID
  21440. }
  21441. ptr += uintptr(4)
  21442. default:
  21443. tok = int32(m_XML_TOK_NMTOKEN)
  21444. break
  21445. }
  21446. case int32(m_XML_TOK_PREFIXED_NAME):
  21447. tok = int32(m_XML_TOK_NMTOKEN)
  21448. break
  21449. }
  21450. case int32(_BT_PLUS):
  21451. if tok == int32(m_XML_TOK_NMTOKEN) {
  21452. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21453. return m_XML_TOK_INVALID
  21454. }
  21455. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21456. return int32(m_XML_TOK_NAME_PLUS)
  21457. case int32(_BT_AST):
  21458. if tok == int32(m_XML_TOK_NMTOKEN) {
  21459. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21460. return m_XML_TOK_INVALID
  21461. }
  21462. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21463. return int32(m_XML_TOK_NAME_ASTERISK)
  21464. case int32(_BT_QUEST):
  21465. if tok == int32(m_XML_TOK_NMTOKEN) {
  21466. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21467. return m_XML_TOK_INVALID
  21468. }
  21469. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21470. return int32(m_XML_TOK_NAME_QUESTION)
  21471. default:
  21472. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21473. return m_XML_TOK_INVALID
  21474. }
  21475. }
  21476. return -tok
  21477. }
  21478. func _little2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21479. var start uintptr
  21480. var v1, v2 int32
  21481. _, _, _ = start, v1, v2
  21482. if ptr >= end {
  21483. return -int32(4)
  21484. } else {
  21485. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21486. /* This line cannot be executed. The incoming data has already
  21487. * been tokenized once, so incomplete characters like this have
  21488. * already been eliminated from the input. Retaining the paranoia
  21489. * check is still valuable, however.
  21490. */
  21491. return -int32(1) /* LCOV_EXCL_LINE */
  21492. }
  21493. }
  21494. start = ptr
  21495. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21496. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21497. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21498. } else {
  21499. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21500. }
  21501. switch v1 {
  21502. case int32(_BT_LEAD2):
  21503. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  21504. case int32(_BT_LEAD3):
  21505. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  21506. case int32(_BT_LEAD4):
  21507. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  21508. case int32(_BT_AMP):
  21509. if ptr == start {
  21510. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21511. }
  21512. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21513. return int32(m_XML_TOK_DATA_CHARS)
  21514. case int32(_BT_LT):
  21515. /* this is for inside entity references */
  21516. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21517. return m_XML_TOK_INVALID
  21518. case int32(_BT_LF):
  21519. if ptr == start {
  21520. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21521. return int32(m_XML_TOK_DATA_NEWLINE)
  21522. }
  21523. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21524. return int32(m_XML_TOK_DATA_CHARS)
  21525. case int32(_BT_CR):
  21526. if ptr == start {
  21527. ptr += uintptr(2)
  21528. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21529. return -int32(3)
  21530. }
  21531. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21532. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21533. } else {
  21534. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21535. }
  21536. if v2 == int32(_BT_LF) {
  21537. ptr += uintptr(2)
  21538. }
  21539. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21540. return int32(m_XML_TOK_DATA_NEWLINE)
  21541. }
  21542. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21543. return int32(m_XML_TOK_DATA_CHARS)
  21544. case int32(_BT_S):
  21545. if ptr == start {
  21546. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21547. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  21548. }
  21549. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21550. return int32(m_XML_TOK_DATA_CHARS)
  21551. default:
  21552. ptr += uintptr(2)
  21553. break
  21554. }
  21555. }
  21556. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21557. return int32(m_XML_TOK_DATA_CHARS)
  21558. }
  21559. func _little2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21560. var start uintptr
  21561. var tok, v1, v2, v3 int32
  21562. _, _, _, _, _ = start, tok, v1, v2, v3
  21563. if ptr >= end {
  21564. return -int32(4)
  21565. } else {
  21566. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21567. /* This line cannot be executed. The incoming data has already
  21568. * been tokenized once, so incomplete characters like this have
  21569. * already been eliminated from the input. Retaining the paranoia
  21570. * check is still valuable, however.
  21571. */
  21572. return -int32(1) /* LCOV_EXCL_LINE */
  21573. }
  21574. }
  21575. start = ptr
  21576. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21577. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21578. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21579. } else {
  21580. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21581. }
  21582. switch v1 {
  21583. case int32(_BT_LEAD2):
  21584. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  21585. case int32(_BT_LEAD3):
  21586. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  21587. case int32(_BT_LEAD4):
  21588. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  21589. case int32(_BT_AMP):
  21590. if ptr == start {
  21591. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21592. }
  21593. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21594. return int32(m_XML_TOK_DATA_CHARS)
  21595. case int32(_BT_PERCNT):
  21596. if ptr == start {
  21597. tok = _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21598. if tok == int32(m_XML_TOK_PERCENT) {
  21599. v2 = m_XML_TOK_INVALID
  21600. } else {
  21601. v2 = tok
  21602. }
  21603. return v2
  21604. }
  21605. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21606. return int32(m_XML_TOK_DATA_CHARS)
  21607. case int32(_BT_LF):
  21608. if ptr == start {
  21609. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21610. return int32(m_XML_TOK_DATA_NEWLINE)
  21611. }
  21612. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21613. return int32(m_XML_TOK_DATA_CHARS)
  21614. case int32(_BT_CR):
  21615. if ptr == start {
  21616. ptr += uintptr(2)
  21617. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21618. return -int32(3)
  21619. }
  21620. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21621. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21622. } else {
  21623. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21624. }
  21625. if v3 == int32(_BT_LF) {
  21626. ptr += uintptr(2)
  21627. }
  21628. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21629. return int32(m_XML_TOK_DATA_NEWLINE)
  21630. }
  21631. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21632. return int32(m_XML_TOK_DATA_CHARS)
  21633. default:
  21634. ptr += uintptr(2)
  21635. break
  21636. }
  21637. }
  21638. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21639. return int32(m_XML_TOK_DATA_CHARS)
  21640. }
  21641. func _little2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21642. var level, v1 int32
  21643. var n Tsize_t
  21644. _, _, _ = level, n, v1
  21645. level = 0
  21646. if int32(2) > int32(1) {
  21647. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  21648. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  21649. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  21650. end = ptr + uintptr(n)
  21651. }
  21652. }
  21653. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21654. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21655. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21656. } else {
  21657. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21658. }
  21659. switch v1 {
  21660. case int32(_BT_LEAD2):
  21661. if int64(end)-int64(ptr) < int64(2) {
  21662. return -int32(2)
  21663. }
  21664. if 0 != 0 {
  21665. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21666. return m_XML_TOK_INVALID
  21667. }
  21668. ptr += uintptr(2)
  21669. case int32(_BT_LEAD3):
  21670. if int64(end)-int64(ptr) < int64(3) {
  21671. return -int32(2)
  21672. }
  21673. if 0 != 0 {
  21674. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21675. return m_XML_TOK_INVALID
  21676. }
  21677. ptr += uintptr(3)
  21678. case int32(_BT_LEAD4):
  21679. if int64(end)-int64(ptr) < int64(4) {
  21680. return -int32(2)
  21681. }
  21682. if 0 != 0 {
  21683. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21684. return m_XML_TOK_INVALID
  21685. }
  21686. ptr += uintptr(4)
  21687. case int32(_BT_NONXML):
  21688. fallthrough
  21689. case int32(_BT_MALFORM):
  21690. fallthrough
  21691. case int32(_BT_TRAIL):
  21692. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21693. return m_XML_TOK_INVALID
  21694. case int32(_BT_LT):
  21695. ptr += uintptr(2)
  21696. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21697. return -int32(1)
  21698. }
  21699. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL2) {
  21700. ptr += uintptr(2)
  21701. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21702. return -int32(1)
  21703. }
  21704. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  21705. level++
  21706. ptr += uintptr(2)
  21707. }
  21708. }
  21709. case int32(_BT_RSQB):
  21710. ptr += uintptr(2)
  21711. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21712. return -int32(1)
  21713. }
  21714. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  21715. ptr += uintptr(2)
  21716. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21717. return -int32(1)
  21718. }
  21719. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  21720. ptr += uintptr(2)
  21721. if level == 0 {
  21722. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21723. return int32(m_XML_TOK_IGNORE_SECT)
  21724. }
  21725. level--
  21726. }
  21727. }
  21728. default:
  21729. ptr += uintptr(2)
  21730. break
  21731. }
  21732. }
  21733. return -int32(1)
  21734. }
  21735. func _little2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  21736. var v2, v3, v4 int32
  21737. _, _, _ = v2, v3, v4
  21738. ptr += uintptr(2)
  21739. end -= uintptr(2)
  21740. for {
  21741. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21742. break
  21743. }
  21744. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21745. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21746. } else {
  21747. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21748. }
  21749. switch v2 {
  21750. case int32(_BT_DIGIT):
  21751. fallthrough
  21752. case int32(_BT_HEX):
  21753. fallthrough
  21754. case int32(_BT_MINUS):
  21755. fallthrough
  21756. case int32(_BT_APOS):
  21757. fallthrough
  21758. case int32(_BT_LPAR):
  21759. fallthrough
  21760. case int32(_BT_RPAR):
  21761. fallthrough
  21762. case int32(_BT_PLUS):
  21763. fallthrough
  21764. case int32(_BT_COMMA):
  21765. fallthrough
  21766. case int32(_BT_SOL):
  21767. fallthrough
  21768. case int32(_BT_EQUALS):
  21769. fallthrough
  21770. case int32(_BT_QUEST):
  21771. fallthrough
  21772. case int32(_BT_CR):
  21773. fallthrough
  21774. case int32(_BT_LF):
  21775. fallthrough
  21776. case int32(_BT_SEMI):
  21777. fallthrough
  21778. case int32(_BT_EXCL):
  21779. fallthrough
  21780. case int32(_BT_AST):
  21781. fallthrough
  21782. case int32(_BT_PERCNT):
  21783. fallthrough
  21784. case int32(_BT_NUM):
  21785. fallthrough
  21786. case int32(_BT_COLON):
  21787. case int32(_BT_S):
  21788. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  21789. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  21790. return 0
  21791. }
  21792. case int32(_BT_NAME):
  21793. fallthrough
  21794. case int32(_BT_NMSTRT):
  21795. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21796. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  21797. } else {
  21798. v3 = -int32(1)
  21799. }
  21800. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  21801. break
  21802. }
  21803. /* fall through */
  21804. fallthrough
  21805. default:
  21806. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21807. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  21808. } else {
  21809. v4 = -int32(1)
  21810. }
  21811. switch v4 {
  21812. case int32(0x24): /* $ */
  21813. fallthrough
  21814. case int32(0x40): /* @ */
  21815. default:
  21816. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  21817. return 0
  21818. }
  21819. break
  21820. }
  21821. goto _1
  21822. _1:
  21823. ;
  21824. ptr += uintptr(2)
  21825. }
  21826. return int32(1)
  21827. }
  21828. /* This must only be called for a well-formed start-tag or empty
  21829. element tag. Returns the number of attributes. Pointers to the
  21830. first attsMax attributes are stored in atts.
  21831. */
  21832. func _little2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  21833. var nAtts, open, state, v2, v3, v5, v7 int32
  21834. var v4, v6, v8, v9 bool
  21835. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  21836. state = 1
  21837. nAtts = 0
  21838. open = 0 /* defined when state == inValue;
  21839. initialization just to shut up compilers */
  21840. ptr += uintptr(2)
  21841. for {
  21842. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21843. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21844. } else {
  21845. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21846. }
  21847. switch v2 {
  21848. case int32(_BT_LEAD2):
  21849. if state == 0 {
  21850. if nAtts < attsMax {
  21851. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  21852. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  21853. }
  21854. state = 1
  21855. }
  21856. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  21857. case int32(_BT_LEAD3):
  21858. if state == 0 {
  21859. if nAtts < attsMax {
  21860. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  21861. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  21862. }
  21863. state = 1
  21864. }
  21865. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  21866. case int32(_BT_LEAD4):
  21867. if state == 0 {
  21868. if nAtts < attsMax {
  21869. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  21870. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  21871. }
  21872. state = 1
  21873. }
  21874. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  21875. case int32(_BT_NONASCII):
  21876. fallthrough
  21877. case int32(_BT_NMSTRT):
  21878. fallthrough
  21879. case int32(_BT_HEX):
  21880. if state == 0 {
  21881. if nAtts < attsMax {
  21882. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  21883. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  21884. }
  21885. state = 1
  21886. }
  21887. case int32(_BT_QUOT):
  21888. if state != 2 {
  21889. if nAtts < attsMax {
  21890. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  21891. }
  21892. state = 2
  21893. open = int32(_BT_QUOT)
  21894. } else {
  21895. if open == int32(_BT_QUOT) {
  21896. state = 0
  21897. if nAtts < attsMax {
  21898. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  21899. }
  21900. nAtts++
  21901. }
  21902. }
  21903. case int32(_BT_APOS):
  21904. if state != 2 {
  21905. if nAtts < attsMax {
  21906. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  21907. }
  21908. state = 2
  21909. open = int32(_BT_APOS)
  21910. } else {
  21911. if open == int32(_BT_APOS) {
  21912. state = 0
  21913. if nAtts < attsMax {
  21914. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  21915. }
  21916. nAtts++
  21917. }
  21918. }
  21919. case int32(_BT_AMP):
  21920. if nAtts < attsMax {
  21921. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  21922. }
  21923. case int32(_BT_S):
  21924. if state == 1 {
  21925. state = 0
  21926. } else {
  21927. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0; v9 {
  21928. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr; !v4 {
  21929. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21930. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  21931. } else {
  21932. v3 = -int32(1)
  21933. }
  21934. }
  21935. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  21936. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  21937. v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  21938. } else {
  21939. v5 = -int32(1)
  21940. }
  21941. }
  21942. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  21943. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  21944. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))))))
  21945. } else {
  21946. v7 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  21947. }
  21948. }
  21949. }
  21950. if v9 && (v8 || v7 == open) {
  21951. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  21952. }
  21953. }
  21954. case int32(_BT_CR):
  21955. fallthrough
  21956. case int32(_BT_LF):
  21957. /* This case ensures that the first attribute name is counted
  21958. Apart from that we could just change state on the quote. */
  21959. if state == 1 {
  21960. state = 0
  21961. } else {
  21962. if state == 2 && nAtts < attsMax {
  21963. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  21964. }
  21965. }
  21966. case int32(_BT_GT):
  21967. fallthrough
  21968. case int32(_BT_SOL):
  21969. if state != 2 {
  21970. return nAtts
  21971. }
  21972. default:
  21973. break
  21974. }
  21975. goto _1
  21976. _1:
  21977. ;
  21978. ptr += uintptr(2)
  21979. }
  21980. /* not reached */
  21981. return r
  21982. }
  21983. func _little2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  21984. var c, c1, result, v2, v4 int32
  21985. _, _, _, _, _ = c, c1, result, v2, v4
  21986. result = 0
  21987. /* skip &# */
  21988. _ = enc
  21989. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  21990. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  21991. ptr += uintptr(2)
  21992. for {
  21993. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  21994. break
  21995. }
  21996. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21997. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  21998. } else {
  21999. v2 = -int32(1)
  22000. }
  22001. c = v2
  22002. switch c {
  22003. case int32(m_ASCII_02):
  22004. fallthrough
  22005. case int32(m_ASCII_12):
  22006. fallthrough
  22007. case int32(m_ASCII_22):
  22008. fallthrough
  22009. case int32(m_ASCII_32):
  22010. fallthrough
  22011. case int32(m_ASCII_41):
  22012. fallthrough
  22013. case int32(m_ASCII_51):
  22014. fallthrough
  22015. case int32(m_ASCII_61):
  22016. fallthrough
  22017. case int32(m_ASCII_71):
  22018. fallthrough
  22019. case int32(m_ASCII_82):
  22020. fallthrough
  22021. case int32(m_ASCII_92):
  22022. result <<= int32(4)
  22023. result |= c - int32(m_ASCII_02)
  22024. case int32(m_ASCII_A):
  22025. fallthrough
  22026. case int32(m_ASCII_B1):
  22027. fallthrough
  22028. case int32(m_ASCII_C):
  22029. fallthrough
  22030. case int32(m_ASCII_D):
  22031. fallthrough
  22032. case int32(m_ASCII_E):
  22033. fallthrough
  22034. case int32(m_ASCII_F):
  22035. result <<= int32(4)
  22036. result += int32(10) + (c - int32(m_ASCII_A))
  22037. case int32(m_ASCII_a2):
  22038. fallthrough
  22039. case int32(m_ASCII_b1):
  22040. fallthrough
  22041. case int32(m_ASCII_c2):
  22042. fallthrough
  22043. case int32(m_ASCII_d1):
  22044. fallthrough
  22045. case int32(m_ASCII_e2):
  22046. fallthrough
  22047. case int32(m_ASCII_f1):
  22048. result <<= int32(4)
  22049. result += int32(10) + (c - int32(m_ASCII_a2))
  22050. break
  22051. }
  22052. if result >= int32(0x110000) {
  22053. return -int32(1)
  22054. }
  22055. goto _1
  22056. _1:
  22057. ;
  22058. ptr += uintptr(2)
  22059. }
  22060. } else {
  22061. for {
  22062. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  22063. break
  22064. }
  22065. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22066. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  22067. } else {
  22068. v4 = -int32(1)
  22069. }
  22070. c1 = v4
  22071. result *= int32(10)
  22072. result += c1 - int32(m_ASCII_02)
  22073. if result >= int32(0x110000) {
  22074. return -int32(1)
  22075. }
  22076. goto _3
  22077. _3:
  22078. ;
  22079. ptr += uintptr(2)
  22080. }
  22081. }
  22082. return _checkCharRefNumber(tls, result)
  22083. }
  22084. func _little2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  22085. var v1, v2 int32
  22086. _, _ = v1, v2
  22087. _ = enc
  22088. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(2) {
  22089. case int64(2):
  22090. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_t2) {
  22091. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22092. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  22093. } else {
  22094. v1 = -int32(1)
  22095. }
  22096. switch v1 {
  22097. case int32(m_ASCII_l2):
  22098. return int32(m_ASCII_LT1)
  22099. case int32(m_ASCII_g2):
  22100. return int32(m_ASCII_GT1)
  22101. }
  22102. }
  22103. case int64(3):
  22104. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a2) {
  22105. ptr += uintptr(2)
  22106. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m2) {
  22107. ptr += uintptr(2)
  22108. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  22109. return int32(m_ASCII_AMP1)
  22110. }
  22111. }
  22112. }
  22113. case int64(4):
  22114. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22115. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  22116. } else {
  22117. v2 = -int32(1)
  22118. }
  22119. switch v2 {
  22120. case int32(m_ASCII_q1):
  22121. ptr += uintptr(2)
  22122. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  22123. ptr += uintptr(2)
  22124. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  22125. ptr += uintptr(2)
  22126. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t2) {
  22127. return int32(m_ASCII_QUOT1)
  22128. }
  22129. }
  22130. }
  22131. case int32(m_ASCII_a2):
  22132. ptr += uintptr(2)
  22133. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  22134. ptr += uintptr(2)
  22135. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  22136. ptr += uintptr(2)
  22137. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s2) {
  22138. return int32(m_ASCII_APOS1)
  22139. }
  22140. }
  22141. }
  22142. break
  22143. }
  22144. }
  22145. return 0
  22146. }
  22147. func _little2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  22148. _ = enc
  22149. for {
  22150. if !(*(*uint8)(unsafe.Pointer(ptr2)) != 0) {
  22151. break
  22152. }
  22153. if int64(end1)-int64(ptr1) < int64(2) {
  22154. /* This line cannot be executed. The incoming data has already
  22155. * been tokenized once, so incomplete characters like this have
  22156. * already been eliminated from the input. Retaining the
  22157. * paranoia check is still valuable, however.
  22158. */
  22159. return 0 /* LCOV_EXCL_LINE */
  22160. }
  22161. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1 + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr2)))) {
  22162. return 0
  22163. }
  22164. goto _1
  22165. _1:
  22166. ;
  22167. ptr1 += uintptr(2)
  22168. ptr2++
  22169. }
  22170. return libc.BoolInt32(ptr1 == end1)
  22171. }
  22172. func _little2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  22173. var start uintptr
  22174. var v2 int32
  22175. _, _ = start, v2
  22176. start = ptr
  22177. for {
  22178. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22179. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  22180. } else {
  22181. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  22182. }
  22183. switch v2 {
  22184. case int32(_BT_LEAD2):
  22185. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  22186. case int32(_BT_LEAD3):
  22187. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  22188. case int32(_BT_LEAD4):
  22189. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  22190. case int32(_BT_NONASCII):
  22191. fallthrough
  22192. case int32(_BT_NMSTRT):
  22193. fallthrough
  22194. case int32(_BT_COLON):
  22195. fallthrough
  22196. case int32(_BT_HEX):
  22197. fallthrough
  22198. case int32(_BT_DIGIT):
  22199. fallthrough
  22200. case int32(_BT_NAME):
  22201. fallthrough
  22202. case int32(_BT_MINUS):
  22203. ptr += uintptr(2)
  22204. default:
  22205. return int32(int64(ptr) - int64(start))
  22206. }
  22207. goto _1
  22208. _1:
  22209. }
  22210. return r
  22211. }
  22212. func _little2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  22213. var v2 int32
  22214. _ = v2
  22215. for {
  22216. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22217. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  22218. } else {
  22219. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  22220. }
  22221. switch v2 {
  22222. case int32(_BT_LF):
  22223. fallthrough
  22224. case int32(_BT_CR):
  22225. fallthrough
  22226. case int32(_BT_S):
  22227. ptr += uintptr(2)
  22228. default:
  22229. return ptr
  22230. }
  22231. goto _1
  22232. _1:
  22233. }
  22234. return r
  22235. }
  22236. func _little2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  22237. var v1, v2 int32
  22238. var v3 bool
  22239. _, _, _ = v1, v2, v3
  22240. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22241. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22242. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  22243. } else {
  22244. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  22245. }
  22246. switch v1 {
  22247. case int32(_BT_LEAD2):
  22248. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  22249. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22250. case int32(_BT_LEAD3):
  22251. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  22252. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22253. case int32(_BT_LEAD4):
  22254. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  22255. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22256. case int32(_BT_LF):
  22257. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  22258. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  22259. ptr += uintptr(2)
  22260. case int32(_BT_CR):
  22261. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  22262. ptr += uintptr(2)
  22263. if v3 = int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)); v3 {
  22264. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22265. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  22266. } else {
  22267. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  22268. }
  22269. }
  22270. if v3 && v2 == int32(_BT_LF) {
  22271. ptr += uintptr(2)
  22272. }
  22273. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  22274. default:
  22275. ptr += uintptr(2)
  22276. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22277. break
  22278. }
  22279. }
  22280. }
  22281. var _little2_encoding_ns = Tnormal_encoding{
  22282. Fenc: TENCODING{
  22283. Fscanners: [4]TSCANNER{},
  22284. FliteralScanners: [2]TSCANNER{},
  22285. FminBytesPerChar: int32(2),
  22286. FisUtf16: uint8(1),
  22287. },
  22288. Ftype1: [256]uint8{
  22289. 9: uint8(_BT_S),
  22290. 10: uint8(_BT_LF),
  22291. 13: uint8(_BT_CR),
  22292. 32: uint8(_BT_S),
  22293. 33: uint8(_BT_EXCL),
  22294. 34: uint8(_BT_QUOT),
  22295. 35: uint8(_BT_NUM),
  22296. 36: uint8(_BT_OTHER),
  22297. 37: uint8(_BT_PERCNT),
  22298. 38: uint8(_BT_AMP),
  22299. 39: uint8(_BT_APOS),
  22300. 40: uint8(_BT_LPAR),
  22301. 41: uint8(_BT_RPAR),
  22302. 42: uint8(_BT_AST),
  22303. 43: uint8(_BT_PLUS),
  22304. 44: uint8(_BT_COMMA),
  22305. 45: uint8(_BT_MINUS),
  22306. 46: uint8(_BT_NAME),
  22307. 47: uint8(_BT_SOL),
  22308. 48: uint8(_BT_DIGIT),
  22309. 49: uint8(_BT_DIGIT),
  22310. 50: uint8(_BT_DIGIT),
  22311. 51: uint8(_BT_DIGIT),
  22312. 52: uint8(_BT_DIGIT),
  22313. 53: uint8(_BT_DIGIT),
  22314. 54: uint8(_BT_DIGIT),
  22315. 55: uint8(_BT_DIGIT),
  22316. 56: uint8(_BT_DIGIT),
  22317. 57: uint8(_BT_DIGIT),
  22318. 58: uint8(_BT_COLON),
  22319. 59: uint8(_BT_SEMI),
  22320. 60: uint8(_BT_LT),
  22321. 61: uint8(_BT_EQUALS),
  22322. 62: uint8(_BT_GT),
  22323. 63: uint8(_BT_QUEST),
  22324. 64: uint8(_BT_OTHER),
  22325. 65: uint8(_BT_HEX),
  22326. 66: uint8(_BT_HEX),
  22327. 67: uint8(_BT_HEX),
  22328. 68: uint8(_BT_HEX),
  22329. 69: uint8(_BT_HEX),
  22330. 70: uint8(_BT_HEX),
  22331. 71: uint8(_BT_NMSTRT),
  22332. 72: uint8(_BT_NMSTRT),
  22333. 73: uint8(_BT_NMSTRT),
  22334. 74: uint8(_BT_NMSTRT),
  22335. 75: uint8(_BT_NMSTRT),
  22336. 76: uint8(_BT_NMSTRT),
  22337. 77: uint8(_BT_NMSTRT),
  22338. 78: uint8(_BT_NMSTRT),
  22339. 79: uint8(_BT_NMSTRT),
  22340. 80: uint8(_BT_NMSTRT),
  22341. 81: uint8(_BT_NMSTRT),
  22342. 82: uint8(_BT_NMSTRT),
  22343. 83: uint8(_BT_NMSTRT),
  22344. 84: uint8(_BT_NMSTRT),
  22345. 85: uint8(_BT_NMSTRT),
  22346. 86: uint8(_BT_NMSTRT),
  22347. 87: uint8(_BT_NMSTRT),
  22348. 88: uint8(_BT_NMSTRT),
  22349. 89: uint8(_BT_NMSTRT),
  22350. 90: uint8(_BT_NMSTRT),
  22351. 91: uint8(_BT_LSQB),
  22352. 92: uint8(_BT_OTHER),
  22353. 93: uint8(_BT_RSQB),
  22354. 94: uint8(_BT_OTHER),
  22355. 95: uint8(_BT_NMSTRT),
  22356. 96: uint8(_BT_OTHER),
  22357. 97: uint8(_BT_HEX),
  22358. 98: uint8(_BT_HEX),
  22359. 99: uint8(_BT_HEX),
  22360. 100: uint8(_BT_HEX),
  22361. 101: uint8(_BT_HEX),
  22362. 102: uint8(_BT_HEX),
  22363. 103: uint8(_BT_NMSTRT),
  22364. 104: uint8(_BT_NMSTRT),
  22365. 105: uint8(_BT_NMSTRT),
  22366. 106: uint8(_BT_NMSTRT),
  22367. 107: uint8(_BT_NMSTRT),
  22368. 108: uint8(_BT_NMSTRT),
  22369. 109: uint8(_BT_NMSTRT),
  22370. 110: uint8(_BT_NMSTRT),
  22371. 111: uint8(_BT_NMSTRT),
  22372. 112: uint8(_BT_NMSTRT),
  22373. 113: uint8(_BT_NMSTRT),
  22374. 114: uint8(_BT_NMSTRT),
  22375. 115: uint8(_BT_NMSTRT),
  22376. 116: uint8(_BT_NMSTRT),
  22377. 117: uint8(_BT_NMSTRT),
  22378. 118: uint8(_BT_NMSTRT),
  22379. 119: uint8(_BT_NMSTRT),
  22380. 120: uint8(_BT_NMSTRT),
  22381. 121: uint8(_BT_NMSTRT),
  22382. 122: uint8(_BT_NMSTRT),
  22383. 123: uint8(_BT_OTHER),
  22384. 124: uint8(_BT_VERBAR),
  22385. 125: uint8(_BT_OTHER),
  22386. 126: uint8(_BT_OTHER),
  22387. 127: uint8(_BT_OTHER),
  22388. 128: uint8(_BT_OTHER),
  22389. 129: uint8(_BT_OTHER),
  22390. 130: uint8(_BT_OTHER),
  22391. 131: uint8(_BT_OTHER),
  22392. 132: uint8(_BT_OTHER),
  22393. 133: uint8(_BT_OTHER),
  22394. 134: uint8(_BT_OTHER),
  22395. 135: uint8(_BT_OTHER),
  22396. 136: uint8(_BT_OTHER),
  22397. 137: uint8(_BT_OTHER),
  22398. 138: uint8(_BT_OTHER),
  22399. 139: uint8(_BT_OTHER),
  22400. 140: uint8(_BT_OTHER),
  22401. 141: uint8(_BT_OTHER),
  22402. 142: uint8(_BT_OTHER),
  22403. 143: uint8(_BT_OTHER),
  22404. 144: uint8(_BT_OTHER),
  22405. 145: uint8(_BT_OTHER),
  22406. 146: uint8(_BT_OTHER),
  22407. 147: uint8(_BT_OTHER),
  22408. 148: uint8(_BT_OTHER),
  22409. 149: uint8(_BT_OTHER),
  22410. 150: uint8(_BT_OTHER),
  22411. 151: uint8(_BT_OTHER),
  22412. 152: uint8(_BT_OTHER),
  22413. 153: uint8(_BT_OTHER),
  22414. 154: uint8(_BT_OTHER),
  22415. 155: uint8(_BT_OTHER),
  22416. 156: uint8(_BT_OTHER),
  22417. 157: uint8(_BT_OTHER),
  22418. 158: uint8(_BT_OTHER),
  22419. 159: uint8(_BT_OTHER),
  22420. 160: uint8(_BT_OTHER),
  22421. 161: uint8(_BT_OTHER),
  22422. 162: uint8(_BT_OTHER),
  22423. 163: uint8(_BT_OTHER),
  22424. 164: uint8(_BT_OTHER),
  22425. 165: uint8(_BT_OTHER),
  22426. 166: uint8(_BT_OTHER),
  22427. 167: uint8(_BT_OTHER),
  22428. 168: uint8(_BT_OTHER),
  22429. 169: uint8(_BT_OTHER),
  22430. 170: uint8(_BT_NMSTRT),
  22431. 171: uint8(_BT_OTHER),
  22432. 172: uint8(_BT_OTHER),
  22433. 173: uint8(_BT_OTHER),
  22434. 174: uint8(_BT_OTHER),
  22435. 175: uint8(_BT_OTHER),
  22436. 176: uint8(_BT_OTHER),
  22437. 177: uint8(_BT_OTHER),
  22438. 178: uint8(_BT_OTHER),
  22439. 179: uint8(_BT_OTHER),
  22440. 180: uint8(_BT_OTHER),
  22441. 181: uint8(_BT_NMSTRT),
  22442. 182: uint8(_BT_OTHER),
  22443. 183: uint8(_BT_NAME),
  22444. 184: uint8(_BT_OTHER),
  22445. 185: uint8(_BT_OTHER),
  22446. 186: uint8(_BT_NMSTRT),
  22447. 187: uint8(_BT_OTHER),
  22448. 188: uint8(_BT_OTHER),
  22449. 189: uint8(_BT_OTHER),
  22450. 190: uint8(_BT_OTHER),
  22451. 191: uint8(_BT_OTHER),
  22452. 192: uint8(_BT_NMSTRT),
  22453. 193: uint8(_BT_NMSTRT),
  22454. 194: uint8(_BT_NMSTRT),
  22455. 195: uint8(_BT_NMSTRT),
  22456. 196: uint8(_BT_NMSTRT),
  22457. 197: uint8(_BT_NMSTRT),
  22458. 198: uint8(_BT_NMSTRT),
  22459. 199: uint8(_BT_NMSTRT),
  22460. 200: uint8(_BT_NMSTRT),
  22461. 201: uint8(_BT_NMSTRT),
  22462. 202: uint8(_BT_NMSTRT),
  22463. 203: uint8(_BT_NMSTRT),
  22464. 204: uint8(_BT_NMSTRT),
  22465. 205: uint8(_BT_NMSTRT),
  22466. 206: uint8(_BT_NMSTRT),
  22467. 207: uint8(_BT_NMSTRT),
  22468. 208: uint8(_BT_NMSTRT),
  22469. 209: uint8(_BT_NMSTRT),
  22470. 210: uint8(_BT_NMSTRT),
  22471. 211: uint8(_BT_NMSTRT),
  22472. 212: uint8(_BT_NMSTRT),
  22473. 213: uint8(_BT_NMSTRT),
  22474. 214: uint8(_BT_NMSTRT),
  22475. 215: uint8(_BT_OTHER),
  22476. 216: uint8(_BT_NMSTRT),
  22477. 217: uint8(_BT_NMSTRT),
  22478. 218: uint8(_BT_NMSTRT),
  22479. 219: uint8(_BT_NMSTRT),
  22480. 220: uint8(_BT_NMSTRT),
  22481. 221: uint8(_BT_NMSTRT),
  22482. 222: uint8(_BT_NMSTRT),
  22483. 223: uint8(_BT_NMSTRT),
  22484. 224: uint8(_BT_NMSTRT),
  22485. 225: uint8(_BT_NMSTRT),
  22486. 226: uint8(_BT_NMSTRT),
  22487. 227: uint8(_BT_NMSTRT),
  22488. 228: uint8(_BT_NMSTRT),
  22489. 229: uint8(_BT_NMSTRT),
  22490. 230: uint8(_BT_NMSTRT),
  22491. 231: uint8(_BT_NMSTRT),
  22492. 232: uint8(_BT_NMSTRT),
  22493. 233: uint8(_BT_NMSTRT),
  22494. 234: uint8(_BT_NMSTRT),
  22495. 235: uint8(_BT_NMSTRT),
  22496. 236: uint8(_BT_NMSTRT),
  22497. 237: uint8(_BT_NMSTRT),
  22498. 238: uint8(_BT_NMSTRT),
  22499. 239: uint8(_BT_NMSTRT),
  22500. 240: uint8(_BT_NMSTRT),
  22501. 241: uint8(_BT_NMSTRT),
  22502. 242: uint8(_BT_NMSTRT),
  22503. 243: uint8(_BT_NMSTRT),
  22504. 244: uint8(_BT_NMSTRT),
  22505. 245: uint8(_BT_NMSTRT),
  22506. 246: uint8(_BT_NMSTRT),
  22507. 247: uint8(_BT_OTHER),
  22508. 248: uint8(_BT_NMSTRT),
  22509. 249: uint8(_BT_NMSTRT),
  22510. 250: uint8(_BT_NMSTRT),
  22511. 251: uint8(_BT_NMSTRT),
  22512. 252: uint8(_BT_NMSTRT),
  22513. 253: uint8(_BT_NMSTRT),
  22514. 254: uint8(_BT_NMSTRT),
  22515. 255: uint8(_BT_NMSTRT),
  22516. },
  22517. }
  22518. func init() {
  22519. p := unsafe.Pointer(&_little2_encoding_ns)
  22520. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  22521. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  22522. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  22523. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  22524. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  22525. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  22526. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  22527. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  22528. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  22529. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  22530. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  22531. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  22532. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  22533. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  22534. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  22535. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  22536. }
  22537. var _little2_encoding = Tnormal_encoding{
  22538. Fenc: TENCODING{
  22539. Fscanners: [4]TSCANNER{},
  22540. FliteralScanners: [2]TSCANNER{},
  22541. FminBytesPerChar: int32(2),
  22542. FisUtf16: uint8(1),
  22543. },
  22544. Ftype1: [256]uint8{
  22545. 9: uint8(_BT_S),
  22546. 10: uint8(_BT_LF),
  22547. 13: uint8(_BT_CR),
  22548. 32: uint8(_BT_S),
  22549. 33: uint8(_BT_EXCL),
  22550. 34: uint8(_BT_QUOT),
  22551. 35: uint8(_BT_NUM),
  22552. 36: uint8(_BT_OTHER),
  22553. 37: uint8(_BT_PERCNT),
  22554. 38: uint8(_BT_AMP),
  22555. 39: uint8(_BT_APOS),
  22556. 40: uint8(_BT_LPAR),
  22557. 41: uint8(_BT_RPAR),
  22558. 42: uint8(_BT_AST),
  22559. 43: uint8(_BT_PLUS),
  22560. 44: uint8(_BT_COMMA),
  22561. 45: uint8(_BT_MINUS),
  22562. 46: uint8(_BT_NAME),
  22563. 47: uint8(_BT_SOL),
  22564. 48: uint8(_BT_DIGIT),
  22565. 49: uint8(_BT_DIGIT),
  22566. 50: uint8(_BT_DIGIT),
  22567. 51: uint8(_BT_DIGIT),
  22568. 52: uint8(_BT_DIGIT),
  22569. 53: uint8(_BT_DIGIT),
  22570. 54: uint8(_BT_DIGIT),
  22571. 55: uint8(_BT_DIGIT),
  22572. 56: uint8(_BT_DIGIT),
  22573. 57: uint8(_BT_DIGIT),
  22574. 58: uint8(_BT_NMSTRT),
  22575. 59: uint8(_BT_SEMI),
  22576. 60: uint8(_BT_LT),
  22577. 61: uint8(_BT_EQUALS),
  22578. 62: uint8(_BT_GT),
  22579. 63: uint8(_BT_QUEST),
  22580. 64: uint8(_BT_OTHER),
  22581. 65: uint8(_BT_HEX),
  22582. 66: uint8(_BT_HEX),
  22583. 67: uint8(_BT_HEX),
  22584. 68: uint8(_BT_HEX),
  22585. 69: uint8(_BT_HEX),
  22586. 70: uint8(_BT_HEX),
  22587. 71: uint8(_BT_NMSTRT),
  22588. 72: uint8(_BT_NMSTRT),
  22589. 73: uint8(_BT_NMSTRT),
  22590. 74: uint8(_BT_NMSTRT),
  22591. 75: uint8(_BT_NMSTRT),
  22592. 76: uint8(_BT_NMSTRT),
  22593. 77: uint8(_BT_NMSTRT),
  22594. 78: uint8(_BT_NMSTRT),
  22595. 79: uint8(_BT_NMSTRT),
  22596. 80: uint8(_BT_NMSTRT),
  22597. 81: uint8(_BT_NMSTRT),
  22598. 82: uint8(_BT_NMSTRT),
  22599. 83: uint8(_BT_NMSTRT),
  22600. 84: uint8(_BT_NMSTRT),
  22601. 85: uint8(_BT_NMSTRT),
  22602. 86: uint8(_BT_NMSTRT),
  22603. 87: uint8(_BT_NMSTRT),
  22604. 88: uint8(_BT_NMSTRT),
  22605. 89: uint8(_BT_NMSTRT),
  22606. 90: uint8(_BT_NMSTRT),
  22607. 91: uint8(_BT_LSQB),
  22608. 92: uint8(_BT_OTHER),
  22609. 93: uint8(_BT_RSQB),
  22610. 94: uint8(_BT_OTHER),
  22611. 95: uint8(_BT_NMSTRT),
  22612. 96: uint8(_BT_OTHER),
  22613. 97: uint8(_BT_HEX),
  22614. 98: uint8(_BT_HEX),
  22615. 99: uint8(_BT_HEX),
  22616. 100: uint8(_BT_HEX),
  22617. 101: uint8(_BT_HEX),
  22618. 102: uint8(_BT_HEX),
  22619. 103: uint8(_BT_NMSTRT),
  22620. 104: uint8(_BT_NMSTRT),
  22621. 105: uint8(_BT_NMSTRT),
  22622. 106: uint8(_BT_NMSTRT),
  22623. 107: uint8(_BT_NMSTRT),
  22624. 108: uint8(_BT_NMSTRT),
  22625. 109: uint8(_BT_NMSTRT),
  22626. 110: uint8(_BT_NMSTRT),
  22627. 111: uint8(_BT_NMSTRT),
  22628. 112: uint8(_BT_NMSTRT),
  22629. 113: uint8(_BT_NMSTRT),
  22630. 114: uint8(_BT_NMSTRT),
  22631. 115: uint8(_BT_NMSTRT),
  22632. 116: uint8(_BT_NMSTRT),
  22633. 117: uint8(_BT_NMSTRT),
  22634. 118: uint8(_BT_NMSTRT),
  22635. 119: uint8(_BT_NMSTRT),
  22636. 120: uint8(_BT_NMSTRT),
  22637. 121: uint8(_BT_NMSTRT),
  22638. 122: uint8(_BT_NMSTRT),
  22639. 123: uint8(_BT_OTHER),
  22640. 124: uint8(_BT_VERBAR),
  22641. 125: uint8(_BT_OTHER),
  22642. 126: uint8(_BT_OTHER),
  22643. 127: uint8(_BT_OTHER),
  22644. 128: uint8(_BT_OTHER),
  22645. 129: uint8(_BT_OTHER),
  22646. 130: uint8(_BT_OTHER),
  22647. 131: uint8(_BT_OTHER),
  22648. 132: uint8(_BT_OTHER),
  22649. 133: uint8(_BT_OTHER),
  22650. 134: uint8(_BT_OTHER),
  22651. 135: uint8(_BT_OTHER),
  22652. 136: uint8(_BT_OTHER),
  22653. 137: uint8(_BT_OTHER),
  22654. 138: uint8(_BT_OTHER),
  22655. 139: uint8(_BT_OTHER),
  22656. 140: uint8(_BT_OTHER),
  22657. 141: uint8(_BT_OTHER),
  22658. 142: uint8(_BT_OTHER),
  22659. 143: uint8(_BT_OTHER),
  22660. 144: uint8(_BT_OTHER),
  22661. 145: uint8(_BT_OTHER),
  22662. 146: uint8(_BT_OTHER),
  22663. 147: uint8(_BT_OTHER),
  22664. 148: uint8(_BT_OTHER),
  22665. 149: uint8(_BT_OTHER),
  22666. 150: uint8(_BT_OTHER),
  22667. 151: uint8(_BT_OTHER),
  22668. 152: uint8(_BT_OTHER),
  22669. 153: uint8(_BT_OTHER),
  22670. 154: uint8(_BT_OTHER),
  22671. 155: uint8(_BT_OTHER),
  22672. 156: uint8(_BT_OTHER),
  22673. 157: uint8(_BT_OTHER),
  22674. 158: uint8(_BT_OTHER),
  22675. 159: uint8(_BT_OTHER),
  22676. 160: uint8(_BT_OTHER),
  22677. 161: uint8(_BT_OTHER),
  22678. 162: uint8(_BT_OTHER),
  22679. 163: uint8(_BT_OTHER),
  22680. 164: uint8(_BT_OTHER),
  22681. 165: uint8(_BT_OTHER),
  22682. 166: uint8(_BT_OTHER),
  22683. 167: uint8(_BT_OTHER),
  22684. 168: uint8(_BT_OTHER),
  22685. 169: uint8(_BT_OTHER),
  22686. 170: uint8(_BT_NMSTRT),
  22687. 171: uint8(_BT_OTHER),
  22688. 172: uint8(_BT_OTHER),
  22689. 173: uint8(_BT_OTHER),
  22690. 174: uint8(_BT_OTHER),
  22691. 175: uint8(_BT_OTHER),
  22692. 176: uint8(_BT_OTHER),
  22693. 177: uint8(_BT_OTHER),
  22694. 178: uint8(_BT_OTHER),
  22695. 179: uint8(_BT_OTHER),
  22696. 180: uint8(_BT_OTHER),
  22697. 181: uint8(_BT_NMSTRT),
  22698. 182: uint8(_BT_OTHER),
  22699. 183: uint8(_BT_NAME),
  22700. 184: uint8(_BT_OTHER),
  22701. 185: uint8(_BT_OTHER),
  22702. 186: uint8(_BT_NMSTRT),
  22703. 187: uint8(_BT_OTHER),
  22704. 188: uint8(_BT_OTHER),
  22705. 189: uint8(_BT_OTHER),
  22706. 190: uint8(_BT_OTHER),
  22707. 191: uint8(_BT_OTHER),
  22708. 192: uint8(_BT_NMSTRT),
  22709. 193: uint8(_BT_NMSTRT),
  22710. 194: uint8(_BT_NMSTRT),
  22711. 195: uint8(_BT_NMSTRT),
  22712. 196: uint8(_BT_NMSTRT),
  22713. 197: uint8(_BT_NMSTRT),
  22714. 198: uint8(_BT_NMSTRT),
  22715. 199: uint8(_BT_NMSTRT),
  22716. 200: uint8(_BT_NMSTRT),
  22717. 201: uint8(_BT_NMSTRT),
  22718. 202: uint8(_BT_NMSTRT),
  22719. 203: uint8(_BT_NMSTRT),
  22720. 204: uint8(_BT_NMSTRT),
  22721. 205: uint8(_BT_NMSTRT),
  22722. 206: uint8(_BT_NMSTRT),
  22723. 207: uint8(_BT_NMSTRT),
  22724. 208: uint8(_BT_NMSTRT),
  22725. 209: uint8(_BT_NMSTRT),
  22726. 210: uint8(_BT_NMSTRT),
  22727. 211: uint8(_BT_NMSTRT),
  22728. 212: uint8(_BT_NMSTRT),
  22729. 213: uint8(_BT_NMSTRT),
  22730. 214: uint8(_BT_NMSTRT),
  22731. 215: uint8(_BT_OTHER),
  22732. 216: uint8(_BT_NMSTRT),
  22733. 217: uint8(_BT_NMSTRT),
  22734. 218: uint8(_BT_NMSTRT),
  22735. 219: uint8(_BT_NMSTRT),
  22736. 220: uint8(_BT_NMSTRT),
  22737. 221: uint8(_BT_NMSTRT),
  22738. 222: uint8(_BT_NMSTRT),
  22739. 223: uint8(_BT_NMSTRT),
  22740. 224: uint8(_BT_NMSTRT),
  22741. 225: uint8(_BT_NMSTRT),
  22742. 226: uint8(_BT_NMSTRT),
  22743. 227: uint8(_BT_NMSTRT),
  22744. 228: uint8(_BT_NMSTRT),
  22745. 229: uint8(_BT_NMSTRT),
  22746. 230: uint8(_BT_NMSTRT),
  22747. 231: uint8(_BT_NMSTRT),
  22748. 232: uint8(_BT_NMSTRT),
  22749. 233: uint8(_BT_NMSTRT),
  22750. 234: uint8(_BT_NMSTRT),
  22751. 235: uint8(_BT_NMSTRT),
  22752. 236: uint8(_BT_NMSTRT),
  22753. 237: uint8(_BT_NMSTRT),
  22754. 238: uint8(_BT_NMSTRT),
  22755. 239: uint8(_BT_NMSTRT),
  22756. 240: uint8(_BT_NMSTRT),
  22757. 241: uint8(_BT_NMSTRT),
  22758. 242: uint8(_BT_NMSTRT),
  22759. 243: uint8(_BT_NMSTRT),
  22760. 244: uint8(_BT_NMSTRT),
  22761. 245: uint8(_BT_NMSTRT),
  22762. 246: uint8(_BT_NMSTRT),
  22763. 247: uint8(_BT_OTHER),
  22764. 248: uint8(_BT_NMSTRT),
  22765. 249: uint8(_BT_NMSTRT),
  22766. 250: uint8(_BT_NMSTRT),
  22767. 251: uint8(_BT_NMSTRT),
  22768. 252: uint8(_BT_NMSTRT),
  22769. 253: uint8(_BT_NMSTRT),
  22770. 254: uint8(_BT_NMSTRT),
  22771. 255: uint8(_BT_NMSTRT),
  22772. },
  22773. }
  22774. func init() {
  22775. p := unsafe.Pointer(&_little2_encoding)
  22776. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  22777. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  22778. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  22779. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  22780. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  22781. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  22782. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  22783. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  22784. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  22785. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  22786. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  22787. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  22788. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  22789. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  22790. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  22791. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  22792. }
  22793. var _internal_little2_encoding_ns = Tnormal_encoding{
  22794. Fenc: TENCODING{
  22795. Fscanners: [4]TSCANNER{},
  22796. FliteralScanners: [2]TSCANNER{},
  22797. FminBytesPerChar: int32(2),
  22798. FisUtf16: uint8(1),
  22799. },
  22800. Ftype1: [256]uint8{
  22801. 9: uint8(_BT_S),
  22802. 10: uint8(_BT_LF),
  22803. 13: uint8(_BT_S),
  22804. 32: uint8(_BT_S),
  22805. 33: uint8(_BT_EXCL),
  22806. 34: uint8(_BT_QUOT),
  22807. 35: uint8(_BT_NUM),
  22808. 36: uint8(_BT_OTHER),
  22809. 37: uint8(_BT_PERCNT),
  22810. 38: uint8(_BT_AMP),
  22811. 39: uint8(_BT_APOS),
  22812. 40: uint8(_BT_LPAR),
  22813. 41: uint8(_BT_RPAR),
  22814. 42: uint8(_BT_AST),
  22815. 43: uint8(_BT_PLUS),
  22816. 44: uint8(_BT_COMMA),
  22817. 45: uint8(_BT_MINUS),
  22818. 46: uint8(_BT_NAME),
  22819. 47: uint8(_BT_SOL),
  22820. 48: uint8(_BT_DIGIT),
  22821. 49: uint8(_BT_DIGIT),
  22822. 50: uint8(_BT_DIGIT),
  22823. 51: uint8(_BT_DIGIT),
  22824. 52: uint8(_BT_DIGIT),
  22825. 53: uint8(_BT_DIGIT),
  22826. 54: uint8(_BT_DIGIT),
  22827. 55: uint8(_BT_DIGIT),
  22828. 56: uint8(_BT_DIGIT),
  22829. 57: uint8(_BT_DIGIT),
  22830. 58: uint8(_BT_COLON),
  22831. 59: uint8(_BT_SEMI),
  22832. 60: uint8(_BT_LT),
  22833. 61: uint8(_BT_EQUALS),
  22834. 62: uint8(_BT_GT),
  22835. 63: uint8(_BT_QUEST),
  22836. 64: uint8(_BT_OTHER),
  22837. 65: uint8(_BT_HEX),
  22838. 66: uint8(_BT_HEX),
  22839. 67: uint8(_BT_HEX),
  22840. 68: uint8(_BT_HEX),
  22841. 69: uint8(_BT_HEX),
  22842. 70: uint8(_BT_HEX),
  22843. 71: uint8(_BT_NMSTRT),
  22844. 72: uint8(_BT_NMSTRT),
  22845. 73: uint8(_BT_NMSTRT),
  22846. 74: uint8(_BT_NMSTRT),
  22847. 75: uint8(_BT_NMSTRT),
  22848. 76: uint8(_BT_NMSTRT),
  22849. 77: uint8(_BT_NMSTRT),
  22850. 78: uint8(_BT_NMSTRT),
  22851. 79: uint8(_BT_NMSTRT),
  22852. 80: uint8(_BT_NMSTRT),
  22853. 81: uint8(_BT_NMSTRT),
  22854. 82: uint8(_BT_NMSTRT),
  22855. 83: uint8(_BT_NMSTRT),
  22856. 84: uint8(_BT_NMSTRT),
  22857. 85: uint8(_BT_NMSTRT),
  22858. 86: uint8(_BT_NMSTRT),
  22859. 87: uint8(_BT_NMSTRT),
  22860. 88: uint8(_BT_NMSTRT),
  22861. 89: uint8(_BT_NMSTRT),
  22862. 90: uint8(_BT_NMSTRT),
  22863. 91: uint8(_BT_LSQB),
  22864. 92: uint8(_BT_OTHER),
  22865. 93: uint8(_BT_RSQB),
  22866. 94: uint8(_BT_OTHER),
  22867. 95: uint8(_BT_NMSTRT),
  22868. 96: uint8(_BT_OTHER),
  22869. 97: uint8(_BT_HEX),
  22870. 98: uint8(_BT_HEX),
  22871. 99: uint8(_BT_HEX),
  22872. 100: uint8(_BT_HEX),
  22873. 101: uint8(_BT_HEX),
  22874. 102: uint8(_BT_HEX),
  22875. 103: uint8(_BT_NMSTRT),
  22876. 104: uint8(_BT_NMSTRT),
  22877. 105: uint8(_BT_NMSTRT),
  22878. 106: uint8(_BT_NMSTRT),
  22879. 107: uint8(_BT_NMSTRT),
  22880. 108: uint8(_BT_NMSTRT),
  22881. 109: uint8(_BT_NMSTRT),
  22882. 110: uint8(_BT_NMSTRT),
  22883. 111: uint8(_BT_NMSTRT),
  22884. 112: uint8(_BT_NMSTRT),
  22885. 113: uint8(_BT_NMSTRT),
  22886. 114: uint8(_BT_NMSTRT),
  22887. 115: uint8(_BT_NMSTRT),
  22888. 116: uint8(_BT_NMSTRT),
  22889. 117: uint8(_BT_NMSTRT),
  22890. 118: uint8(_BT_NMSTRT),
  22891. 119: uint8(_BT_NMSTRT),
  22892. 120: uint8(_BT_NMSTRT),
  22893. 121: uint8(_BT_NMSTRT),
  22894. 122: uint8(_BT_NMSTRT),
  22895. 123: uint8(_BT_OTHER),
  22896. 124: uint8(_BT_VERBAR),
  22897. 125: uint8(_BT_OTHER),
  22898. 126: uint8(_BT_OTHER),
  22899. 127: uint8(_BT_OTHER),
  22900. 128: uint8(_BT_OTHER),
  22901. 129: uint8(_BT_OTHER),
  22902. 130: uint8(_BT_OTHER),
  22903. 131: uint8(_BT_OTHER),
  22904. 132: uint8(_BT_OTHER),
  22905. 133: uint8(_BT_OTHER),
  22906. 134: uint8(_BT_OTHER),
  22907. 135: uint8(_BT_OTHER),
  22908. 136: uint8(_BT_OTHER),
  22909. 137: uint8(_BT_OTHER),
  22910. 138: uint8(_BT_OTHER),
  22911. 139: uint8(_BT_OTHER),
  22912. 140: uint8(_BT_OTHER),
  22913. 141: uint8(_BT_OTHER),
  22914. 142: uint8(_BT_OTHER),
  22915. 143: uint8(_BT_OTHER),
  22916. 144: uint8(_BT_OTHER),
  22917. 145: uint8(_BT_OTHER),
  22918. 146: uint8(_BT_OTHER),
  22919. 147: uint8(_BT_OTHER),
  22920. 148: uint8(_BT_OTHER),
  22921. 149: uint8(_BT_OTHER),
  22922. 150: uint8(_BT_OTHER),
  22923. 151: uint8(_BT_OTHER),
  22924. 152: uint8(_BT_OTHER),
  22925. 153: uint8(_BT_OTHER),
  22926. 154: uint8(_BT_OTHER),
  22927. 155: uint8(_BT_OTHER),
  22928. 156: uint8(_BT_OTHER),
  22929. 157: uint8(_BT_OTHER),
  22930. 158: uint8(_BT_OTHER),
  22931. 159: uint8(_BT_OTHER),
  22932. 160: uint8(_BT_OTHER),
  22933. 161: uint8(_BT_OTHER),
  22934. 162: uint8(_BT_OTHER),
  22935. 163: uint8(_BT_OTHER),
  22936. 164: uint8(_BT_OTHER),
  22937. 165: uint8(_BT_OTHER),
  22938. 166: uint8(_BT_OTHER),
  22939. 167: uint8(_BT_OTHER),
  22940. 168: uint8(_BT_OTHER),
  22941. 169: uint8(_BT_OTHER),
  22942. 170: uint8(_BT_NMSTRT),
  22943. 171: uint8(_BT_OTHER),
  22944. 172: uint8(_BT_OTHER),
  22945. 173: uint8(_BT_OTHER),
  22946. 174: uint8(_BT_OTHER),
  22947. 175: uint8(_BT_OTHER),
  22948. 176: uint8(_BT_OTHER),
  22949. 177: uint8(_BT_OTHER),
  22950. 178: uint8(_BT_OTHER),
  22951. 179: uint8(_BT_OTHER),
  22952. 180: uint8(_BT_OTHER),
  22953. 181: uint8(_BT_NMSTRT),
  22954. 182: uint8(_BT_OTHER),
  22955. 183: uint8(_BT_NAME),
  22956. 184: uint8(_BT_OTHER),
  22957. 185: uint8(_BT_OTHER),
  22958. 186: uint8(_BT_NMSTRT),
  22959. 187: uint8(_BT_OTHER),
  22960. 188: uint8(_BT_OTHER),
  22961. 189: uint8(_BT_OTHER),
  22962. 190: uint8(_BT_OTHER),
  22963. 191: uint8(_BT_OTHER),
  22964. 192: uint8(_BT_NMSTRT),
  22965. 193: uint8(_BT_NMSTRT),
  22966. 194: uint8(_BT_NMSTRT),
  22967. 195: uint8(_BT_NMSTRT),
  22968. 196: uint8(_BT_NMSTRT),
  22969. 197: uint8(_BT_NMSTRT),
  22970. 198: uint8(_BT_NMSTRT),
  22971. 199: uint8(_BT_NMSTRT),
  22972. 200: uint8(_BT_NMSTRT),
  22973. 201: uint8(_BT_NMSTRT),
  22974. 202: uint8(_BT_NMSTRT),
  22975. 203: uint8(_BT_NMSTRT),
  22976. 204: uint8(_BT_NMSTRT),
  22977. 205: uint8(_BT_NMSTRT),
  22978. 206: uint8(_BT_NMSTRT),
  22979. 207: uint8(_BT_NMSTRT),
  22980. 208: uint8(_BT_NMSTRT),
  22981. 209: uint8(_BT_NMSTRT),
  22982. 210: uint8(_BT_NMSTRT),
  22983. 211: uint8(_BT_NMSTRT),
  22984. 212: uint8(_BT_NMSTRT),
  22985. 213: uint8(_BT_NMSTRT),
  22986. 214: uint8(_BT_NMSTRT),
  22987. 215: uint8(_BT_OTHER),
  22988. 216: uint8(_BT_NMSTRT),
  22989. 217: uint8(_BT_NMSTRT),
  22990. 218: uint8(_BT_NMSTRT),
  22991. 219: uint8(_BT_NMSTRT),
  22992. 220: uint8(_BT_NMSTRT),
  22993. 221: uint8(_BT_NMSTRT),
  22994. 222: uint8(_BT_NMSTRT),
  22995. 223: uint8(_BT_NMSTRT),
  22996. 224: uint8(_BT_NMSTRT),
  22997. 225: uint8(_BT_NMSTRT),
  22998. 226: uint8(_BT_NMSTRT),
  22999. 227: uint8(_BT_NMSTRT),
  23000. 228: uint8(_BT_NMSTRT),
  23001. 229: uint8(_BT_NMSTRT),
  23002. 230: uint8(_BT_NMSTRT),
  23003. 231: uint8(_BT_NMSTRT),
  23004. 232: uint8(_BT_NMSTRT),
  23005. 233: uint8(_BT_NMSTRT),
  23006. 234: uint8(_BT_NMSTRT),
  23007. 235: uint8(_BT_NMSTRT),
  23008. 236: uint8(_BT_NMSTRT),
  23009. 237: uint8(_BT_NMSTRT),
  23010. 238: uint8(_BT_NMSTRT),
  23011. 239: uint8(_BT_NMSTRT),
  23012. 240: uint8(_BT_NMSTRT),
  23013. 241: uint8(_BT_NMSTRT),
  23014. 242: uint8(_BT_NMSTRT),
  23015. 243: uint8(_BT_NMSTRT),
  23016. 244: uint8(_BT_NMSTRT),
  23017. 245: uint8(_BT_NMSTRT),
  23018. 246: uint8(_BT_NMSTRT),
  23019. 247: uint8(_BT_OTHER),
  23020. 248: uint8(_BT_NMSTRT),
  23021. 249: uint8(_BT_NMSTRT),
  23022. 250: uint8(_BT_NMSTRT),
  23023. 251: uint8(_BT_NMSTRT),
  23024. 252: uint8(_BT_NMSTRT),
  23025. 253: uint8(_BT_NMSTRT),
  23026. 254: uint8(_BT_NMSTRT),
  23027. 255: uint8(_BT_NMSTRT),
  23028. },
  23029. }
  23030. func init() {
  23031. p := unsafe.Pointer(&_internal_little2_encoding_ns)
  23032. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  23033. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  23034. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  23035. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  23036. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  23037. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  23038. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  23039. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  23040. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  23041. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  23042. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  23043. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  23044. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  23045. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  23046. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  23047. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  23048. }
  23049. var _internal_little2_encoding = Tnormal_encoding{
  23050. Fenc: TENCODING{
  23051. Fscanners: [4]TSCANNER{},
  23052. FliteralScanners: [2]TSCANNER{},
  23053. FminBytesPerChar: int32(2),
  23054. FisUtf16: uint8(1),
  23055. },
  23056. Ftype1: [256]uint8{
  23057. 9: uint8(_BT_S),
  23058. 10: uint8(_BT_LF),
  23059. 13: uint8(_BT_S),
  23060. 32: uint8(_BT_S),
  23061. 33: uint8(_BT_EXCL),
  23062. 34: uint8(_BT_QUOT),
  23063. 35: uint8(_BT_NUM),
  23064. 36: uint8(_BT_OTHER),
  23065. 37: uint8(_BT_PERCNT),
  23066. 38: uint8(_BT_AMP),
  23067. 39: uint8(_BT_APOS),
  23068. 40: uint8(_BT_LPAR),
  23069. 41: uint8(_BT_RPAR),
  23070. 42: uint8(_BT_AST),
  23071. 43: uint8(_BT_PLUS),
  23072. 44: uint8(_BT_COMMA),
  23073. 45: uint8(_BT_MINUS),
  23074. 46: uint8(_BT_NAME),
  23075. 47: uint8(_BT_SOL),
  23076. 48: uint8(_BT_DIGIT),
  23077. 49: uint8(_BT_DIGIT),
  23078. 50: uint8(_BT_DIGIT),
  23079. 51: uint8(_BT_DIGIT),
  23080. 52: uint8(_BT_DIGIT),
  23081. 53: uint8(_BT_DIGIT),
  23082. 54: uint8(_BT_DIGIT),
  23083. 55: uint8(_BT_DIGIT),
  23084. 56: uint8(_BT_DIGIT),
  23085. 57: uint8(_BT_DIGIT),
  23086. 58: uint8(_BT_NMSTRT),
  23087. 59: uint8(_BT_SEMI),
  23088. 60: uint8(_BT_LT),
  23089. 61: uint8(_BT_EQUALS),
  23090. 62: uint8(_BT_GT),
  23091. 63: uint8(_BT_QUEST),
  23092. 64: uint8(_BT_OTHER),
  23093. 65: uint8(_BT_HEX),
  23094. 66: uint8(_BT_HEX),
  23095. 67: uint8(_BT_HEX),
  23096. 68: uint8(_BT_HEX),
  23097. 69: uint8(_BT_HEX),
  23098. 70: uint8(_BT_HEX),
  23099. 71: uint8(_BT_NMSTRT),
  23100. 72: uint8(_BT_NMSTRT),
  23101. 73: uint8(_BT_NMSTRT),
  23102. 74: uint8(_BT_NMSTRT),
  23103. 75: uint8(_BT_NMSTRT),
  23104. 76: uint8(_BT_NMSTRT),
  23105. 77: uint8(_BT_NMSTRT),
  23106. 78: uint8(_BT_NMSTRT),
  23107. 79: uint8(_BT_NMSTRT),
  23108. 80: uint8(_BT_NMSTRT),
  23109. 81: uint8(_BT_NMSTRT),
  23110. 82: uint8(_BT_NMSTRT),
  23111. 83: uint8(_BT_NMSTRT),
  23112. 84: uint8(_BT_NMSTRT),
  23113. 85: uint8(_BT_NMSTRT),
  23114. 86: uint8(_BT_NMSTRT),
  23115. 87: uint8(_BT_NMSTRT),
  23116. 88: uint8(_BT_NMSTRT),
  23117. 89: uint8(_BT_NMSTRT),
  23118. 90: uint8(_BT_NMSTRT),
  23119. 91: uint8(_BT_LSQB),
  23120. 92: uint8(_BT_OTHER),
  23121. 93: uint8(_BT_RSQB),
  23122. 94: uint8(_BT_OTHER),
  23123. 95: uint8(_BT_NMSTRT),
  23124. 96: uint8(_BT_OTHER),
  23125. 97: uint8(_BT_HEX),
  23126. 98: uint8(_BT_HEX),
  23127. 99: uint8(_BT_HEX),
  23128. 100: uint8(_BT_HEX),
  23129. 101: uint8(_BT_HEX),
  23130. 102: uint8(_BT_HEX),
  23131. 103: uint8(_BT_NMSTRT),
  23132. 104: uint8(_BT_NMSTRT),
  23133. 105: uint8(_BT_NMSTRT),
  23134. 106: uint8(_BT_NMSTRT),
  23135. 107: uint8(_BT_NMSTRT),
  23136. 108: uint8(_BT_NMSTRT),
  23137. 109: uint8(_BT_NMSTRT),
  23138. 110: uint8(_BT_NMSTRT),
  23139. 111: uint8(_BT_NMSTRT),
  23140. 112: uint8(_BT_NMSTRT),
  23141. 113: uint8(_BT_NMSTRT),
  23142. 114: uint8(_BT_NMSTRT),
  23143. 115: uint8(_BT_NMSTRT),
  23144. 116: uint8(_BT_NMSTRT),
  23145. 117: uint8(_BT_NMSTRT),
  23146. 118: uint8(_BT_NMSTRT),
  23147. 119: uint8(_BT_NMSTRT),
  23148. 120: uint8(_BT_NMSTRT),
  23149. 121: uint8(_BT_NMSTRT),
  23150. 122: uint8(_BT_NMSTRT),
  23151. 123: uint8(_BT_OTHER),
  23152. 124: uint8(_BT_VERBAR),
  23153. 125: uint8(_BT_OTHER),
  23154. 126: uint8(_BT_OTHER),
  23155. 127: uint8(_BT_OTHER),
  23156. 128: uint8(_BT_OTHER),
  23157. 129: uint8(_BT_OTHER),
  23158. 130: uint8(_BT_OTHER),
  23159. 131: uint8(_BT_OTHER),
  23160. 132: uint8(_BT_OTHER),
  23161. 133: uint8(_BT_OTHER),
  23162. 134: uint8(_BT_OTHER),
  23163. 135: uint8(_BT_OTHER),
  23164. 136: uint8(_BT_OTHER),
  23165. 137: uint8(_BT_OTHER),
  23166. 138: uint8(_BT_OTHER),
  23167. 139: uint8(_BT_OTHER),
  23168. 140: uint8(_BT_OTHER),
  23169. 141: uint8(_BT_OTHER),
  23170. 142: uint8(_BT_OTHER),
  23171. 143: uint8(_BT_OTHER),
  23172. 144: uint8(_BT_OTHER),
  23173. 145: uint8(_BT_OTHER),
  23174. 146: uint8(_BT_OTHER),
  23175. 147: uint8(_BT_OTHER),
  23176. 148: uint8(_BT_OTHER),
  23177. 149: uint8(_BT_OTHER),
  23178. 150: uint8(_BT_OTHER),
  23179. 151: uint8(_BT_OTHER),
  23180. 152: uint8(_BT_OTHER),
  23181. 153: uint8(_BT_OTHER),
  23182. 154: uint8(_BT_OTHER),
  23183. 155: uint8(_BT_OTHER),
  23184. 156: uint8(_BT_OTHER),
  23185. 157: uint8(_BT_OTHER),
  23186. 158: uint8(_BT_OTHER),
  23187. 159: uint8(_BT_OTHER),
  23188. 160: uint8(_BT_OTHER),
  23189. 161: uint8(_BT_OTHER),
  23190. 162: uint8(_BT_OTHER),
  23191. 163: uint8(_BT_OTHER),
  23192. 164: uint8(_BT_OTHER),
  23193. 165: uint8(_BT_OTHER),
  23194. 166: uint8(_BT_OTHER),
  23195. 167: uint8(_BT_OTHER),
  23196. 168: uint8(_BT_OTHER),
  23197. 169: uint8(_BT_OTHER),
  23198. 170: uint8(_BT_NMSTRT),
  23199. 171: uint8(_BT_OTHER),
  23200. 172: uint8(_BT_OTHER),
  23201. 173: uint8(_BT_OTHER),
  23202. 174: uint8(_BT_OTHER),
  23203. 175: uint8(_BT_OTHER),
  23204. 176: uint8(_BT_OTHER),
  23205. 177: uint8(_BT_OTHER),
  23206. 178: uint8(_BT_OTHER),
  23207. 179: uint8(_BT_OTHER),
  23208. 180: uint8(_BT_OTHER),
  23209. 181: uint8(_BT_NMSTRT),
  23210. 182: uint8(_BT_OTHER),
  23211. 183: uint8(_BT_NAME),
  23212. 184: uint8(_BT_OTHER),
  23213. 185: uint8(_BT_OTHER),
  23214. 186: uint8(_BT_NMSTRT),
  23215. 187: uint8(_BT_OTHER),
  23216. 188: uint8(_BT_OTHER),
  23217. 189: uint8(_BT_OTHER),
  23218. 190: uint8(_BT_OTHER),
  23219. 191: uint8(_BT_OTHER),
  23220. 192: uint8(_BT_NMSTRT),
  23221. 193: uint8(_BT_NMSTRT),
  23222. 194: uint8(_BT_NMSTRT),
  23223. 195: uint8(_BT_NMSTRT),
  23224. 196: uint8(_BT_NMSTRT),
  23225. 197: uint8(_BT_NMSTRT),
  23226. 198: uint8(_BT_NMSTRT),
  23227. 199: uint8(_BT_NMSTRT),
  23228. 200: uint8(_BT_NMSTRT),
  23229. 201: uint8(_BT_NMSTRT),
  23230. 202: uint8(_BT_NMSTRT),
  23231. 203: uint8(_BT_NMSTRT),
  23232. 204: uint8(_BT_NMSTRT),
  23233. 205: uint8(_BT_NMSTRT),
  23234. 206: uint8(_BT_NMSTRT),
  23235. 207: uint8(_BT_NMSTRT),
  23236. 208: uint8(_BT_NMSTRT),
  23237. 209: uint8(_BT_NMSTRT),
  23238. 210: uint8(_BT_NMSTRT),
  23239. 211: uint8(_BT_NMSTRT),
  23240. 212: uint8(_BT_NMSTRT),
  23241. 213: uint8(_BT_NMSTRT),
  23242. 214: uint8(_BT_NMSTRT),
  23243. 215: uint8(_BT_OTHER),
  23244. 216: uint8(_BT_NMSTRT),
  23245. 217: uint8(_BT_NMSTRT),
  23246. 218: uint8(_BT_NMSTRT),
  23247. 219: uint8(_BT_NMSTRT),
  23248. 220: uint8(_BT_NMSTRT),
  23249. 221: uint8(_BT_NMSTRT),
  23250. 222: uint8(_BT_NMSTRT),
  23251. 223: uint8(_BT_NMSTRT),
  23252. 224: uint8(_BT_NMSTRT),
  23253. 225: uint8(_BT_NMSTRT),
  23254. 226: uint8(_BT_NMSTRT),
  23255. 227: uint8(_BT_NMSTRT),
  23256. 228: uint8(_BT_NMSTRT),
  23257. 229: uint8(_BT_NMSTRT),
  23258. 230: uint8(_BT_NMSTRT),
  23259. 231: uint8(_BT_NMSTRT),
  23260. 232: uint8(_BT_NMSTRT),
  23261. 233: uint8(_BT_NMSTRT),
  23262. 234: uint8(_BT_NMSTRT),
  23263. 235: uint8(_BT_NMSTRT),
  23264. 236: uint8(_BT_NMSTRT),
  23265. 237: uint8(_BT_NMSTRT),
  23266. 238: uint8(_BT_NMSTRT),
  23267. 239: uint8(_BT_NMSTRT),
  23268. 240: uint8(_BT_NMSTRT),
  23269. 241: uint8(_BT_NMSTRT),
  23270. 242: uint8(_BT_NMSTRT),
  23271. 243: uint8(_BT_NMSTRT),
  23272. 244: uint8(_BT_NMSTRT),
  23273. 245: uint8(_BT_NMSTRT),
  23274. 246: uint8(_BT_NMSTRT),
  23275. 247: uint8(_BT_OTHER),
  23276. 248: uint8(_BT_NMSTRT),
  23277. 249: uint8(_BT_NMSTRT),
  23278. 250: uint8(_BT_NMSTRT),
  23279. 251: uint8(_BT_NMSTRT),
  23280. 252: uint8(_BT_NMSTRT),
  23281. 253: uint8(_BT_NMSTRT),
  23282. 254: uint8(_BT_NMSTRT),
  23283. 255: uint8(_BT_NMSTRT),
  23284. },
  23285. }
  23286. func init() {
  23287. p := unsafe.Pointer(&_internal_little2_encoding)
  23288. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  23289. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  23290. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  23291. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  23292. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  23293. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  23294. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  23295. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  23296. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  23297. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  23298. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  23299. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  23300. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  23301. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  23302. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  23303. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  23304. }
  23305. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  23306. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  23307. __ __ _
  23308. ___\ \/ /_ __ __ _| |_
  23309. / _ \\ /| '_ \ / _` | __|
  23310. | __// \| |_) | (_| | |_
  23311. \___/_/\_\ .__/ \__,_|\__|
  23312. |_| XML parser
  23313. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  23314. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  23315. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  23316. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  23317. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  23318. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  23319. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  23320. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  23321. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  23322. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  23323. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  23324. Licensed under the MIT license:
  23325. Permission is hereby granted, free of charge, to any person obtaining
  23326. a copy of this software and associated documentation files (the
  23327. "Software"), to deal in the Software without restriction, including
  23328. without limitation the rights to use, copy, modify, merge, publish,
  23329. distribute, sublicense, and/or sell copies of the Software, and to permit
  23330. persons to whom the Software is furnished to do so, subject to the
  23331. following conditions:
  23332. The above copyright notice and this permission notice shall be included
  23333. in all copies or substantial portions of the Software.
  23334. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23335. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23336. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  23337. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  23338. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  23339. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  23340. USE OR OTHER DEALINGS IN THE SOFTWARE.
  23341. */
  23342. /* ptr points to character following "<!-" */
  23343. func _big2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23344. var v1 int32
  23345. _ = v1
  23346. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23347. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1)) {
  23348. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23349. return m_XML_TOK_INVALID
  23350. }
  23351. ptr += uintptr(2)
  23352. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23353. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23354. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23355. } else {
  23356. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23357. }
  23358. switch v1 {
  23359. case int32(_BT_LEAD2):
  23360. if int64(end)-int64(ptr) < int64(2) {
  23361. return -int32(2)
  23362. }
  23363. if 0 != 0 {
  23364. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23365. return m_XML_TOK_INVALID
  23366. }
  23367. ptr += uintptr(2)
  23368. case int32(_BT_LEAD3):
  23369. if int64(end)-int64(ptr) < int64(3) {
  23370. return -int32(2)
  23371. }
  23372. if 0 != 0 {
  23373. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23374. return m_XML_TOK_INVALID
  23375. }
  23376. ptr += uintptr(3)
  23377. case int32(_BT_LEAD4):
  23378. if int64(end)-int64(ptr) < int64(4) {
  23379. return -int32(2)
  23380. }
  23381. if 0 != 0 {
  23382. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23383. return m_XML_TOK_INVALID
  23384. }
  23385. ptr += uintptr(4)
  23386. case int32(_BT_NONXML):
  23387. fallthrough
  23388. case int32(_BT_MALFORM):
  23389. fallthrough
  23390. case int32(_BT_TRAIL):
  23391. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23392. return m_XML_TOK_INVALID
  23393. case int32(_BT_MINUS):
  23394. ptr += uintptr(2)
  23395. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23396. return -int32(1)
  23397. }
  23398. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1) {
  23399. ptr += uintptr(2)
  23400. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23401. return -int32(1)
  23402. }
  23403. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  23404. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23405. return m_XML_TOK_INVALID
  23406. }
  23407. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23408. return int32(m_XML_TOK_COMMENT)
  23409. }
  23410. default:
  23411. ptr += uintptr(2)
  23412. break
  23413. }
  23414. }
  23415. }
  23416. return -int32(1)
  23417. }
  23418. /* ptr points to character following "<!" */
  23419. func _big2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23420. var v1, v2, v3 int32
  23421. _, _, _ = v1, v2, v3
  23422. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23423. return -int32(1)
  23424. }
  23425. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23426. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23427. } else {
  23428. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23429. }
  23430. switch v1 {
  23431. case int32(_BT_MINUS):
  23432. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23433. case int32(_BT_LSQB):
  23434. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23435. return int32(m_XML_TOK_COND_SECT_OPEN)
  23436. case int32(_BT_NMSTRT):
  23437. fallthrough
  23438. case int32(_BT_HEX):
  23439. ptr += uintptr(2)
  23440. default:
  23441. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23442. return m_XML_TOK_INVALID
  23443. }
  23444. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23445. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23446. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23447. } else {
  23448. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23449. }
  23450. switch v2 {
  23451. case int32(_BT_PERCNT):
  23452. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  23453. return -int32(1)
  23454. }
  23455. /* don't allow <!ENTITY% foo "whatever"> */
  23456. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  23457. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))))))
  23458. } else {
  23459. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  23460. }
  23461. switch v3 {
  23462. case int32(_BT_S):
  23463. fallthrough
  23464. case int32(_BT_CR):
  23465. fallthrough
  23466. case int32(_BT_LF):
  23467. fallthrough
  23468. case int32(_BT_PERCNT):
  23469. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23470. return m_XML_TOK_INVALID
  23471. }
  23472. /* fall through */
  23473. fallthrough
  23474. case int32(_BT_S):
  23475. fallthrough
  23476. case int32(_BT_CR):
  23477. fallthrough
  23478. case int32(_BT_LF):
  23479. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23480. return int32(m_XML_TOK_DECL_OPEN)
  23481. case int32(_BT_NMSTRT):
  23482. fallthrough
  23483. case int32(_BT_HEX):
  23484. ptr += uintptr(2)
  23485. default:
  23486. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23487. return m_XML_TOK_INVALID
  23488. }
  23489. }
  23490. return -int32(1)
  23491. }
  23492. func _big2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  23493. var upper, v1, v2, v3 int32
  23494. _, _, _, _ = upper, v1, v2, v3
  23495. upper = 0
  23496. _ = enc
  23497. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  23498. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(3)) {
  23499. return int32(1)
  23500. }
  23501. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23502. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23503. } else {
  23504. v1 = -int32(1)
  23505. }
  23506. switch v1 {
  23507. case int32(m_ASCII_x2):
  23508. case int32(m_ASCII_X):
  23509. upper = int32(1)
  23510. default:
  23511. return int32(1)
  23512. }
  23513. ptr += uintptr(2)
  23514. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23515. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23516. } else {
  23517. v2 = -int32(1)
  23518. }
  23519. switch v2 {
  23520. case int32(m_ASCII_m2):
  23521. case int32(m_ASCII_M):
  23522. upper = int32(1)
  23523. default:
  23524. return int32(1)
  23525. }
  23526. ptr += uintptr(2)
  23527. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23528. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23529. } else {
  23530. v3 = -int32(1)
  23531. }
  23532. switch v3 {
  23533. case int32(m_ASCII_l2):
  23534. case int32(m_ASCII_L):
  23535. upper = int32(1)
  23536. default:
  23537. return int32(1)
  23538. }
  23539. if upper != 0 {
  23540. return 0
  23541. }
  23542. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  23543. return int32(1)
  23544. }
  23545. /* ptr points to character following "<?" */
  23546. func _big2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23547. bp := tls.Alloc(16)
  23548. defer tls.Free(16)
  23549. var target uintptr
  23550. var v1, v2, v3 int32
  23551. var _ /* tok at bp+0 */ int32
  23552. _, _, _, _ = target, v1, v2, v3
  23553. target = ptr
  23554. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23555. return -int32(1)
  23556. }
  23557. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23558. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23559. } else {
  23560. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23561. }
  23562. switch v1 {
  23563. case int32(_BT_NONASCII):
  23564. 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) {
  23565. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23566. return m_XML_TOK_INVALID
  23567. } /* fall through */
  23568. fallthrough
  23569. case int32(_BT_NMSTRT):
  23570. fallthrough
  23571. case int32(_BT_HEX):
  23572. ptr += uintptr(2)
  23573. case int32(_BT_LEAD2):
  23574. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  23575. return -int32(2)
  23576. }
  23577. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23578. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23579. return m_XML_TOK_INVALID
  23580. }
  23581. ptr += uintptr(2)
  23582. case int32(_BT_LEAD3):
  23583. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  23584. return -int32(2)
  23585. }
  23586. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23587. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23588. return m_XML_TOK_INVALID
  23589. }
  23590. ptr += uintptr(3)
  23591. case int32(_BT_LEAD4):
  23592. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  23593. return -int32(2)
  23594. }
  23595. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23596. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23597. return m_XML_TOK_INVALID
  23598. }
  23599. ptr += uintptr(4)
  23600. default:
  23601. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23602. return m_XML_TOK_INVALID
  23603. }
  23604. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23605. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23606. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23607. } else {
  23608. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23609. }
  23610. switch v2 {
  23611. case int32(_BT_NONASCII):
  23612. 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) {
  23613. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23614. return m_XML_TOK_INVALID
  23615. } /* fall through */
  23616. fallthrough
  23617. case int32(_BT_NMSTRT):
  23618. fallthrough
  23619. case int32(_BT_HEX):
  23620. fallthrough
  23621. case int32(_BT_DIGIT):
  23622. fallthrough
  23623. case int32(_BT_NAME):
  23624. fallthrough
  23625. case int32(_BT_MINUS):
  23626. ptr += uintptr(2)
  23627. case int32(_BT_LEAD2):
  23628. if int64(end)-int64(ptr) < int64(2) {
  23629. return -int32(2)
  23630. }
  23631. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23632. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23633. return m_XML_TOK_INVALID
  23634. }
  23635. ptr += uintptr(2)
  23636. case int32(_BT_LEAD3):
  23637. if int64(end)-int64(ptr) < int64(3) {
  23638. return -int32(2)
  23639. }
  23640. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23641. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23642. return m_XML_TOK_INVALID
  23643. }
  23644. ptr += uintptr(3)
  23645. case int32(_BT_LEAD4):
  23646. if int64(end)-int64(ptr) < int64(4) {
  23647. return -int32(2)
  23648. }
  23649. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23650. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23651. return m_XML_TOK_INVALID
  23652. }
  23653. ptr += uintptr(4)
  23654. case int32(_BT_S):
  23655. fallthrough
  23656. case int32(_BT_CR):
  23657. fallthrough
  23658. case int32(_BT_LF):
  23659. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  23660. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23661. return m_XML_TOK_INVALID
  23662. }
  23663. ptr += uintptr(2)
  23664. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23665. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23666. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23667. } else {
  23668. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23669. }
  23670. switch v3 {
  23671. case int32(_BT_LEAD2):
  23672. if int64(end)-int64(ptr) < int64(2) {
  23673. return -int32(2)
  23674. }
  23675. if 0 != 0 {
  23676. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23677. return m_XML_TOK_INVALID
  23678. }
  23679. ptr += uintptr(2)
  23680. case int32(_BT_LEAD3):
  23681. if int64(end)-int64(ptr) < int64(3) {
  23682. return -int32(2)
  23683. }
  23684. if 0 != 0 {
  23685. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23686. return m_XML_TOK_INVALID
  23687. }
  23688. ptr += uintptr(3)
  23689. case int32(_BT_LEAD4):
  23690. if int64(end)-int64(ptr) < int64(4) {
  23691. return -int32(2)
  23692. }
  23693. if 0 != 0 {
  23694. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23695. return m_XML_TOK_INVALID
  23696. }
  23697. ptr += uintptr(4)
  23698. case int32(_BT_NONXML):
  23699. fallthrough
  23700. case int32(_BT_MALFORM):
  23701. fallthrough
  23702. case int32(_BT_TRAIL):
  23703. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23704. return m_XML_TOK_INVALID
  23705. case int32(_BT_QUEST):
  23706. ptr += uintptr(2)
  23707. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23708. return -int32(1)
  23709. }
  23710. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  23711. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23712. return *(*int32)(unsafe.Pointer(bp))
  23713. }
  23714. default:
  23715. ptr += uintptr(2)
  23716. break
  23717. }
  23718. }
  23719. return -int32(1)
  23720. case int32(_BT_QUEST):
  23721. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  23722. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23723. return m_XML_TOK_INVALID
  23724. }
  23725. ptr += uintptr(2)
  23726. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23727. return -int32(1)
  23728. }
  23729. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  23730. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23731. return *(*int32)(unsafe.Pointer(bp))
  23732. }
  23733. /* fall through */
  23734. fallthrough
  23735. default:
  23736. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23737. return m_XML_TOK_INVALID
  23738. }
  23739. }
  23740. return -int32(1)
  23741. }
  23742. func _big2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23743. var i int32
  23744. _ = i
  23745. _ = enc
  23746. /* CDATA[ */
  23747. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))) {
  23748. return -int32(1)
  23749. }
  23750. i = 0
  23751. for {
  23752. if !(i < int32(6)) {
  23753. break
  23754. }
  23755. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == libc.Int32FromUint8(_CDATA_LSQB2[i])) {
  23756. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23757. return m_XML_TOK_INVALID
  23758. }
  23759. goto _1
  23760. _1:
  23761. ;
  23762. i++
  23763. ptr += uintptr(2)
  23764. }
  23765. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23766. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  23767. }
  23768. var _CDATA_LSQB2 = [6]uint8{
  23769. 0: uint8(m_ASCII_C),
  23770. 1: uint8(m_ASCII_D),
  23771. 2: uint8(m_ASCII_A),
  23772. 3: uint8(m_ASCII_T),
  23773. 4: uint8(m_ASCII_A),
  23774. 5: uint8(m_ASCII_LSQB1),
  23775. }
  23776. func _big2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23777. var n Tsize_t
  23778. var v1, v2, v3 int32
  23779. _, _, _, _ = n, v1, v2, v3
  23780. if ptr >= end {
  23781. return -int32(4)
  23782. }
  23783. if int32(2) > int32(1) {
  23784. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  23785. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  23786. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  23787. if n == uint64(0) {
  23788. return -int32(1)
  23789. }
  23790. end = ptr + uintptr(n)
  23791. }
  23792. }
  23793. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23794. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23795. } else {
  23796. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23797. }
  23798. switch v1 {
  23799. case int32(_BT_RSQB):
  23800. ptr += uintptr(2)
  23801. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23802. return -int32(1)
  23803. }
  23804. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  23805. break
  23806. }
  23807. ptr += uintptr(2)
  23808. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23809. return -int32(1)
  23810. }
  23811. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  23812. ptr -= uintptr(2)
  23813. break
  23814. }
  23815. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23816. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  23817. case int32(_BT_CR):
  23818. ptr += uintptr(2)
  23819. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23820. return -int32(1)
  23821. }
  23822. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23823. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23824. } else {
  23825. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23826. }
  23827. if v2 == int32(_BT_LF) {
  23828. ptr += uintptr(2)
  23829. }
  23830. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23831. return int32(m_XML_TOK_DATA_NEWLINE)
  23832. case int32(_BT_LF):
  23833. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23834. return int32(m_XML_TOK_DATA_NEWLINE)
  23835. case int32(_BT_LEAD2):
  23836. if int64(end)-int64(ptr) < int64(2) {
  23837. return -int32(2)
  23838. }
  23839. if 0 != 0 {
  23840. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23841. return m_XML_TOK_INVALID
  23842. }
  23843. ptr += uintptr(2)
  23844. case int32(_BT_LEAD3):
  23845. if int64(end)-int64(ptr) < int64(3) {
  23846. return -int32(2)
  23847. }
  23848. if 0 != 0 {
  23849. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23850. return m_XML_TOK_INVALID
  23851. }
  23852. ptr += uintptr(3)
  23853. case int32(_BT_LEAD4):
  23854. if int64(end)-int64(ptr) < int64(4) {
  23855. return -int32(2)
  23856. }
  23857. if 0 != 0 {
  23858. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23859. return m_XML_TOK_INVALID
  23860. }
  23861. ptr += uintptr(4)
  23862. case int32(_BT_NONXML):
  23863. fallthrough
  23864. case int32(_BT_MALFORM):
  23865. fallthrough
  23866. case int32(_BT_TRAIL):
  23867. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23868. return m_XML_TOK_INVALID
  23869. default:
  23870. ptr += uintptr(2)
  23871. break
  23872. }
  23873. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23874. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23875. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23876. } else {
  23877. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23878. }
  23879. switch v3 {
  23880. case int32(_BT_LEAD2):
  23881. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  23882. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23883. return int32(m_XML_TOK_DATA_CHARS)
  23884. }
  23885. ptr += uintptr(2)
  23886. case int32(_BT_LEAD3):
  23887. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  23888. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23889. return int32(m_XML_TOK_DATA_CHARS)
  23890. }
  23891. ptr += uintptr(3)
  23892. case int32(_BT_LEAD4):
  23893. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  23894. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23895. return int32(m_XML_TOK_DATA_CHARS)
  23896. }
  23897. ptr += uintptr(4)
  23898. case int32(_BT_NONXML):
  23899. fallthrough
  23900. case int32(_BT_MALFORM):
  23901. fallthrough
  23902. case int32(_BT_TRAIL):
  23903. fallthrough
  23904. case int32(_BT_CR):
  23905. fallthrough
  23906. case int32(_BT_LF):
  23907. fallthrough
  23908. case int32(_BT_RSQB):
  23909. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23910. return int32(m_XML_TOK_DATA_CHARS)
  23911. default:
  23912. ptr += uintptr(2)
  23913. break
  23914. }
  23915. }
  23916. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23917. return int32(m_XML_TOK_DATA_CHARS)
  23918. }
  23919. /* ptr points to character following "</" */
  23920. func _big2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23921. var v1, v2, v22 int32
  23922. _, _, _ = v1, v2, v22
  23923. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23924. return -int32(1)
  23925. }
  23926. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23927. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23928. } else {
  23929. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23930. }
  23931. switch v1 {
  23932. case int32(_BT_NONASCII):
  23933. 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) {
  23934. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23935. return m_XML_TOK_INVALID
  23936. } /* fall through */
  23937. fallthrough
  23938. case int32(_BT_NMSTRT):
  23939. fallthrough
  23940. case int32(_BT_HEX):
  23941. ptr += uintptr(2)
  23942. case int32(_BT_LEAD2):
  23943. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  23944. return -int32(2)
  23945. }
  23946. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23947. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23948. return m_XML_TOK_INVALID
  23949. }
  23950. ptr += uintptr(2)
  23951. case int32(_BT_LEAD3):
  23952. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  23953. return -int32(2)
  23954. }
  23955. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23956. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23957. return m_XML_TOK_INVALID
  23958. }
  23959. ptr += uintptr(3)
  23960. case int32(_BT_LEAD4):
  23961. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  23962. return -int32(2)
  23963. }
  23964. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23965. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23966. return m_XML_TOK_INVALID
  23967. }
  23968. ptr += uintptr(4)
  23969. default:
  23970. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23971. return m_XML_TOK_INVALID
  23972. }
  23973. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23974. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23975. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23976. } else {
  23977. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23978. }
  23979. switch v2 {
  23980. case int32(_BT_NONASCII):
  23981. goto _3
  23982. case int32(_BT_MINUS):
  23983. goto _4
  23984. case int32(_BT_NAME):
  23985. goto _5
  23986. case int32(_BT_DIGIT):
  23987. goto _6
  23988. case int32(_BT_HEX):
  23989. goto _7
  23990. case int32(_BT_NMSTRT):
  23991. goto _8
  23992. case int32(_BT_LEAD2):
  23993. goto _9
  23994. case int32(_BT_LEAD3):
  23995. goto _10
  23996. case int32(_BT_LEAD4):
  23997. goto _11
  23998. case int32(_BT_LF):
  23999. goto _12
  24000. case int32(_BT_CR):
  24001. goto _13
  24002. case int32(_BT_S):
  24003. goto _14
  24004. case int32(_BT_COLON):
  24005. goto _15
  24006. case int32(_BT_GT):
  24007. goto _16
  24008. default:
  24009. goto _17
  24010. }
  24011. goto _18
  24012. _3:
  24013. ;
  24014. 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) {
  24015. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24016. return m_XML_TOK_INVALID
  24017. } /* fall through */
  24018. _8:
  24019. ;
  24020. _7:
  24021. ;
  24022. _6:
  24023. ;
  24024. _5:
  24025. ;
  24026. _4:
  24027. ;
  24028. ptr += uintptr(2)
  24029. goto _18
  24030. _9:
  24031. ;
  24032. if int64(end)-int64(ptr) < int64(2) {
  24033. return -int32(2)
  24034. }
  24035. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24036. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24037. return m_XML_TOK_INVALID
  24038. }
  24039. ptr += uintptr(2)
  24040. goto _18
  24041. _10:
  24042. ;
  24043. if int64(end)-int64(ptr) < int64(3) {
  24044. return -int32(2)
  24045. }
  24046. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24047. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24048. return m_XML_TOK_INVALID
  24049. }
  24050. ptr += uintptr(3)
  24051. goto _18
  24052. _11:
  24053. ;
  24054. if int64(end)-int64(ptr) < int64(4) {
  24055. return -int32(2)
  24056. }
  24057. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24058. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24059. return m_XML_TOK_INVALID
  24060. }
  24061. ptr += uintptr(4)
  24062. goto _18
  24063. _14:
  24064. ;
  24065. _13:
  24066. ;
  24067. _12:
  24068. ;
  24069. ptr += uintptr(2)
  24070. _21:
  24071. ;
  24072. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24073. goto _19
  24074. }
  24075. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24076. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24077. } else {
  24078. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24079. }
  24080. switch v22 {
  24081. case int32(_BT_S):
  24082. fallthrough
  24083. case int32(_BT_CR):
  24084. fallthrough
  24085. case int32(_BT_LF):
  24086. case int32(_BT_GT):
  24087. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24088. return int32(m_XML_TOK_END_TAG)
  24089. default:
  24090. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24091. return m_XML_TOK_INVALID
  24092. }
  24093. goto _20
  24094. _20:
  24095. ;
  24096. ptr += uintptr(2)
  24097. goto _21
  24098. goto _19
  24099. _19:
  24100. ;
  24101. return -int32(1)
  24102. _15:
  24103. ;
  24104. /* no need to check qname syntax here,
  24105. since end-tag must match exactly */
  24106. ptr += uintptr(2)
  24107. goto _18
  24108. _16:
  24109. ;
  24110. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24111. return int32(m_XML_TOK_END_TAG)
  24112. _17:
  24113. ;
  24114. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24115. return m_XML_TOK_INVALID
  24116. _18:
  24117. }
  24118. return -int32(1)
  24119. }
  24120. /* ptr points to character following "&#X" */
  24121. func _big2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24122. var v1, v3 int32
  24123. _, _ = v1, v3
  24124. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24125. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24126. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24127. } else {
  24128. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24129. }
  24130. switch v1 {
  24131. case int32(_BT_DIGIT):
  24132. fallthrough
  24133. case int32(_BT_HEX):
  24134. default:
  24135. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24136. return m_XML_TOK_INVALID
  24137. }
  24138. ptr += uintptr(2)
  24139. for {
  24140. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24141. break
  24142. }
  24143. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24144. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24145. } else {
  24146. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24147. }
  24148. switch v3 {
  24149. case int32(_BT_DIGIT):
  24150. fallthrough
  24151. case int32(_BT_HEX):
  24152. case int32(_BT_SEMI):
  24153. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24154. return int32(m_XML_TOK_CHAR_REF)
  24155. default:
  24156. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24157. return m_XML_TOK_INVALID
  24158. }
  24159. goto _2
  24160. _2:
  24161. ;
  24162. ptr += uintptr(2)
  24163. }
  24164. }
  24165. return -int32(1)
  24166. }
  24167. /* ptr points to character following "&#" */
  24168. func _big2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24169. var v1, v3 int32
  24170. _, _ = v1, v3
  24171. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24172. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x2) {
  24173. return _big2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24174. }
  24175. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24176. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24177. } else {
  24178. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24179. }
  24180. switch v1 {
  24181. case int32(_BT_DIGIT):
  24182. default:
  24183. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24184. return m_XML_TOK_INVALID
  24185. }
  24186. ptr += uintptr(2)
  24187. for {
  24188. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24189. break
  24190. }
  24191. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24192. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24193. } else {
  24194. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24195. }
  24196. switch v3 {
  24197. case int32(_BT_DIGIT):
  24198. case int32(_BT_SEMI):
  24199. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24200. return int32(m_XML_TOK_CHAR_REF)
  24201. default:
  24202. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24203. return m_XML_TOK_INVALID
  24204. }
  24205. goto _2
  24206. _2:
  24207. ;
  24208. ptr += uintptr(2)
  24209. }
  24210. }
  24211. return -int32(1)
  24212. }
  24213. /* ptr points to character following "&" */
  24214. func _big2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24215. var v1, v2 int32
  24216. _, _ = v1, v2
  24217. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24218. return -int32(1)
  24219. }
  24220. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24221. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24222. } else {
  24223. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24224. }
  24225. switch v1 {
  24226. case int32(_BT_NONASCII):
  24227. 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) {
  24228. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24229. return m_XML_TOK_INVALID
  24230. } /* fall through */
  24231. fallthrough
  24232. case int32(_BT_NMSTRT):
  24233. fallthrough
  24234. case int32(_BT_HEX):
  24235. ptr += uintptr(2)
  24236. case int32(_BT_LEAD2):
  24237. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  24238. return -int32(2)
  24239. }
  24240. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24241. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24242. return m_XML_TOK_INVALID
  24243. }
  24244. ptr += uintptr(2)
  24245. case int32(_BT_LEAD3):
  24246. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  24247. return -int32(2)
  24248. }
  24249. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24250. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24251. return m_XML_TOK_INVALID
  24252. }
  24253. ptr += uintptr(3)
  24254. case int32(_BT_LEAD4):
  24255. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  24256. return -int32(2)
  24257. }
  24258. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24259. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24260. return m_XML_TOK_INVALID
  24261. }
  24262. ptr += uintptr(4)
  24263. case int32(_BT_NUM):
  24264. return _big2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24265. default:
  24266. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24267. return m_XML_TOK_INVALID
  24268. }
  24269. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24270. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24271. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24272. } else {
  24273. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24274. }
  24275. switch v2 {
  24276. case int32(_BT_NONASCII):
  24277. 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) {
  24278. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24279. return m_XML_TOK_INVALID
  24280. } /* fall through */
  24281. fallthrough
  24282. case int32(_BT_NMSTRT):
  24283. fallthrough
  24284. case int32(_BT_HEX):
  24285. fallthrough
  24286. case int32(_BT_DIGIT):
  24287. fallthrough
  24288. case int32(_BT_NAME):
  24289. fallthrough
  24290. case int32(_BT_MINUS):
  24291. ptr += uintptr(2)
  24292. case int32(_BT_LEAD2):
  24293. if int64(end)-int64(ptr) < int64(2) {
  24294. return -int32(2)
  24295. }
  24296. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24297. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24298. return m_XML_TOK_INVALID
  24299. }
  24300. ptr += uintptr(2)
  24301. case int32(_BT_LEAD3):
  24302. if int64(end)-int64(ptr) < int64(3) {
  24303. return -int32(2)
  24304. }
  24305. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24306. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24307. return m_XML_TOK_INVALID
  24308. }
  24309. ptr += uintptr(3)
  24310. case int32(_BT_LEAD4):
  24311. if int64(end)-int64(ptr) < int64(4) {
  24312. return -int32(2)
  24313. }
  24314. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24315. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24316. return m_XML_TOK_INVALID
  24317. }
  24318. ptr += uintptr(4)
  24319. case int32(_BT_SEMI):
  24320. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24321. return int32(m_XML_TOK_ENTITY_REF)
  24322. default:
  24323. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24324. return m_XML_TOK_INVALID
  24325. }
  24326. }
  24327. return -int32(1)
  24328. }
  24329. /* ptr points to character following first character of attribute name */
  24330. func _big2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24331. bp := tls.Alloc(16)
  24332. defer tls.Free(16)
  24333. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  24334. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  24335. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  24336. hadColon = 0
  24337. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24338. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24339. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24340. } else {
  24341. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24342. }
  24343. switch v1 {
  24344. case int32(_BT_NONASCII):
  24345. goto _2
  24346. case int32(_BT_MINUS):
  24347. goto _3
  24348. case int32(_BT_NAME):
  24349. goto _4
  24350. case int32(_BT_DIGIT):
  24351. goto _5
  24352. case int32(_BT_HEX):
  24353. goto _6
  24354. case int32(_BT_NMSTRT):
  24355. goto _7
  24356. case int32(_BT_LEAD2):
  24357. goto _8
  24358. case int32(_BT_LEAD3):
  24359. goto _9
  24360. case int32(_BT_LEAD4):
  24361. goto _10
  24362. case int32(_BT_COLON):
  24363. goto _11
  24364. case int32(_BT_LF):
  24365. goto _12
  24366. case int32(_BT_CR):
  24367. goto _13
  24368. case int32(_BT_S):
  24369. goto _14
  24370. case int32(_BT_EQUALS):
  24371. goto _15
  24372. default:
  24373. goto _16
  24374. }
  24375. goto _17
  24376. _2:
  24377. ;
  24378. 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) {
  24379. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24380. return m_XML_TOK_INVALID
  24381. } /* fall through */
  24382. _7:
  24383. ;
  24384. _6:
  24385. ;
  24386. _5:
  24387. ;
  24388. _4:
  24389. ;
  24390. _3:
  24391. ;
  24392. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24393. goto _17
  24394. _8:
  24395. ;
  24396. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  24397. return -int32(2)
  24398. }
  24399. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24400. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24401. return m_XML_TOK_INVALID
  24402. }
  24403. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24404. goto _17
  24405. _9:
  24406. ;
  24407. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  24408. return -int32(2)
  24409. }
  24410. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24411. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24412. return m_XML_TOK_INVALID
  24413. }
  24414. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24415. goto _17
  24416. _10:
  24417. ;
  24418. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  24419. return -int32(2)
  24420. }
  24421. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24422. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24423. return m_XML_TOK_INVALID
  24424. }
  24425. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24426. goto _17
  24427. _11:
  24428. ;
  24429. if hadColon != 0 {
  24430. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24431. return m_XML_TOK_INVALID
  24432. }
  24433. hadColon = int32(1)
  24434. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24435. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24436. return -int32(1)
  24437. }
  24438. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24439. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24440. } else {
  24441. v18 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24442. }
  24443. switch v18 {
  24444. case int32(_BT_NONASCII):
  24445. 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) {
  24446. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24447. return m_XML_TOK_INVALID
  24448. } /* fall through */
  24449. fallthrough
  24450. case int32(_BT_NMSTRT):
  24451. fallthrough
  24452. case int32(_BT_HEX):
  24453. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24454. case int32(_BT_LEAD2):
  24455. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  24456. return -int32(2)
  24457. }
  24458. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24459. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24460. return m_XML_TOK_INVALID
  24461. }
  24462. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24463. case int32(_BT_LEAD3):
  24464. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  24465. return -int32(2)
  24466. }
  24467. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24468. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24469. return m_XML_TOK_INVALID
  24470. }
  24471. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24472. case int32(_BT_LEAD4):
  24473. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  24474. return -int32(2)
  24475. }
  24476. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24477. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24478. return m_XML_TOK_INVALID
  24479. }
  24480. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24481. default:
  24482. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24483. return m_XML_TOK_INVALID
  24484. }
  24485. goto _17
  24486. _14:
  24487. ;
  24488. _13:
  24489. ;
  24490. _12:
  24491. ;
  24492. _21:
  24493. ;
  24494. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24495. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24496. return -int32(1)
  24497. }
  24498. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24499. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24500. } else {
  24501. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24502. }
  24503. t = v22
  24504. if t == int32(_BT_EQUALS) {
  24505. goto _19
  24506. }
  24507. switch t {
  24508. case int32(_BT_S):
  24509. fallthrough
  24510. case int32(_BT_LF):
  24511. fallthrough
  24512. case int32(_BT_CR):
  24513. default:
  24514. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24515. return m_XML_TOK_INVALID
  24516. }
  24517. goto _20
  24518. _20:
  24519. ;
  24520. goto _21
  24521. goto _19
  24522. _19:
  24523. ;
  24524. /* fall through */
  24525. _15:
  24526. ;
  24527. hadColon = 0
  24528. for {
  24529. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24530. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24531. return -int32(1)
  24532. }
  24533. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24534. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24535. } else {
  24536. v24 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24537. }
  24538. open = v24
  24539. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  24540. break
  24541. }
  24542. switch open {
  24543. case int32(_BT_S):
  24544. fallthrough
  24545. case int32(_BT_LF):
  24546. fallthrough
  24547. case int32(_BT_CR):
  24548. default:
  24549. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24550. return m_XML_TOK_INVALID
  24551. }
  24552. goto _23
  24553. _23:
  24554. }
  24555. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24556. /* in attribute value */
  24557. for {
  24558. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24559. return -int32(1)
  24560. }
  24561. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24562. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24563. } else {
  24564. v26 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24565. }
  24566. t1 = v26
  24567. if t1 == open {
  24568. break
  24569. }
  24570. switch t1 {
  24571. case int32(_BT_LEAD2):
  24572. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  24573. return -int32(2)
  24574. }
  24575. if 0 != 0 {
  24576. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24577. return m_XML_TOK_INVALID
  24578. }
  24579. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24580. case int32(_BT_LEAD3):
  24581. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  24582. return -int32(2)
  24583. }
  24584. if 0 != 0 {
  24585. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24586. return m_XML_TOK_INVALID
  24587. }
  24588. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24589. case int32(_BT_LEAD4):
  24590. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  24591. return -int32(2)
  24592. }
  24593. if 0 != 0 {
  24594. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24595. return m_XML_TOK_INVALID
  24596. }
  24597. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24598. case int32(_BT_NONXML):
  24599. fallthrough
  24600. case int32(_BT_MALFORM):
  24601. fallthrough
  24602. case int32(_BT_TRAIL):
  24603. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24604. return m_XML_TOK_INVALID
  24605. case int32(_BT_AMP):
  24606. tok = _big2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  24607. if tok <= 0 {
  24608. if tok == m_XML_TOK_INVALID {
  24609. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24610. }
  24611. return tok
  24612. }
  24613. case int32(_BT_LT):
  24614. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24615. return m_XML_TOK_INVALID
  24616. default:
  24617. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24618. break
  24619. }
  24620. goto _25
  24621. _25:
  24622. }
  24623. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24624. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24625. return -int32(1)
  24626. }
  24627. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24628. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24629. } else {
  24630. v27 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24631. }
  24632. switch v27 {
  24633. case int32(_BT_S):
  24634. fallthrough
  24635. case int32(_BT_CR):
  24636. fallthrough
  24637. case int32(_BT_LF):
  24638. case int32(_BT_SOL):
  24639. goto sol
  24640. case int32(_BT_GT):
  24641. goto gt
  24642. default:
  24643. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24644. return m_XML_TOK_INVALID
  24645. }
  24646. /* ptr points to closing quote */
  24647. _30:
  24648. ;
  24649. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24650. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24651. return -int32(1)
  24652. }
  24653. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24654. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24655. } else {
  24656. v31 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24657. }
  24658. switch v31 {
  24659. case int32(_BT_NONASCII):
  24660. goto _32
  24661. case int32(_BT_HEX):
  24662. goto _33
  24663. case int32(_BT_NMSTRT):
  24664. goto _34
  24665. case int32(_BT_LEAD2):
  24666. goto _35
  24667. case int32(_BT_LEAD3):
  24668. goto _36
  24669. case int32(_BT_LEAD4):
  24670. goto _37
  24671. case int32(_BT_LF):
  24672. goto _38
  24673. case int32(_BT_CR):
  24674. goto _39
  24675. case int32(_BT_S):
  24676. goto _40
  24677. case int32(_BT_GT):
  24678. goto _41
  24679. case int32(_BT_SOL):
  24680. goto _42
  24681. default:
  24682. goto _43
  24683. }
  24684. goto _44
  24685. _32:
  24686. ;
  24687. 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) {
  24688. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24689. return m_XML_TOK_INVALID
  24690. } /* fall through */
  24691. _34:
  24692. ;
  24693. _33:
  24694. ;
  24695. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24696. goto _44
  24697. _35:
  24698. ;
  24699. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  24700. return -int32(2)
  24701. }
  24702. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24703. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24704. return m_XML_TOK_INVALID
  24705. }
  24706. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24707. goto _44
  24708. _36:
  24709. ;
  24710. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  24711. return -int32(2)
  24712. }
  24713. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24714. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24715. return m_XML_TOK_INVALID
  24716. }
  24717. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24718. goto _44
  24719. _37:
  24720. ;
  24721. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  24722. return -int32(2)
  24723. }
  24724. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24725. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24726. return m_XML_TOK_INVALID
  24727. }
  24728. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24729. goto _44
  24730. _40:
  24731. ;
  24732. _39:
  24733. ;
  24734. _38:
  24735. ;
  24736. goto _29
  24737. _41:
  24738. ;
  24739. goto gt
  24740. gt:
  24741. ;
  24742. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  24743. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  24744. _42:
  24745. ;
  24746. goto sol
  24747. sol:
  24748. ;
  24749. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24750. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24751. return -int32(1)
  24752. }
  24753. 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)) {
  24754. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24755. return m_XML_TOK_INVALID
  24756. }
  24757. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  24758. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  24759. _43:
  24760. ;
  24761. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24762. return m_XML_TOK_INVALID
  24763. _44:
  24764. ;
  24765. goto _28
  24766. goto _29
  24767. _29:
  24768. ;
  24769. goto _30
  24770. goto _28
  24771. _28:
  24772. ;
  24773. goto _17
  24774. _16:
  24775. ;
  24776. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24777. return m_XML_TOK_INVALID
  24778. _17:
  24779. }
  24780. return -int32(1)
  24781. }
  24782. /* ptr points to character following "<" */
  24783. func _big2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24784. var hadColon, v1, v2, v21, v22, v3 int32
  24785. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  24786. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24787. return -int32(1)
  24788. }
  24789. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24790. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24791. } else {
  24792. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24793. }
  24794. switch v1 {
  24795. case int32(_BT_NONASCII):
  24796. 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) {
  24797. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24798. return m_XML_TOK_INVALID
  24799. } /* fall through */
  24800. fallthrough
  24801. case int32(_BT_NMSTRT):
  24802. fallthrough
  24803. case int32(_BT_HEX):
  24804. ptr += uintptr(2)
  24805. case int32(_BT_LEAD2):
  24806. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  24807. return -int32(2)
  24808. }
  24809. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24810. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24811. return m_XML_TOK_INVALID
  24812. }
  24813. ptr += uintptr(2)
  24814. case int32(_BT_LEAD3):
  24815. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  24816. return -int32(2)
  24817. }
  24818. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24819. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24820. return m_XML_TOK_INVALID
  24821. }
  24822. ptr += uintptr(3)
  24823. case int32(_BT_LEAD4):
  24824. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  24825. return -int32(2)
  24826. }
  24827. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24828. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24829. return m_XML_TOK_INVALID
  24830. }
  24831. ptr += uintptr(4)
  24832. case int32(_BT_EXCL):
  24833. ptr += uintptr(2)
  24834. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24835. return -int32(1)
  24836. }
  24837. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24838. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24839. } else {
  24840. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24841. }
  24842. switch v2 {
  24843. case int32(_BT_MINUS):
  24844. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24845. case int32(_BT_LSQB):
  24846. return _big2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24847. }
  24848. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24849. return m_XML_TOK_INVALID
  24850. case int32(_BT_QUEST):
  24851. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24852. case int32(_BT_SOL):
  24853. return _big2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24854. default:
  24855. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24856. return m_XML_TOK_INVALID
  24857. }
  24858. hadColon = 0
  24859. /* we have a start-tag */
  24860. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24861. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24862. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24863. } else {
  24864. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24865. }
  24866. switch v3 {
  24867. case int32(_BT_NONASCII):
  24868. goto _4
  24869. case int32(_BT_MINUS):
  24870. goto _5
  24871. case int32(_BT_NAME):
  24872. goto _6
  24873. case int32(_BT_DIGIT):
  24874. goto _7
  24875. case int32(_BT_HEX):
  24876. goto _8
  24877. case int32(_BT_NMSTRT):
  24878. goto _9
  24879. case int32(_BT_LEAD2):
  24880. goto _10
  24881. case int32(_BT_LEAD3):
  24882. goto _11
  24883. case int32(_BT_LEAD4):
  24884. goto _12
  24885. case int32(_BT_COLON):
  24886. goto _13
  24887. case int32(_BT_LF):
  24888. goto _14
  24889. case int32(_BT_CR):
  24890. goto _15
  24891. case int32(_BT_S):
  24892. goto _16
  24893. case int32(_BT_GT):
  24894. goto _17
  24895. case int32(_BT_SOL):
  24896. goto _18
  24897. default:
  24898. goto _19
  24899. }
  24900. goto _20
  24901. _4:
  24902. ;
  24903. 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) {
  24904. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24905. return m_XML_TOK_INVALID
  24906. } /* fall through */
  24907. _9:
  24908. ;
  24909. _8:
  24910. ;
  24911. _7:
  24912. ;
  24913. _6:
  24914. ;
  24915. _5:
  24916. ;
  24917. ptr += uintptr(2)
  24918. goto _20
  24919. _10:
  24920. ;
  24921. if int64(end)-int64(ptr) < int64(2) {
  24922. return -int32(2)
  24923. }
  24924. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24925. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24926. return m_XML_TOK_INVALID
  24927. }
  24928. ptr += uintptr(2)
  24929. goto _20
  24930. _11:
  24931. ;
  24932. if int64(end)-int64(ptr) < int64(3) {
  24933. return -int32(2)
  24934. }
  24935. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24936. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24937. return m_XML_TOK_INVALID
  24938. }
  24939. ptr += uintptr(3)
  24940. goto _20
  24941. _12:
  24942. ;
  24943. if int64(end)-int64(ptr) < int64(4) {
  24944. return -int32(2)
  24945. }
  24946. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24947. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24948. return m_XML_TOK_INVALID
  24949. }
  24950. ptr += uintptr(4)
  24951. goto _20
  24952. _13:
  24953. ;
  24954. if hadColon != 0 {
  24955. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24956. return m_XML_TOK_INVALID
  24957. }
  24958. hadColon = int32(1)
  24959. ptr += uintptr(2)
  24960. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24961. return -int32(1)
  24962. }
  24963. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24964. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24965. } else {
  24966. v21 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24967. }
  24968. switch v21 {
  24969. case int32(_BT_NONASCII):
  24970. 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) {
  24971. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24972. return m_XML_TOK_INVALID
  24973. } /* fall through */
  24974. fallthrough
  24975. case int32(_BT_NMSTRT):
  24976. fallthrough
  24977. case int32(_BT_HEX):
  24978. ptr += uintptr(2)
  24979. case int32(_BT_LEAD2):
  24980. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  24981. return -int32(2)
  24982. }
  24983. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24984. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24985. return m_XML_TOK_INVALID
  24986. }
  24987. ptr += uintptr(2)
  24988. case int32(_BT_LEAD3):
  24989. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  24990. return -int32(2)
  24991. }
  24992. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24993. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24994. return m_XML_TOK_INVALID
  24995. }
  24996. ptr += uintptr(3)
  24997. case int32(_BT_LEAD4):
  24998. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  24999. return -int32(2)
  25000. }
  25001. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25002. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25003. return m_XML_TOK_INVALID
  25004. }
  25005. ptr += uintptr(4)
  25006. default:
  25007. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25008. return m_XML_TOK_INVALID
  25009. }
  25010. goto _20
  25011. _16:
  25012. ;
  25013. _15:
  25014. ;
  25015. _14:
  25016. ;
  25017. ptr += uintptr(2)
  25018. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25019. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25020. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25021. } else {
  25022. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25023. }
  25024. switch v22 {
  25025. case int32(_BT_NONASCII):
  25026. 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) {
  25027. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25028. return m_XML_TOK_INVALID
  25029. } /* fall through */
  25030. fallthrough
  25031. case int32(_BT_NMSTRT):
  25032. fallthrough
  25033. case int32(_BT_HEX):
  25034. ptr += uintptr(2)
  25035. case int32(_BT_LEAD2):
  25036. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25037. return -int32(2)
  25038. }
  25039. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25040. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25041. return m_XML_TOK_INVALID
  25042. }
  25043. ptr += uintptr(2)
  25044. case int32(_BT_LEAD3):
  25045. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25046. return -int32(2)
  25047. }
  25048. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25049. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25050. return m_XML_TOK_INVALID
  25051. }
  25052. ptr += uintptr(3)
  25053. case int32(_BT_LEAD4):
  25054. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25055. return -int32(2)
  25056. }
  25057. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25058. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25059. return m_XML_TOK_INVALID
  25060. }
  25061. ptr += uintptr(4)
  25062. case int32(_BT_GT):
  25063. goto gt
  25064. case int32(_BT_SOL):
  25065. goto sol
  25066. case int32(_BT_S):
  25067. fallthrough
  25068. case int32(_BT_CR):
  25069. fallthrough
  25070. case int32(_BT_LF):
  25071. ptr += uintptr(2)
  25072. continue
  25073. default:
  25074. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25075. return m_XML_TOK_INVALID
  25076. }
  25077. return _big2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  25078. }
  25079. return -int32(1)
  25080. _17:
  25081. ;
  25082. goto gt
  25083. gt:
  25084. ;
  25085. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25086. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  25087. _18:
  25088. ;
  25089. goto sol
  25090. sol:
  25091. ;
  25092. ptr += uintptr(2)
  25093. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25094. return -int32(1)
  25095. }
  25096. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  25097. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25098. return m_XML_TOK_INVALID
  25099. }
  25100. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25101. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  25102. _19:
  25103. ;
  25104. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25105. return m_XML_TOK_INVALID
  25106. _20:
  25107. }
  25108. return -int32(1)
  25109. }
  25110. func _big2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25111. var n Tsize_t
  25112. var v1, v2, v3 int32
  25113. _, _, _, _ = n, v1, v2, v3
  25114. if ptr >= end {
  25115. return -int32(4)
  25116. }
  25117. if int32(2) > int32(1) {
  25118. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  25119. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  25120. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  25121. if n == uint64(0) {
  25122. return -int32(1)
  25123. }
  25124. end = ptr + uintptr(n)
  25125. }
  25126. }
  25127. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25128. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25129. } else {
  25130. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25131. }
  25132. switch v1 {
  25133. case int32(_BT_LT):
  25134. return _big2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25135. case int32(_BT_AMP):
  25136. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25137. case int32(_BT_CR):
  25138. ptr += uintptr(2)
  25139. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25140. return -int32(3)
  25141. }
  25142. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25143. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25144. } else {
  25145. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25146. }
  25147. if v2 == int32(_BT_LF) {
  25148. ptr += uintptr(2)
  25149. }
  25150. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25151. return int32(m_XML_TOK_DATA_NEWLINE)
  25152. case int32(_BT_LF):
  25153. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25154. return int32(m_XML_TOK_DATA_NEWLINE)
  25155. case int32(_BT_RSQB):
  25156. ptr += uintptr(2)
  25157. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25158. return -int32(5)
  25159. }
  25160. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  25161. break
  25162. }
  25163. ptr += uintptr(2)
  25164. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25165. return -int32(5)
  25166. }
  25167. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  25168. ptr -= uintptr(2)
  25169. break
  25170. }
  25171. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25172. return m_XML_TOK_INVALID
  25173. case int32(_BT_LEAD2):
  25174. if int64(end)-int64(ptr) < int64(2) {
  25175. return -int32(2)
  25176. }
  25177. if 0 != 0 {
  25178. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25179. return m_XML_TOK_INVALID
  25180. }
  25181. ptr += uintptr(2)
  25182. case int32(_BT_LEAD3):
  25183. if int64(end)-int64(ptr) < int64(3) {
  25184. return -int32(2)
  25185. }
  25186. if 0 != 0 {
  25187. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25188. return m_XML_TOK_INVALID
  25189. }
  25190. ptr += uintptr(3)
  25191. case int32(_BT_LEAD4):
  25192. if int64(end)-int64(ptr) < int64(4) {
  25193. return -int32(2)
  25194. }
  25195. if 0 != 0 {
  25196. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25197. return m_XML_TOK_INVALID
  25198. }
  25199. ptr += uintptr(4)
  25200. case int32(_BT_NONXML):
  25201. fallthrough
  25202. case int32(_BT_MALFORM):
  25203. fallthrough
  25204. case int32(_BT_TRAIL):
  25205. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25206. return m_XML_TOK_INVALID
  25207. default:
  25208. ptr += uintptr(2)
  25209. break
  25210. }
  25211. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25212. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25213. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25214. } else {
  25215. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25216. }
  25217. switch v3 {
  25218. case int32(_BT_LEAD2):
  25219. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  25220. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25221. return int32(m_XML_TOK_DATA_CHARS)
  25222. }
  25223. ptr += uintptr(2)
  25224. case int32(_BT_LEAD3):
  25225. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  25226. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25227. return int32(m_XML_TOK_DATA_CHARS)
  25228. }
  25229. ptr += uintptr(3)
  25230. case int32(_BT_LEAD4):
  25231. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  25232. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25233. return int32(m_XML_TOK_DATA_CHARS)
  25234. }
  25235. ptr += uintptr(4)
  25236. case int32(_BT_RSQB):
  25237. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  25238. 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)) {
  25239. ptr += uintptr(2)
  25240. break
  25241. }
  25242. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)) {
  25243. 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)) {
  25244. ptr += uintptr(2)
  25245. break
  25246. }
  25247. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  25248. return m_XML_TOK_INVALID
  25249. }
  25250. }
  25251. /* fall through */
  25252. fallthrough
  25253. case int32(_BT_AMP):
  25254. fallthrough
  25255. case int32(_BT_LT):
  25256. fallthrough
  25257. case int32(_BT_NONXML):
  25258. fallthrough
  25259. case int32(_BT_MALFORM):
  25260. fallthrough
  25261. case int32(_BT_TRAIL):
  25262. fallthrough
  25263. case int32(_BT_CR):
  25264. fallthrough
  25265. case int32(_BT_LF):
  25266. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25267. return int32(m_XML_TOK_DATA_CHARS)
  25268. default:
  25269. ptr += uintptr(2)
  25270. break
  25271. }
  25272. }
  25273. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25274. return int32(m_XML_TOK_DATA_CHARS)
  25275. }
  25276. /* ptr points to character following "%" */
  25277. func _big2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25278. var v1, v2 int32
  25279. _, _ = v1, v2
  25280. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25281. return -int32(1)
  25282. }
  25283. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25284. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25285. } else {
  25286. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25287. }
  25288. switch v1 {
  25289. case int32(_BT_NONASCII):
  25290. 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) {
  25291. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25292. return m_XML_TOK_INVALID
  25293. } /* fall through */
  25294. fallthrough
  25295. case int32(_BT_NMSTRT):
  25296. fallthrough
  25297. case int32(_BT_HEX):
  25298. ptr += uintptr(2)
  25299. case int32(_BT_LEAD2):
  25300. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25301. return -int32(2)
  25302. }
  25303. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25304. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25305. return m_XML_TOK_INVALID
  25306. }
  25307. ptr += uintptr(2)
  25308. case int32(_BT_LEAD3):
  25309. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25310. return -int32(2)
  25311. }
  25312. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25313. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25314. return m_XML_TOK_INVALID
  25315. }
  25316. ptr += uintptr(3)
  25317. case int32(_BT_LEAD4):
  25318. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25319. return -int32(2)
  25320. }
  25321. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25322. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25323. return m_XML_TOK_INVALID
  25324. }
  25325. ptr += uintptr(4)
  25326. case int32(_BT_S):
  25327. fallthrough
  25328. case int32(_BT_LF):
  25329. fallthrough
  25330. case int32(_BT_CR):
  25331. fallthrough
  25332. case int32(_BT_PERCNT):
  25333. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25334. return int32(m_XML_TOK_PERCENT)
  25335. default:
  25336. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25337. return m_XML_TOK_INVALID
  25338. }
  25339. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25340. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25341. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25342. } else {
  25343. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25344. }
  25345. switch v2 {
  25346. case int32(_BT_NONASCII):
  25347. 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) {
  25348. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25349. return m_XML_TOK_INVALID
  25350. } /* fall through */
  25351. fallthrough
  25352. case int32(_BT_NMSTRT):
  25353. fallthrough
  25354. case int32(_BT_HEX):
  25355. fallthrough
  25356. case int32(_BT_DIGIT):
  25357. fallthrough
  25358. case int32(_BT_NAME):
  25359. fallthrough
  25360. case int32(_BT_MINUS):
  25361. ptr += uintptr(2)
  25362. case int32(_BT_LEAD2):
  25363. if int64(end)-int64(ptr) < int64(2) {
  25364. return -int32(2)
  25365. }
  25366. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25367. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25368. return m_XML_TOK_INVALID
  25369. }
  25370. ptr += uintptr(2)
  25371. case int32(_BT_LEAD3):
  25372. if int64(end)-int64(ptr) < int64(3) {
  25373. return -int32(2)
  25374. }
  25375. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25376. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25377. return m_XML_TOK_INVALID
  25378. }
  25379. ptr += uintptr(3)
  25380. case int32(_BT_LEAD4):
  25381. if int64(end)-int64(ptr) < int64(4) {
  25382. return -int32(2)
  25383. }
  25384. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25385. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25386. return m_XML_TOK_INVALID
  25387. }
  25388. ptr += uintptr(4)
  25389. case int32(_BT_SEMI):
  25390. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25391. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  25392. default:
  25393. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25394. return m_XML_TOK_INVALID
  25395. }
  25396. }
  25397. return -int32(1)
  25398. }
  25399. func _big2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25400. var v1, v2 int32
  25401. _, _ = v1, v2
  25402. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25403. return -int32(1)
  25404. }
  25405. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25406. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25407. } else {
  25408. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25409. }
  25410. switch v1 {
  25411. case int32(_BT_NONASCII):
  25412. 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) {
  25413. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25414. return m_XML_TOK_INVALID
  25415. } /* fall through */
  25416. fallthrough
  25417. case int32(_BT_NMSTRT):
  25418. fallthrough
  25419. case int32(_BT_HEX):
  25420. ptr += uintptr(2)
  25421. case int32(_BT_LEAD2):
  25422. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25423. return -int32(2)
  25424. }
  25425. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25426. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25427. return m_XML_TOK_INVALID
  25428. }
  25429. ptr += uintptr(2)
  25430. case int32(_BT_LEAD3):
  25431. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25432. return -int32(2)
  25433. }
  25434. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25435. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25436. return m_XML_TOK_INVALID
  25437. }
  25438. ptr += uintptr(3)
  25439. case int32(_BT_LEAD4):
  25440. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25441. return -int32(2)
  25442. }
  25443. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25444. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25445. return m_XML_TOK_INVALID
  25446. }
  25447. ptr += uintptr(4)
  25448. default:
  25449. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25450. return m_XML_TOK_INVALID
  25451. }
  25452. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25453. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25454. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25455. } else {
  25456. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25457. }
  25458. switch v2 {
  25459. case int32(_BT_NONASCII):
  25460. 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) {
  25461. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25462. return m_XML_TOK_INVALID
  25463. } /* fall through */
  25464. fallthrough
  25465. case int32(_BT_NMSTRT):
  25466. fallthrough
  25467. case int32(_BT_HEX):
  25468. fallthrough
  25469. case int32(_BT_DIGIT):
  25470. fallthrough
  25471. case int32(_BT_NAME):
  25472. fallthrough
  25473. case int32(_BT_MINUS):
  25474. ptr += uintptr(2)
  25475. case int32(_BT_LEAD2):
  25476. if int64(end)-int64(ptr) < int64(2) {
  25477. return -int32(2)
  25478. }
  25479. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25480. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25481. return m_XML_TOK_INVALID
  25482. }
  25483. ptr += uintptr(2)
  25484. case int32(_BT_LEAD3):
  25485. if int64(end)-int64(ptr) < int64(3) {
  25486. return -int32(2)
  25487. }
  25488. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25489. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25490. return m_XML_TOK_INVALID
  25491. }
  25492. ptr += uintptr(3)
  25493. case int32(_BT_LEAD4):
  25494. if int64(end)-int64(ptr) < int64(4) {
  25495. return -int32(2)
  25496. }
  25497. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25498. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25499. return m_XML_TOK_INVALID
  25500. }
  25501. ptr += uintptr(4)
  25502. case int32(_BT_CR):
  25503. fallthrough
  25504. case int32(_BT_LF):
  25505. fallthrough
  25506. case int32(_BT_S):
  25507. fallthrough
  25508. case int32(_BT_RPAR):
  25509. fallthrough
  25510. case int32(_BT_GT):
  25511. fallthrough
  25512. case int32(_BT_PERCNT):
  25513. fallthrough
  25514. case int32(_BT_VERBAR):
  25515. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25516. return int32(m_XML_TOK_POUND_NAME)
  25517. default:
  25518. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25519. return m_XML_TOK_INVALID
  25520. }
  25521. }
  25522. return -int32(m_XML_TOK_POUND_NAME)
  25523. }
  25524. func _big2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25525. var t, v1, v2 int32
  25526. _, _, _ = t, v1, v2
  25527. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25528. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25529. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25530. } else {
  25531. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25532. }
  25533. t = v1
  25534. switch t {
  25535. case int32(_BT_LEAD2):
  25536. if int64(end)-int64(ptr) < int64(2) {
  25537. return -int32(2)
  25538. }
  25539. if 0 != 0 {
  25540. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25541. return m_XML_TOK_INVALID
  25542. }
  25543. ptr += uintptr(2)
  25544. case int32(_BT_LEAD3):
  25545. if int64(end)-int64(ptr) < int64(3) {
  25546. return -int32(2)
  25547. }
  25548. if 0 != 0 {
  25549. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25550. return m_XML_TOK_INVALID
  25551. }
  25552. ptr += uintptr(3)
  25553. case int32(_BT_LEAD4):
  25554. if int64(end)-int64(ptr) < int64(4) {
  25555. return -int32(2)
  25556. }
  25557. if 0 != 0 {
  25558. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25559. return m_XML_TOK_INVALID
  25560. }
  25561. ptr += uintptr(4)
  25562. case int32(_BT_NONXML):
  25563. fallthrough
  25564. case int32(_BT_MALFORM):
  25565. fallthrough
  25566. case int32(_BT_TRAIL):
  25567. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25568. return m_XML_TOK_INVALID
  25569. case int32(_BT_QUOT):
  25570. fallthrough
  25571. case int32(_BT_APOS):
  25572. ptr += uintptr(2)
  25573. if t != open {
  25574. break
  25575. }
  25576. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25577. return -int32(m_XML_TOK_LITERAL)
  25578. }
  25579. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25580. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25581. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25582. } else {
  25583. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25584. }
  25585. switch v2 {
  25586. case int32(_BT_S):
  25587. fallthrough
  25588. case int32(_BT_CR):
  25589. fallthrough
  25590. case int32(_BT_LF):
  25591. fallthrough
  25592. case int32(_BT_GT):
  25593. fallthrough
  25594. case int32(_BT_PERCNT):
  25595. fallthrough
  25596. case int32(_BT_LSQB):
  25597. return int32(m_XML_TOK_LITERAL)
  25598. default:
  25599. return m_XML_TOK_INVALID
  25600. }
  25601. fallthrough
  25602. default:
  25603. ptr += uintptr(2)
  25604. break
  25605. }
  25606. }
  25607. return -int32(1)
  25608. }
  25609. func _big2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25610. var n Tsize_t
  25611. var tok, v1, v29, v33, v34, v35, v36 int32
  25612. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  25613. if ptr >= end {
  25614. return -int32(4)
  25615. }
  25616. if int32(2) > int32(1) {
  25617. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  25618. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  25619. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  25620. if n == uint64(0) {
  25621. return -int32(1)
  25622. }
  25623. end = ptr + uintptr(n)
  25624. }
  25625. }
  25626. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25627. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25628. } else {
  25629. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25630. }
  25631. switch v1 {
  25632. case int32(_BT_QUOT):
  25633. goto _2
  25634. case int32(_BT_APOS):
  25635. goto _3
  25636. case int32(_BT_LT):
  25637. goto _4
  25638. case int32(_BT_CR):
  25639. goto _5
  25640. case int32(_BT_LF):
  25641. goto _6
  25642. case int32(_BT_S):
  25643. goto _7
  25644. case int32(_BT_PERCNT):
  25645. goto _8
  25646. case int32(_BT_COMMA):
  25647. goto _9
  25648. case int32(_BT_LSQB):
  25649. goto _10
  25650. case int32(_BT_RSQB):
  25651. goto _11
  25652. case int32(_BT_LPAR):
  25653. goto _12
  25654. case int32(_BT_RPAR):
  25655. goto _13
  25656. case int32(_BT_VERBAR):
  25657. goto _14
  25658. case int32(_BT_GT):
  25659. goto _15
  25660. case int32(_BT_NUM):
  25661. goto _16
  25662. case int32(_BT_LEAD2):
  25663. goto _17
  25664. case int32(_BT_LEAD3):
  25665. goto _18
  25666. case int32(_BT_LEAD4):
  25667. goto _19
  25668. case int32(_BT_HEX):
  25669. goto _20
  25670. case int32(_BT_NMSTRT):
  25671. goto _21
  25672. case int32(_BT_COLON):
  25673. goto _22
  25674. case int32(_BT_MINUS):
  25675. goto _23
  25676. case int32(_BT_NAME):
  25677. goto _24
  25678. case int32(_BT_DIGIT):
  25679. goto _25
  25680. case int32(_BT_NONASCII):
  25681. goto _26
  25682. default:
  25683. goto _27
  25684. }
  25685. goto _28
  25686. _2:
  25687. ;
  25688. return _big2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  25689. _3:
  25690. ;
  25691. return _big2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  25692. _4:
  25693. ;
  25694. ptr += uintptr(2)
  25695. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25696. return -int32(1)
  25697. }
  25698. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25699. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25700. } else {
  25701. v29 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25702. }
  25703. switch v29 {
  25704. case int32(_BT_EXCL):
  25705. return _big2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25706. case int32(_BT_QUEST):
  25707. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25708. case int32(_BT_NMSTRT):
  25709. fallthrough
  25710. case int32(_BT_HEX):
  25711. fallthrough
  25712. case int32(_BT_NONASCII):
  25713. fallthrough
  25714. case int32(_BT_LEAD2):
  25715. fallthrough
  25716. case int32(_BT_LEAD3):
  25717. fallthrough
  25718. case int32(_BT_LEAD4):
  25719. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  25720. return int32(m_XML_TOK_INSTANCE_START)
  25721. }
  25722. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25723. return m_XML_TOK_INVALID
  25724. _5:
  25725. ;
  25726. if ptr+uintptr(2) == end {
  25727. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  25728. /* indicate that this might be part of a CR/LF pair */
  25729. return -int32(m_XML_TOK_PROLOG_S)
  25730. }
  25731. /* fall through */
  25732. _7:
  25733. ;
  25734. _6:
  25735. ;
  25736. _32:
  25737. ;
  25738. ptr += uintptr(2)
  25739. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25740. goto _30
  25741. }
  25742. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25743. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25744. } else {
  25745. v33 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25746. }
  25747. switch v33 {
  25748. case int32(_BT_S):
  25749. fallthrough
  25750. case int32(_BT_LF):
  25751. case int32(_BT_CR):
  25752. /* don't split CR/LF pair */
  25753. if ptr+uintptr(2) != end {
  25754. break
  25755. }
  25756. /* fall through */
  25757. fallthrough
  25758. default:
  25759. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25760. return int32(m_XML_TOK_PROLOG_S)
  25761. }
  25762. goto _31
  25763. _31:
  25764. ;
  25765. goto _32
  25766. goto _30
  25767. _30:
  25768. ;
  25769. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25770. return int32(m_XML_TOK_PROLOG_S)
  25771. _8:
  25772. ;
  25773. return _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25774. _9:
  25775. ;
  25776. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25777. return int32(m_XML_TOK_COMMA)
  25778. _10:
  25779. ;
  25780. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25781. return int32(m_XML_TOK_OPEN_BRACKET)
  25782. _11:
  25783. ;
  25784. ptr += uintptr(2)
  25785. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25786. return -int32(m_XML_TOK_CLOSE_BRACKET)
  25787. }
  25788. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  25789. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  25790. return -int32(1)
  25791. }
  25792. 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) {
  25793. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  25794. return int32(m_XML_TOK_COND_SECT_CLOSE)
  25795. }
  25796. }
  25797. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25798. return int32(m_XML_TOK_CLOSE_BRACKET)
  25799. _12:
  25800. ;
  25801. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25802. return int32(m_XML_TOK_OPEN_PAREN)
  25803. _13:
  25804. ;
  25805. ptr += uintptr(2)
  25806. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25807. return -int32(m_XML_TOK_CLOSE_PAREN)
  25808. }
  25809. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25810. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25811. } else {
  25812. v34 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25813. }
  25814. switch v34 {
  25815. case int32(_BT_AST):
  25816. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25817. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  25818. case int32(_BT_QUEST):
  25819. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25820. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  25821. case int32(_BT_PLUS):
  25822. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25823. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  25824. case int32(_BT_CR):
  25825. fallthrough
  25826. case int32(_BT_LF):
  25827. fallthrough
  25828. case int32(_BT_S):
  25829. fallthrough
  25830. case int32(_BT_GT):
  25831. fallthrough
  25832. case int32(_BT_COMMA):
  25833. fallthrough
  25834. case int32(_BT_VERBAR):
  25835. fallthrough
  25836. case int32(_BT_RPAR):
  25837. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25838. return int32(m_XML_TOK_CLOSE_PAREN)
  25839. }
  25840. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25841. return m_XML_TOK_INVALID
  25842. _14:
  25843. ;
  25844. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25845. return int32(m_XML_TOK_OR)
  25846. _15:
  25847. ;
  25848. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25849. return int32(m_XML_TOK_DECL_CLOSE)
  25850. _16:
  25851. ;
  25852. return _big2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25853. _17:
  25854. ;
  25855. if int64(end)-int64(ptr) < int64(2) {
  25856. return -int32(2)
  25857. }
  25858. if 0 != 0 {
  25859. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25860. return m_XML_TOK_INVALID
  25861. }
  25862. if 0 != 0 {
  25863. ptr += uintptr(2)
  25864. tok = int32(m_XML_TOK_NAME)
  25865. goto _28
  25866. }
  25867. if 0 != 0 {
  25868. ptr += uintptr(2)
  25869. tok = int32(m_XML_TOK_NMTOKEN)
  25870. goto _28
  25871. }
  25872. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25873. return m_XML_TOK_INVALID
  25874. _18:
  25875. ;
  25876. if int64(end)-int64(ptr) < int64(3) {
  25877. return -int32(2)
  25878. }
  25879. if 0 != 0 {
  25880. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25881. return m_XML_TOK_INVALID
  25882. }
  25883. if 0 != 0 {
  25884. ptr += uintptr(3)
  25885. tok = int32(m_XML_TOK_NAME)
  25886. goto _28
  25887. }
  25888. if 0 != 0 {
  25889. ptr += uintptr(3)
  25890. tok = int32(m_XML_TOK_NMTOKEN)
  25891. goto _28
  25892. }
  25893. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25894. return m_XML_TOK_INVALID
  25895. _19:
  25896. ;
  25897. if int64(end)-int64(ptr) < int64(4) {
  25898. return -int32(2)
  25899. }
  25900. if 0 != 0 {
  25901. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25902. return m_XML_TOK_INVALID
  25903. }
  25904. if 0 != 0 {
  25905. ptr += uintptr(4)
  25906. tok = int32(m_XML_TOK_NAME)
  25907. goto _28
  25908. }
  25909. if 0 != 0 {
  25910. ptr += uintptr(4)
  25911. tok = int32(m_XML_TOK_NMTOKEN)
  25912. goto _28
  25913. }
  25914. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25915. return m_XML_TOK_INVALID
  25916. _21:
  25917. ;
  25918. _20:
  25919. ;
  25920. tok = int32(m_XML_TOK_NAME)
  25921. ptr += uintptr(2)
  25922. goto _28
  25923. _25:
  25924. ;
  25925. _24:
  25926. ;
  25927. _23:
  25928. ;
  25929. _22:
  25930. ;
  25931. tok = int32(m_XML_TOK_NMTOKEN)
  25932. ptr += uintptr(2)
  25933. goto _28
  25934. _26:
  25935. ;
  25936. 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 {
  25937. ptr += uintptr(2)
  25938. tok = int32(m_XML_TOK_NAME)
  25939. goto _28
  25940. }
  25941. 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 {
  25942. ptr += uintptr(2)
  25943. tok = int32(m_XML_TOK_NMTOKEN)
  25944. goto _28
  25945. }
  25946. /* fall through */
  25947. _27:
  25948. ;
  25949. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25950. return m_XML_TOK_INVALID
  25951. _28:
  25952. ;
  25953. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25954. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25955. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25956. } else {
  25957. v35 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25958. }
  25959. switch v35 {
  25960. case int32(_BT_NONASCII):
  25961. 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) {
  25962. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25963. return m_XML_TOK_INVALID
  25964. } /* fall through */
  25965. fallthrough
  25966. case int32(_BT_NMSTRT):
  25967. fallthrough
  25968. case int32(_BT_HEX):
  25969. fallthrough
  25970. case int32(_BT_DIGIT):
  25971. fallthrough
  25972. case int32(_BT_NAME):
  25973. fallthrough
  25974. case int32(_BT_MINUS):
  25975. ptr += uintptr(2)
  25976. case int32(_BT_LEAD2):
  25977. if int64(end)-int64(ptr) < int64(2) {
  25978. return -int32(2)
  25979. }
  25980. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25981. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25982. return m_XML_TOK_INVALID
  25983. }
  25984. ptr += uintptr(2)
  25985. case int32(_BT_LEAD3):
  25986. if int64(end)-int64(ptr) < int64(3) {
  25987. return -int32(2)
  25988. }
  25989. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25990. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25991. return m_XML_TOK_INVALID
  25992. }
  25993. ptr += uintptr(3)
  25994. case int32(_BT_LEAD4):
  25995. if int64(end)-int64(ptr) < int64(4) {
  25996. return -int32(2)
  25997. }
  25998. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25999. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26000. return m_XML_TOK_INVALID
  26001. }
  26002. ptr += uintptr(4)
  26003. case int32(_BT_GT):
  26004. fallthrough
  26005. case int32(_BT_RPAR):
  26006. fallthrough
  26007. case int32(_BT_COMMA):
  26008. fallthrough
  26009. case int32(_BT_VERBAR):
  26010. fallthrough
  26011. case int32(_BT_LSQB):
  26012. fallthrough
  26013. case int32(_BT_PERCNT):
  26014. fallthrough
  26015. case int32(_BT_S):
  26016. fallthrough
  26017. case int32(_BT_CR):
  26018. fallthrough
  26019. case int32(_BT_LF):
  26020. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26021. return tok
  26022. case int32(_BT_COLON):
  26023. ptr += uintptr(2)
  26024. switch tok {
  26025. case int32(m_XML_TOK_NAME):
  26026. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26027. return -int32(1)
  26028. }
  26029. tok = int32(m_XML_TOK_PREFIXED_NAME)
  26030. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26031. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26032. } else {
  26033. v36 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26034. }
  26035. switch v36 {
  26036. case int32(_BT_NONASCII):
  26037. 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) {
  26038. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26039. return m_XML_TOK_INVALID
  26040. } /* fall through */
  26041. fallthrough
  26042. case int32(_BT_NMSTRT):
  26043. fallthrough
  26044. case int32(_BT_HEX):
  26045. fallthrough
  26046. case int32(_BT_DIGIT):
  26047. fallthrough
  26048. case int32(_BT_NAME):
  26049. fallthrough
  26050. case int32(_BT_MINUS):
  26051. ptr += uintptr(2)
  26052. case int32(_BT_LEAD2):
  26053. if int64(end)-int64(ptr) < int64(2) {
  26054. return -int32(2)
  26055. }
  26056. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26057. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26058. return m_XML_TOK_INVALID
  26059. }
  26060. ptr += uintptr(2)
  26061. case int32(_BT_LEAD3):
  26062. if int64(end)-int64(ptr) < int64(3) {
  26063. return -int32(2)
  26064. }
  26065. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26066. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26067. return m_XML_TOK_INVALID
  26068. }
  26069. ptr += uintptr(3)
  26070. case int32(_BT_LEAD4):
  26071. if int64(end)-int64(ptr) < int64(4) {
  26072. return -int32(2)
  26073. }
  26074. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26075. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26076. return m_XML_TOK_INVALID
  26077. }
  26078. ptr += uintptr(4)
  26079. default:
  26080. tok = int32(m_XML_TOK_NMTOKEN)
  26081. break
  26082. }
  26083. case int32(m_XML_TOK_PREFIXED_NAME):
  26084. tok = int32(m_XML_TOK_NMTOKEN)
  26085. break
  26086. }
  26087. case int32(_BT_PLUS):
  26088. if tok == int32(m_XML_TOK_NMTOKEN) {
  26089. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26090. return m_XML_TOK_INVALID
  26091. }
  26092. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26093. return int32(m_XML_TOK_NAME_PLUS)
  26094. case int32(_BT_AST):
  26095. if tok == int32(m_XML_TOK_NMTOKEN) {
  26096. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26097. return m_XML_TOK_INVALID
  26098. }
  26099. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26100. return int32(m_XML_TOK_NAME_ASTERISK)
  26101. case int32(_BT_QUEST):
  26102. if tok == int32(m_XML_TOK_NMTOKEN) {
  26103. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26104. return m_XML_TOK_INVALID
  26105. }
  26106. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26107. return int32(m_XML_TOK_NAME_QUESTION)
  26108. default:
  26109. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26110. return m_XML_TOK_INVALID
  26111. }
  26112. }
  26113. return -tok
  26114. }
  26115. func _big2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26116. var start uintptr
  26117. var v1, v2 int32
  26118. _, _, _ = start, v1, v2
  26119. if ptr >= end {
  26120. return -int32(4)
  26121. } else {
  26122. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26123. /* This line cannot be executed. The incoming data has already
  26124. * been tokenized once, so incomplete characters like this have
  26125. * already been eliminated from the input. Retaining the paranoia
  26126. * check is still valuable, however.
  26127. */
  26128. return -int32(1) /* LCOV_EXCL_LINE */
  26129. }
  26130. }
  26131. start = ptr
  26132. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26133. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26134. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26135. } else {
  26136. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26137. }
  26138. switch v1 {
  26139. case int32(_BT_LEAD2):
  26140. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26141. case int32(_BT_LEAD3):
  26142. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26143. case int32(_BT_LEAD4):
  26144. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26145. case int32(_BT_AMP):
  26146. if ptr == start {
  26147. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26148. }
  26149. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26150. return int32(m_XML_TOK_DATA_CHARS)
  26151. case int32(_BT_LT):
  26152. /* this is for inside entity references */
  26153. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26154. return m_XML_TOK_INVALID
  26155. case int32(_BT_LF):
  26156. if ptr == start {
  26157. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26158. return int32(m_XML_TOK_DATA_NEWLINE)
  26159. }
  26160. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26161. return int32(m_XML_TOK_DATA_CHARS)
  26162. case int32(_BT_CR):
  26163. if ptr == start {
  26164. ptr += uintptr(2)
  26165. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26166. return -int32(3)
  26167. }
  26168. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26169. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26170. } else {
  26171. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26172. }
  26173. if v2 == int32(_BT_LF) {
  26174. ptr += uintptr(2)
  26175. }
  26176. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26177. return int32(m_XML_TOK_DATA_NEWLINE)
  26178. }
  26179. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26180. return int32(m_XML_TOK_DATA_CHARS)
  26181. case int32(_BT_S):
  26182. if ptr == start {
  26183. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26184. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  26185. }
  26186. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26187. return int32(m_XML_TOK_DATA_CHARS)
  26188. default:
  26189. ptr += uintptr(2)
  26190. break
  26191. }
  26192. }
  26193. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26194. return int32(m_XML_TOK_DATA_CHARS)
  26195. }
  26196. func _big2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26197. var start uintptr
  26198. var tok, v1, v2, v3 int32
  26199. _, _, _, _, _ = start, tok, v1, v2, v3
  26200. if ptr >= end {
  26201. return -int32(4)
  26202. } else {
  26203. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26204. /* This line cannot be executed. The incoming data has already
  26205. * been tokenized once, so incomplete characters like this have
  26206. * already been eliminated from the input. Retaining the paranoia
  26207. * check is still valuable, however.
  26208. */
  26209. return -int32(1) /* LCOV_EXCL_LINE */
  26210. }
  26211. }
  26212. start = ptr
  26213. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26214. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26215. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26216. } else {
  26217. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26218. }
  26219. switch v1 {
  26220. case int32(_BT_LEAD2):
  26221. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26222. case int32(_BT_LEAD3):
  26223. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26224. case int32(_BT_LEAD4):
  26225. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26226. case int32(_BT_AMP):
  26227. if ptr == start {
  26228. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26229. }
  26230. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26231. return int32(m_XML_TOK_DATA_CHARS)
  26232. case int32(_BT_PERCNT):
  26233. if ptr == start {
  26234. tok = _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26235. if tok == int32(m_XML_TOK_PERCENT) {
  26236. v2 = m_XML_TOK_INVALID
  26237. } else {
  26238. v2 = tok
  26239. }
  26240. return v2
  26241. }
  26242. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26243. return int32(m_XML_TOK_DATA_CHARS)
  26244. case int32(_BT_LF):
  26245. if ptr == start {
  26246. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26247. return int32(m_XML_TOK_DATA_NEWLINE)
  26248. }
  26249. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26250. return int32(m_XML_TOK_DATA_CHARS)
  26251. case int32(_BT_CR):
  26252. if ptr == start {
  26253. ptr += uintptr(2)
  26254. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26255. return -int32(3)
  26256. }
  26257. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26258. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26259. } else {
  26260. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26261. }
  26262. if v3 == int32(_BT_LF) {
  26263. ptr += uintptr(2)
  26264. }
  26265. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26266. return int32(m_XML_TOK_DATA_NEWLINE)
  26267. }
  26268. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26269. return int32(m_XML_TOK_DATA_CHARS)
  26270. default:
  26271. ptr += uintptr(2)
  26272. break
  26273. }
  26274. }
  26275. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26276. return int32(m_XML_TOK_DATA_CHARS)
  26277. }
  26278. func _big2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26279. var level, v1 int32
  26280. var n Tsize_t
  26281. _, _, _ = level, n, v1
  26282. level = 0
  26283. if int32(2) > int32(1) {
  26284. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  26285. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  26286. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  26287. end = ptr + uintptr(n)
  26288. }
  26289. }
  26290. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26291. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26292. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26293. } else {
  26294. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26295. }
  26296. switch v1 {
  26297. case int32(_BT_LEAD2):
  26298. if int64(end)-int64(ptr) < int64(2) {
  26299. return -int32(2)
  26300. }
  26301. if 0 != 0 {
  26302. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26303. return m_XML_TOK_INVALID
  26304. }
  26305. ptr += uintptr(2)
  26306. case int32(_BT_LEAD3):
  26307. if int64(end)-int64(ptr) < int64(3) {
  26308. return -int32(2)
  26309. }
  26310. if 0 != 0 {
  26311. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26312. return m_XML_TOK_INVALID
  26313. }
  26314. ptr += uintptr(3)
  26315. case int32(_BT_LEAD4):
  26316. if int64(end)-int64(ptr) < int64(4) {
  26317. return -int32(2)
  26318. }
  26319. if 0 != 0 {
  26320. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26321. return m_XML_TOK_INVALID
  26322. }
  26323. ptr += uintptr(4)
  26324. case int32(_BT_NONXML):
  26325. fallthrough
  26326. case int32(_BT_MALFORM):
  26327. fallthrough
  26328. case int32(_BT_TRAIL):
  26329. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26330. return m_XML_TOK_INVALID
  26331. case int32(_BT_LT):
  26332. ptr += uintptr(2)
  26333. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26334. return -int32(1)
  26335. }
  26336. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_EXCL2) {
  26337. ptr += uintptr(2)
  26338. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26339. return -int32(1)
  26340. }
  26341. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_LSQB1) {
  26342. level++
  26343. ptr += uintptr(2)
  26344. }
  26345. }
  26346. case int32(_BT_RSQB):
  26347. ptr += uintptr(2)
  26348. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26349. return -int32(1)
  26350. }
  26351. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  26352. ptr += uintptr(2)
  26353. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26354. return -int32(1)
  26355. }
  26356. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  26357. ptr += uintptr(2)
  26358. if level == 0 {
  26359. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26360. return int32(m_XML_TOK_IGNORE_SECT)
  26361. }
  26362. level--
  26363. }
  26364. }
  26365. default:
  26366. ptr += uintptr(2)
  26367. break
  26368. }
  26369. }
  26370. return -int32(1)
  26371. }
  26372. func _big2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  26373. var v2, v3, v4 int32
  26374. _, _, _ = v2, v3, v4
  26375. ptr += uintptr(2)
  26376. end -= uintptr(2)
  26377. for {
  26378. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26379. break
  26380. }
  26381. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26382. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26383. } else {
  26384. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26385. }
  26386. switch v2 {
  26387. case int32(_BT_DIGIT):
  26388. fallthrough
  26389. case int32(_BT_HEX):
  26390. fallthrough
  26391. case int32(_BT_MINUS):
  26392. fallthrough
  26393. case int32(_BT_APOS):
  26394. fallthrough
  26395. case int32(_BT_LPAR):
  26396. fallthrough
  26397. case int32(_BT_RPAR):
  26398. fallthrough
  26399. case int32(_BT_PLUS):
  26400. fallthrough
  26401. case int32(_BT_COMMA):
  26402. fallthrough
  26403. case int32(_BT_SOL):
  26404. fallthrough
  26405. case int32(_BT_EQUALS):
  26406. fallthrough
  26407. case int32(_BT_QUEST):
  26408. fallthrough
  26409. case int32(_BT_CR):
  26410. fallthrough
  26411. case int32(_BT_LF):
  26412. fallthrough
  26413. case int32(_BT_SEMI):
  26414. fallthrough
  26415. case int32(_BT_EXCL):
  26416. fallthrough
  26417. case int32(_BT_AST):
  26418. fallthrough
  26419. case int32(_BT_PERCNT):
  26420. fallthrough
  26421. case int32(_BT_NUM):
  26422. fallthrough
  26423. case int32(_BT_COLON):
  26424. case int32(_BT_S):
  26425. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_TAB1) {
  26426. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  26427. return 0
  26428. }
  26429. case int32(_BT_NAME):
  26430. fallthrough
  26431. case int32(_BT_NMSTRT):
  26432. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26433. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26434. } else {
  26435. v3 = -int32(1)
  26436. }
  26437. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  26438. break
  26439. }
  26440. /* fall through */
  26441. fallthrough
  26442. default:
  26443. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26444. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26445. } else {
  26446. v4 = -int32(1)
  26447. }
  26448. switch v4 {
  26449. case int32(0x24): /* $ */
  26450. fallthrough
  26451. case int32(0x40): /* @ */
  26452. default:
  26453. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  26454. return 0
  26455. }
  26456. break
  26457. }
  26458. goto _1
  26459. _1:
  26460. ;
  26461. ptr += uintptr(2)
  26462. }
  26463. return int32(1)
  26464. }
  26465. /* This must only be called for a well-formed start-tag or empty
  26466. element tag. Returns the number of attributes. Pointers to the
  26467. first attsMax attributes are stored in atts.
  26468. */
  26469. func _big2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  26470. var nAtts, open, state, v2, v3, v5, v7 int32
  26471. var v4, v6, v8, v9 bool
  26472. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  26473. state = 1
  26474. nAtts = 0
  26475. open = 0 /* defined when state == inValue;
  26476. initialization just to shut up compilers */
  26477. ptr += uintptr(2)
  26478. for {
  26479. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26480. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26481. } else {
  26482. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26483. }
  26484. switch v2 {
  26485. case int32(_BT_LEAD2):
  26486. if state == 0 {
  26487. if nAtts < attsMax {
  26488. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26489. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  26490. }
  26491. state = 1
  26492. }
  26493. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  26494. case int32(_BT_LEAD3):
  26495. if state == 0 {
  26496. if nAtts < attsMax {
  26497. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26498. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  26499. }
  26500. state = 1
  26501. }
  26502. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  26503. case int32(_BT_LEAD4):
  26504. if state == 0 {
  26505. if nAtts < attsMax {
  26506. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26507. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  26508. }
  26509. state = 1
  26510. }
  26511. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  26512. case int32(_BT_NONASCII):
  26513. fallthrough
  26514. case int32(_BT_NMSTRT):
  26515. fallthrough
  26516. case int32(_BT_HEX):
  26517. if state == 0 {
  26518. if nAtts < attsMax {
  26519. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26520. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  26521. }
  26522. state = 1
  26523. }
  26524. case int32(_BT_QUOT):
  26525. if state != 2 {
  26526. if nAtts < attsMax {
  26527. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  26528. }
  26529. state = 2
  26530. open = int32(_BT_QUOT)
  26531. } else {
  26532. if open == int32(_BT_QUOT) {
  26533. state = 0
  26534. if nAtts < attsMax {
  26535. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  26536. }
  26537. nAtts++
  26538. }
  26539. }
  26540. case int32(_BT_APOS):
  26541. if state != 2 {
  26542. if nAtts < attsMax {
  26543. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  26544. }
  26545. state = 2
  26546. open = int32(_BT_APOS)
  26547. } else {
  26548. if open == int32(_BT_APOS) {
  26549. state = 0
  26550. if nAtts < attsMax {
  26551. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  26552. }
  26553. nAtts++
  26554. }
  26555. }
  26556. case int32(_BT_AMP):
  26557. if nAtts < attsMax {
  26558. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  26559. }
  26560. case int32(_BT_S):
  26561. if state == 1 {
  26562. state = 0
  26563. } else {
  26564. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0; v9 {
  26565. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr; !v4 {
  26566. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26567. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26568. } else {
  26569. v3 = -int32(1)
  26570. }
  26571. }
  26572. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  26573. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  26574. v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  26575. } else {
  26576. v5 = -int32(1)
  26577. }
  26578. }
  26579. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  26580. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  26581. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))))))
  26582. } else {
  26583. v7 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  26584. }
  26585. }
  26586. }
  26587. if v9 && (v8 || v7 == open) {
  26588. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  26589. }
  26590. }
  26591. case int32(_BT_CR):
  26592. fallthrough
  26593. case int32(_BT_LF):
  26594. /* This case ensures that the first attribute name is counted
  26595. Apart from that we could just change state on the quote. */
  26596. if state == 1 {
  26597. state = 0
  26598. } else {
  26599. if state == 2 && nAtts < attsMax {
  26600. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  26601. }
  26602. }
  26603. case int32(_BT_GT):
  26604. fallthrough
  26605. case int32(_BT_SOL):
  26606. if state != 2 {
  26607. return nAtts
  26608. }
  26609. default:
  26610. break
  26611. }
  26612. goto _1
  26613. _1:
  26614. ;
  26615. ptr += uintptr(2)
  26616. }
  26617. /* not reached */
  26618. return r
  26619. }
  26620. func _big2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  26621. var c, c1, result, v2, v4 int32
  26622. _, _, _, _, _ = c, c1, result, v2, v4
  26623. result = 0
  26624. /* skip &# */
  26625. _ = enc
  26626. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  26627. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x2) {
  26628. ptr += uintptr(2)
  26629. for {
  26630. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  26631. break
  26632. }
  26633. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26634. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26635. } else {
  26636. v2 = -int32(1)
  26637. }
  26638. c = v2
  26639. switch c {
  26640. case int32(m_ASCII_02):
  26641. fallthrough
  26642. case int32(m_ASCII_12):
  26643. fallthrough
  26644. case int32(m_ASCII_22):
  26645. fallthrough
  26646. case int32(m_ASCII_32):
  26647. fallthrough
  26648. case int32(m_ASCII_41):
  26649. fallthrough
  26650. case int32(m_ASCII_51):
  26651. fallthrough
  26652. case int32(m_ASCII_61):
  26653. fallthrough
  26654. case int32(m_ASCII_71):
  26655. fallthrough
  26656. case int32(m_ASCII_82):
  26657. fallthrough
  26658. case int32(m_ASCII_92):
  26659. result <<= int32(4)
  26660. result |= c - int32(m_ASCII_02)
  26661. case int32(m_ASCII_A):
  26662. fallthrough
  26663. case int32(m_ASCII_B1):
  26664. fallthrough
  26665. case int32(m_ASCII_C):
  26666. fallthrough
  26667. case int32(m_ASCII_D):
  26668. fallthrough
  26669. case int32(m_ASCII_E):
  26670. fallthrough
  26671. case int32(m_ASCII_F):
  26672. result <<= int32(4)
  26673. result += int32(10) + (c - int32(m_ASCII_A))
  26674. case int32(m_ASCII_a2):
  26675. fallthrough
  26676. case int32(m_ASCII_b1):
  26677. fallthrough
  26678. case int32(m_ASCII_c2):
  26679. fallthrough
  26680. case int32(m_ASCII_d1):
  26681. fallthrough
  26682. case int32(m_ASCII_e2):
  26683. fallthrough
  26684. case int32(m_ASCII_f1):
  26685. result <<= int32(4)
  26686. result += int32(10) + (c - int32(m_ASCII_a2))
  26687. break
  26688. }
  26689. if result >= int32(0x110000) {
  26690. return -int32(1)
  26691. }
  26692. goto _1
  26693. _1:
  26694. ;
  26695. ptr += uintptr(2)
  26696. }
  26697. } else {
  26698. for {
  26699. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  26700. break
  26701. }
  26702. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26703. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26704. } else {
  26705. v4 = -int32(1)
  26706. }
  26707. c1 = v4
  26708. result *= int32(10)
  26709. result += c1 - int32(m_ASCII_02)
  26710. if result >= int32(0x110000) {
  26711. return -int32(1)
  26712. }
  26713. goto _3
  26714. _3:
  26715. ;
  26716. ptr += uintptr(2)
  26717. }
  26718. }
  26719. return _checkCharRefNumber(tls, result)
  26720. }
  26721. func _big2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  26722. var v1, v2 int32
  26723. _, _ = v1, v2
  26724. _ = enc
  26725. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(2) {
  26726. case int64(2):
  26727. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_t2) {
  26728. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26729. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26730. } else {
  26731. v1 = -int32(1)
  26732. }
  26733. switch v1 {
  26734. case int32(m_ASCII_l2):
  26735. return int32(m_ASCII_LT1)
  26736. case int32(m_ASCII_g2):
  26737. return int32(m_ASCII_GT1)
  26738. }
  26739. }
  26740. case int64(3):
  26741. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_a2) {
  26742. ptr += uintptr(2)
  26743. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_m2) {
  26744. ptr += uintptr(2)
  26745. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p2) {
  26746. return int32(m_ASCII_AMP1)
  26747. }
  26748. }
  26749. }
  26750. case int64(4):
  26751. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26752. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26753. } else {
  26754. v2 = -int32(1)
  26755. }
  26756. switch v2 {
  26757. case int32(m_ASCII_q1):
  26758. ptr += uintptr(2)
  26759. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_u1) {
  26760. ptr += uintptr(2)
  26761. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o2) {
  26762. ptr += uintptr(2)
  26763. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_t2) {
  26764. return int32(m_ASCII_QUOT1)
  26765. }
  26766. }
  26767. }
  26768. case int32(m_ASCII_a2):
  26769. ptr += uintptr(2)
  26770. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p2) {
  26771. ptr += uintptr(2)
  26772. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o2) {
  26773. ptr += uintptr(2)
  26774. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_s2) {
  26775. return int32(m_ASCII_APOS1)
  26776. }
  26777. }
  26778. }
  26779. break
  26780. }
  26781. }
  26782. return 0
  26783. }
  26784. func _big2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  26785. _ = enc
  26786. for {
  26787. if !(*(*uint8)(unsafe.Pointer(ptr2)) != 0) {
  26788. break
  26789. }
  26790. if int64(end1)-int64(ptr1) < int64(2) {
  26791. /* This line cannot be executed. The incoming data has already
  26792. * been tokenized once, so incomplete characters like this have
  26793. * already been eliminated from the input. Retaining the
  26794. * paranoia check is still valuable, however.
  26795. */
  26796. return 0 /* LCOV_EXCL_LINE */
  26797. }
  26798. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1 + 1))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr2)))) {
  26799. return 0
  26800. }
  26801. goto _1
  26802. _1:
  26803. ;
  26804. ptr1 += uintptr(2)
  26805. ptr2++
  26806. }
  26807. return libc.BoolInt32(ptr1 == end1)
  26808. }
  26809. func _big2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  26810. var start uintptr
  26811. var v2 int32
  26812. _, _ = start, v2
  26813. start = ptr
  26814. for {
  26815. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26816. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26817. } else {
  26818. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26819. }
  26820. switch v2 {
  26821. case int32(_BT_LEAD2):
  26822. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26823. case int32(_BT_LEAD3):
  26824. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26825. case int32(_BT_LEAD4):
  26826. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26827. case int32(_BT_NONASCII):
  26828. fallthrough
  26829. case int32(_BT_NMSTRT):
  26830. fallthrough
  26831. case int32(_BT_COLON):
  26832. fallthrough
  26833. case int32(_BT_HEX):
  26834. fallthrough
  26835. case int32(_BT_DIGIT):
  26836. fallthrough
  26837. case int32(_BT_NAME):
  26838. fallthrough
  26839. case int32(_BT_MINUS):
  26840. ptr += uintptr(2)
  26841. default:
  26842. return int32(int64(ptr) - int64(start))
  26843. }
  26844. goto _1
  26845. _1:
  26846. }
  26847. return r
  26848. }
  26849. func _big2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  26850. var v2 int32
  26851. _ = v2
  26852. for {
  26853. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26854. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26855. } else {
  26856. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26857. }
  26858. switch v2 {
  26859. case int32(_BT_LF):
  26860. fallthrough
  26861. case int32(_BT_CR):
  26862. fallthrough
  26863. case int32(_BT_S):
  26864. ptr += uintptr(2)
  26865. default:
  26866. return ptr
  26867. }
  26868. goto _1
  26869. _1:
  26870. }
  26871. return r
  26872. }
  26873. func _big2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  26874. var v1, v2 int32
  26875. var v3 bool
  26876. _, _, _ = v1, v2, v3
  26877. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26878. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26879. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26880. } else {
  26881. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26882. }
  26883. switch v1 {
  26884. case int32(_BT_LEAD2):
  26885. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26886. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26887. case int32(_BT_LEAD3):
  26888. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26889. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26890. case int32(_BT_LEAD4):
  26891. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26892. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26893. case int32(_BT_LF):
  26894. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  26895. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  26896. ptr += uintptr(2)
  26897. case int32(_BT_CR):
  26898. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  26899. ptr += uintptr(2)
  26900. if v3 = int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)); v3 {
  26901. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26902. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26903. } else {
  26904. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26905. }
  26906. }
  26907. if v3 && v2 == int32(_BT_LF) {
  26908. ptr += uintptr(2)
  26909. }
  26910. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  26911. default:
  26912. ptr += uintptr(2)
  26913. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26914. break
  26915. }
  26916. }
  26917. }
  26918. var _big2_encoding_ns = Tnormal_encoding{
  26919. Fenc: TENCODING{
  26920. Fscanners: [4]TSCANNER{},
  26921. FliteralScanners: [2]TSCANNER{},
  26922. FminBytesPerChar: int32(2),
  26923. },
  26924. Ftype1: [256]uint8{
  26925. 9: uint8(_BT_S),
  26926. 10: uint8(_BT_LF),
  26927. 13: uint8(_BT_CR),
  26928. 32: uint8(_BT_S),
  26929. 33: uint8(_BT_EXCL),
  26930. 34: uint8(_BT_QUOT),
  26931. 35: uint8(_BT_NUM),
  26932. 36: uint8(_BT_OTHER),
  26933. 37: uint8(_BT_PERCNT),
  26934. 38: uint8(_BT_AMP),
  26935. 39: uint8(_BT_APOS),
  26936. 40: uint8(_BT_LPAR),
  26937. 41: uint8(_BT_RPAR),
  26938. 42: uint8(_BT_AST),
  26939. 43: uint8(_BT_PLUS),
  26940. 44: uint8(_BT_COMMA),
  26941. 45: uint8(_BT_MINUS),
  26942. 46: uint8(_BT_NAME),
  26943. 47: uint8(_BT_SOL),
  26944. 48: uint8(_BT_DIGIT),
  26945. 49: uint8(_BT_DIGIT),
  26946. 50: uint8(_BT_DIGIT),
  26947. 51: uint8(_BT_DIGIT),
  26948. 52: uint8(_BT_DIGIT),
  26949. 53: uint8(_BT_DIGIT),
  26950. 54: uint8(_BT_DIGIT),
  26951. 55: uint8(_BT_DIGIT),
  26952. 56: uint8(_BT_DIGIT),
  26953. 57: uint8(_BT_DIGIT),
  26954. 58: uint8(_BT_COLON),
  26955. 59: uint8(_BT_SEMI),
  26956. 60: uint8(_BT_LT),
  26957. 61: uint8(_BT_EQUALS),
  26958. 62: uint8(_BT_GT),
  26959. 63: uint8(_BT_QUEST),
  26960. 64: uint8(_BT_OTHER),
  26961. 65: uint8(_BT_HEX),
  26962. 66: uint8(_BT_HEX),
  26963. 67: uint8(_BT_HEX),
  26964. 68: uint8(_BT_HEX),
  26965. 69: uint8(_BT_HEX),
  26966. 70: uint8(_BT_HEX),
  26967. 71: uint8(_BT_NMSTRT),
  26968. 72: uint8(_BT_NMSTRT),
  26969. 73: uint8(_BT_NMSTRT),
  26970. 74: uint8(_BT_NMSTRT),
  26971. 75: uint8(_BT_NMSTRT),
  26972. 76: uint8(_BT_NMSTRT),
  26973. 77: uint8(_BT_NMSTRT),
  26974. 78: uint8(_BT_NMSTRT),
  26975. 79: uint8(_BT_NMSTRT),
  26976. 80: uint8(_BT_NMSTRT),
  26977. 81: uint8(_BT_NMSTRT),
  26978. 82: uint8(_BT_NMSTRT),
  26979. 83: uint8(_BT_NMSTRT),
  26980. 84: uint8(_BT_NMSTRT),
  26981. 85: uint8(_BT_NMSTRT),
  26982. 86: uint8(_BT_NMSTRT),
  26983. 87: uint8(_BT_NMSTRT),
  26984. 88: uint8(_BT_NMSTRT),
  26985. 89: uint8(_BT_NMSTRT),
  26986. 90: uint8(_BT_NMSTRT),
  26987. 91: uint8(_BT_LSQB),
  26988. 92: uint8(_BT_OTHER),
  26989. 93: uint8(_BT_RSQB),
  26990. 94: uint8(_BT_OTHER),
  26991. 95: uint8(_BT_NMSTRT),
  26992. 96: uint8(_BT_OTHER),
  26993. 97: uint8(_BT_HEX),
  26994. 98: uint8(_BT_HEX),
  26995. 99: uint8(_BT_HEX),
  26996. 100: uint8(_BT_HEX),
  26997. 101: uint8(_BT_HEX),
  26998. 102: uint8(_BT_HEX),
  26999. 103: uint8(_BT_NMSTRT),
  27000. 104: uint8(_BT_NMSTRT),
  27001. 105: uint8(_BT_NMSTRT),
  27002. 106: uint8(_BT_NMSTRT),
  27003. 107: uint8(_BT_NMSTRT),
  27004. 108: uint8(_BT_NMSTRT),
  27005. 109: uint8(_BT_NMSTRT),
  27006. 110: uint8(_BT_NMSTRT),
  27007. 111: uint8(_BT_NMSTRT),
  27008. 112: uint8(_BT_NMSTRT),
  27009. 113: uint8(_BT_NMSTRT),
  27010. 114: uint8(_BT_NMSTRT),
  27011. 115: uint8(_BT_NMSTRT),
  27012. 116: uint8(_BT_NMSTRT),
  27013. 117: uint8(_BT_NMSTRT),
  27014. 118: uint8(_BT_NMSTRT),
  27015. 119: uint8(_BT_NMSTRT),
  27016. 120: uint8(_BT_NMSTRT),
  27017. 121: uint8(_BT_NMSTRT),
  27018. 122: uint8(_BT_NMSTRT),
  27019. 123: uint8(_BT_OTHER),
  27020. 124: uint8(_BT_VERBAR),
  27021. 125: uint8(_BT_OTHER),
  27022. 126: uint8(_BT_OTHER),
  27023. 127: uint8(_BT_OTHER),
  27024. 128: uint8(_BT_OTHER),
  27025. 129: uint8(_BT_OTHER),
  27026. 130: uint8(_BT_OTHER),
  27027. 131: uint8(_BT_OTHER),
  27028. 132: uint8(_BT_OTHER),
  27029. 133: uint8(_BT_OTHER),
  27030. 134: uint8(_BT_OTHER),
  27031. 135: uint8(_BT_OTHER),
  27032. 136: uint8(_BT_OTHER),
  27033. 137: uint8(_BT_OTHER),
  27034. 138: uint8(_BT_OTHER),
  27035. 139: uint8(_BT_OTHER),
  27036. 140: uint8(_BT_OTHER),
  27037. 141: uint8(_BT_OTHER),
  27038. 142: uint8(_BT_OTHER),
  27039. 143: uint8(_BT_OTHER),
  27040. 144: uint8(_BT_OTHER),
  27041. 145: uint8(_BT_OTHER),
  27042. 146: uint8(_BT_OTHER),
  27043. 147: uint8(_BT_OTHER),
  27044. 148: uint8(_BT_OTHER),
  27045. 149: uint8(_BT_OTHER),
  27046. 150: uint8(_BT_OTHER),
  27047. 151: uint8(_BT_OTHER),
  27048. 152: uint8(_BT_OTHER),
  27049. 153: uint8(_BT_OTHER),
  27050. 154: uint8(_BT_OTHER),
  27051. 155: uint8(_BT_OTHER),
  27052. 156: uint8(_BT_OTHER),
  27053. 157: uint8(_BT_OTHER),
  27054. 158: uint8(_BT_OTHER),
  27055. 159: uint8(_BT_OTHER),
  27056. 160: uint8(_BT_OTHER),
  27057. 161: uint8(_BT_OTHER),
  27058. 162: uint8(_BT_OTHER),
  27059. 163: uint8(_BT_OTHER),
  27060. 164: uint8(_BT_OTHER),
  27061. 165: uint8(_BT_OTHER),
  27062. 166: uint8(_BT_OTHER),
  27063. 167: uint8(_BT_OTHER),
  27064. 168: uint8(_BT_OTHER),
  27065. 169: uint8(_BT_OTHER),
  27066. 170: uint8(_BT_NMSTRT),
  27067. 171: uint8(_BT_OTHER),
  27068. 172: uint8(_BT_OTHER),
  27069. 173: uint8(_BT_OTHER),
  27070. 174: uint8(_BT_OTHER),
  27071. 175: uint8(_BT_OTHER),
  27072. 176: uint8(_BT_OTHER),
  27073. 177: uint8(_BT_OTHER),
  27074. 178: uint8(_BT_OTHER),
  27075. 179: uint8(_BT_OTHER),
  27076. 180: uint8(_BT_OTHER),
  27077. 181: uint8(_BT_NMSTRT),
  27078. 182: uint8(_BT_OTHER),
  27079. 183: uint8(_BT_NAME),
  27080. 184: uint8(_BT_OTHER),
  27081. 185: uint8(_BT_OTHER),
  27082. 186: uint8(_BT_NMSTRT),
  27083. 187: uint8(_BT_OTHER),
  27084. 188: uint8(_BT_OTHER),
  27085. 189: uint8(_BT_OTHER),
  27086. 190: uint8(_BT_OTHER),
  27087. 191: uint8(_BT_OTHER),
  27088. 192: uint8(_BT_NMSTRT),
  27089. 193: uint8(_BT_NMSTRT),
  27090. 194: uint8(_BT_NMSTRT),
  27091. 195: uint8(_BT_NMSTRT),
  27092. 196: uint8(_BT_NMSTRT),
  27093. 197: uint8(_BT_NMSTRT),
  27094. 198: uint8(_BT_NMSTRT),
  27095. 199: uint8(_BT_NMSTRT),
  27096. 200: uint8(_BT_NMSTRT),
  27097. 201: uint8(_BT_NMSTRT),
  27098. 202: uint8(_BT_NMSTRT),
  27099. 203: uint8(_BT_NMSTRT),
  27100. 204: uint8(_BT_NMSTRT),
  27101. 205: uint8(_BT_NMSTRT),
  27102. 206: uint8(_BT_NMSTRT),
  27103. 207: uint8(_BT_NMSTRT),
  27104. 208: uint8(_BT_NMSTRT),
  27105. 209: uint8(_BT_NMSTRT),
  27106. 210: uint8(_BT_NMSTRT),
  27107. 211: uint8(_BT_NMSTRT),
  27108. 212: uint8(_BT_NMSTRT),
  27109. 213: uint8(_BT_NMSTRT),
  27110. 214: uint8(_BT_NMSTRT),
  27111. 215: uint8(_BT_OTHER),
  27112. 216: uint8(_BT_NMSTRT),
  27113. 217: uint8(_BT_NMSTRT),
  27114. 218: uint8(_BT_NMSTRT),
  27115. 219: uint8(_BT_NMSTRT),
  27116. 220: uint8(_BT_NMSTRT),
  27117. 221: uint8(_BT_NMSTRT),
  27118. 222: uint8(_BT_NMSTRT),
  27119. 223: uint8(_BT_NMSTRT),
  27120. 224: uint8(_BT_NMSTRT),
  27121. 225: uint8(_BT_NMSTRT),
  27122. 226: uint8(_BT_NMSTRT),
  27123. 227: uint8(_BT_NMSTRT),
  27124. 228: uint8(_BT_NMSTRT),
  27125. 229: uint8(_BT_NMSTRT),
  27126. 230: uint8(_BT_NMSTRT),
  27127. 231: uint8(_BT_NMSTRT),
  27128. 232: uint8(_BT_NMSTRT),
  27129. 233: uint8(_BT_NMSTRT),
  27130. 234: uint8(_BT_NMSTRT),
  27131. 235: uint8(_BT_NMSTRT),
  27132. 236: uint8(_BT_NMSTRT),
  27133. 237: uint8(_BT_NMSTRT),
  27134. 238: uint8(_BT_NMSTRT),
  27135. 239: uint8(_BT_NMSTRT),
  27136. 240: uint8(_BT_NMSTRT),
  27137. 241: uint8(_BT_NMSTRT),
  27138. 242: uint8(_BT_NMSTRT),
  27139. 243: uint8(_BT_NMSTRT),
  27140. 244: uint8(_BT_NMSTRT),
  27141. 245: uint8(_BT_NMSTRT),
  27142. 246: uint8(_BT_NMSTRT),
  27143. 247: uint8(_BT_OTHER),
  27144. 248: uint8(_BT_NMSTRT),
  27145. 249: uint8(_BT_NMSTRT),
  27146. 250: uint8(_BT_NMSTRT),
  27147. 251: uint8(_BT_NMSTRT),
  27148. 252: uint8(_BT_NMSTRT),
  27149. 253: uint8(_BT_NMSTRT),
  27150. 254: uint8(_BT_NMSTRT),
  27151. 255: uint8(_BT_NMSTRT),
  27152. },
  27153. }
  27154. func init() {
  27155. p := unsafe.Pointer(&_big2_encoding_ns)
  27156. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  27157. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  27158. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  27159. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  27160. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  27161. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  27162. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  27163. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  27164. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  27165. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  27166. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  27167. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  27168. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  27169. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  27170. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  27171. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  27172. }
  27173. var _big2_encoding = Tnormal_encoding{
  27174. Fenc: TENCODING{
  27175. Fscanners: [4]TSCANNER{},
  27176. FliteralScanners: [2]TSCANNER{},
  27177. FminBytesPerChar: int32(2),
  27178. },
  27179. Ftype1: [256]uint8{
  27180. 9: uint8(_BT_S),
  27181. 10: uint8(_BT_LF),
  27182. 13: uint8(_BT_CR),
  27183. 32: uint8(_BT_S),
  27184. 33: uint8(_BT_EXCL),
  27185. 34: uint8(_BT_QUOT),
  27186. 35: uint8(_BT_NUM),
  27187. 36: uint8(_BT_OTHER),
  27188. 37: uint8(_BT_PERCNT),
  27189. 38: uint8(_BT_AMP),
  27190. 39: uint8(_BT_APOS),
  27191. 40: uint8(_BT_LPAR),
  27192. 41: uint8(_BT_RPAR),
  27193. 42: uint8(_BT_AST),
  27194. 43: uint8(_BT_PLUS),
  27195. 44: uint8(_BT_COMMA),
  27196. 45: uint8(_BT_MINUS),
  27197. 46: uint8(_BT_NAME),
  27198. 47: uint8(_BT_SOL),
  27199. 48: uint8(_BT_DIGIT),
  27200. 49: uint8(_BT_DIGIT),
  27201. 50: uint8(_BT_DIGIT),
  27202. 51: uint8(_BT_DIGIT),
  27203. 52: uint8(_BT_DIGIT),
  27204. 53: uint8(_BT_DIGIT),
  27205. 54: uint8(_BT_DIGIT),
  27206. 55: uint8(_BT_DIGIT),
  27207. 56: uint8(_BT_DIGIT),
  27208. 57: uint8(_BT_DIGIT),
  27209. 58: uint8(_BT_NMSTRT),
  27210. 59: uint8(_BT_SEMI),
  27211. 60: uint8(_BT_LT),
  27212. 61: uint8(_BT_EQUALS),
  27213. 62: uint8(_BT_GT),
  27214. 63: uint8(_BT_QUEST),
  27215. 64: uint8(_BT_OTHER),
  27216. 65: uint8(_BT_HEX),
  27217. 66: uint8(_BT_HEX),
  27218. 67: uint8(_BT_HEX),
  27219. 68: uint8(_BT_HEX),
  27220. 69: uint8(_BT_HEX),
  27221. 70: uint8(_BT_HEX),
  27222. 71: uint8(_BT_NMSTRT),
  27223. 72: uint8(_BT_NMSTRT),
  27224. 73: uint8(_BT_NMSTRT),
  27225. 74: uint8(_BT_NMSTRT),
  27226. 75: uint8(_BT_NMSTRT),
  27227. 76: uint8(_BT_NMSTRT),
  27228. 77: uint8(_BT_NMSTRT),
  27229. 78: uint8(_BT_NMSTRT),
  27230. 79: uint8(_BT_NMSTRT),
  27231. 80: uint8(_BT_NMSTRT),
  27232. 81: uint8(_BT_NMSTRT),
  27233. 82: uint8(_BT_NMSTRT),
  27234. 83: uint8(_BT_NMSTRT),
  27235. 84: uint8(_BT_NMSTRT),
  27236. 85: uint8(_BT_NMSTRT),
  27237. 86: uint8(_BT_NMSTRT),
  27238. 87: uint8(_BT_NMSTRT),
  27239. 88: uint8(_BT_NMSTRT),
  27240. 89: uint8(_BT_NMSTRT),
  27241. 90: uint8(_BT_NMSTRT),
  27242. 91: uint8(_BT_LSQB),
  27243. 92: uint8(_BT_OTHER),
  27244. 93: uint8(_BT_RSQB),
  27245. 94: uint8(_BT_OTHER),
  27246. 95: uint8(_BT_NMSTRT),
  27247. 96: uint8(_BT_OTHER),
  27248. 97: uint8(_BT_HEX),
  27249. 98: uint8(_BT_HEX),
  27250. 99: uint8(_BT_HEX),
  27251. 100: uint8(_BT_HEX),
  27252. 101: uint8(_BT_HEX),
  27253. 102: uint8(_BT_HEX),
  27254. 103: uint8(_BT_NMSTRT),
  27255. 104: uint8(_BT_NMSTRT),
  27256. 105: uint8(_BT_NMSTRT),
  27257. 106: uint8(_BT_NMSTRT),
  27258. 107: uint8(_BT_NMSTRT),
  27259. 108: uint8(_BT_NMSTRT),
  27260. 109: uint8(_BT_NMSTRT),
  27261. 110: uint8(_BT_NMSTRT),
  27262. 111: uint8(_BT_NMSTRT),
  27263. 112: uint8(_BT_NMSTRT),
  27264. 113: uint8(_BT_NMSTRT),
  27265. 114: uint8(_BT_NMSTRT),
  27266. 115: uint8(_BT_NMSTRT),
  27267. 116: uint8(_BT_NMSTRT),
  27268. 117: uint8(_BT_NMSTRT),
  27269. 118: uint8(_BT_NMSTRT),
  27270. 119: uint8(_BT_NMSTRT),
  27271. 120: uint8(_BT_NMSTRT),
  27272. 121: uint8(_BT_NMSTRT),
  27273. 122: uint8(_BT_NMSTRT),
  27274. 123: uint8(_BT_OTHER),
  27275. 124: uint8(_BT_VERBAR),
  27276. 125: uint8(_BT_OTHER),
  27277. 126: uint8(_BT_OTHER),
  27278. 127: uint8(_BT_OTHER),
  27279. 128: uint8(_BT_OTHER),
  27280. 129: uint8(_BT_OTHER),
  27281. 130: uint8(_BT_OTHER),
  27282. 131: uint8(_BT_OTHER),
  27283. 132: uint8(_BT_OTHER),
  27284. 133: uint8(_BT_OTHER),
  27285. 134: uint8(_BT_OTHER),
  27286. 135: uint8(_BT_OTHER),
  27287. 136: uint8(_BT_OTHER),
  27288. 137: uint8(_BT_OTHER),
  27289. 138: uint8(_BT_OTHER),
  27290. 139: uint8(_BT_OTHER),
  27291. 140: uint8(_BT_OTHER),
  27292. 141: uint8(_BT_OTHER),
  27293. 142: uint8(_BT_OTHER),
  27294. 143: uint8(_BT_OTHER),
  27295. 144: uint8(_BT_OTHER),
  27296. 145: uint8(_BT_OTHER),
  27297. 146: uint8(_BT_OTHER),
  27298. 147: uint8(_BT_OTHER),
  27299. 148: uint8(_BT_OTHER),
  27300. 149: uint8(_BT_OTHER),
  27301. 150: uint8(_BT_OTHER),
  27302. 151: uint8(_BT_OTHER),
  27303. 152: uint8(_BT_OTHER),
  27304. 153: uint8(_BT_OTHER),
  27305. 154: uint8(_BT_OTHER),
  27306. 155: uint8(_BT_OTHER),
  27307. 156: uint8(_BT_OTHER),
  27308. 157: uint8(_BT_OTHER),
  27309. 158: uint8(_BT_OTHER),
  27310. 159: uint8(_BT_OTHER),
  27311. 160: uint8(_BT_OTHER),
  27312. 161: uint8(_BT_OTHER),
  27313. 162: uint8(_BT_OTHER),
  27314. 163: uint8(_BT_OTHER),
  27315. 164: uint8(_BT_OTHER),
  27316. 165: uint8(_BT_OTHER),
  27317. 166: uint8(_BT_OTHER),
  27318. 167: uint8(_BT_OTHER),
  27319. 168: uint8(_BT_OTHER),
  27320. 169: uint8(_BT_OTHER),
  27321. 170: uint8(_BT_NMSTRT),
  27322. 171: uint8(_BT_OTHER),
  27323. 172: uint8(_BT_OTHER),
  27324. 173: uint8(_BT_OTHER),
  27325. 174: uint8(_BT_OTHER),
  27326. 175: uint8(_BT_OTHER),
  27327. 176: uint8(_BT_OTHER),
  27328. 177: uint8(_BT_OTHER),
  27329. 178: uint8(_BT_OTHER),
  27330. 179: uint8(_BT_OTHER),
  27331. 180: uint8(_BT_OTHER),
  27332. 181: uint8(_BT_NMSTRT),
  27333. 182: uint8(_BT_OTHER),
  27334. 183: uint8(_BT_NAME),
  27335. 184: uint8(_BT_OTHER),
  27336. 185: uint8(_BT_OTHER),
  27337. 186: uint8(_BT_NMSTRT),
  27338. 187: uint8(_BT_OTHER),
  27339. 188: uint8(_BT_OTHER),
  27340. 189: uint8(_BT_OTHER),
  27341. 190: uint8(_BT_OTHER),
  27342. 191: uint8(_BT_OTHER),
  27343. 192: uint8(_BT_NMSTRT),
  27344. 193: uint8(_BT_NMSTRT),
  27345. 194: uint8(_BT_NMSTRT),
  27346. 195: uint8(_BT_NMSTRT),
  27347. 196: uint8(_BT_NMSTRT),
  27348. 197: uint8(_BT_NMSTRT),
  27349. 198: uint8(_BT_NMSTRT),
  27350. 199: uint8(_BT_NMSTRT),
  27351. 200: uint8(_BT_NMSTRT),
  27352. 201: uint8(_BT_NMSTRT),
  27353. 202: uint8(_BT_NMSTRT),
  27354. 203: uint8(_BT_NMSTRT),
  27355. 204: uint8(_BT_NMSTRT),
  27356. 205: uint8(_BT_NMSTRT),
  27357. 206: uint8(_BT_NMSTRT),
  27358. 207: uint8(_BT_NMSTRT),
  27359. 208: uint8(_BT_NMSTRT),
  27360. 209: uint8(_BT_NMSTRT),
  27361. 210: uint8(_BT_NMSTRT),
  27362. 211: uint8(_BT_NMSTRT),
  27363. 212: uint8(_BT_NMSTRT),
  27364. 213: uint8(_BT_NMSTRT),
  27365. 214: uint8(_BT_NMSTRT),
  27366. 215: uint8(_BT_OTHER),
  27367. 216: uint8(_BT_NMSTRT),
  27368. 217: uint8(_BT_NMSTRT),
  27369. 218: uint8(_BT_NMSTRT),
  27370. 219: uint8(_BT_NMSTRT),
  27371. 220: uint8(_BT_NMSTRT),
  27372. 221: uint8(_BT_NMSTRT),
  27373. 222: uint8(_BT_NMSTRT),
  27374. 223: uint8(_BT_NMSTRT),
  27375. 224: uint8(_BT_NMSTRT),
  27376. 225: uint8(_BT_NMSTRT),
  27377. 226: uint8(_BT_NMSTRT),
  27378. 227: uint8(_BT_NMSTRT),
  27379. 228: uint8(_BT_NMSTRT),
  27380. 229: uint8(_BT_NMSTRT),
  27381. 230: uint8(_BT_NMSTRT),
  27382. 231: uint8(_BT_NMSTRT),
  27383. 232: uint8(_BT_NMSTRT),
  27384. 233: uint8(_BT_NMSTRT),
  27385. 234: uint8(_BT_NMSTRT),
  27386. 235: uint8(_BT_NMSTRT),
  27387. 236: uint8(_BT_NMSTRT),
  27388. 237: uint8(_BT_NMSTRT),
  27389. 238: uint8(_BT_NMSTRT),
  27390. 239: uint8(_BT_NMSTRT),
  27391. 240: uint8(_BT_NMSTRT),
  27392. 241: uint8(_BT_NMSTRT),
  27393. 242: uint8(_BT_NMSTRT),
  27394. 243: uint8(_BT_NMSTRT),
  27395. 244: uint8(_BT_NMSTRT),
  27396. 245: uint8(_BT_NMSTRT),
  27397. 246: uint8(_BT_NMSTRT),
  27398. 247: uint8(_BT_OTHER),
  27399. 248: uint8(_BT_NMSTRT),
  27400. 249: uint8(_BT_NMSTRT),
  27401. 250: uint8(_BT_NMSTRT),
  27402. 251: uint8(_BT_NMSTRT),
  27403. 252: uint8(_BT_NMSTRT),
  27404. 253: uint8(_BT_NMSTRT),
  27405. 254: uint8(_BT_NMSTRT),
  27406. 255: uint8(_BT_NMSTRT),
  27407. },
  27408. }
  27409. func init() {
  27410. p := unsafe.Pointer(&_big2_encoding)
  27411. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  27412. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  27413. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  27414. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  27415. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  27416. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  27417. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  27418. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  27419. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  27420. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  27421. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  27422. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  27423. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  27424. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  27425. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  27426. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  27427. }
  27428. func _streqci(tls *libc.TLS, s1 uintptr, s2 uintptr) (r int32) {
  27429. var c1, c2 uint8
  27430. var v2, v3 uintptr
  27431. _, _, _, _ = c1, c2, v2, v3
  27432. for {
  27433. v2 = s1
  27434. s1++
  27435. c1 = *(*uint8)(unsafe.Pointer(v2))
  27436. v3 = s2
  27437. s2++
  27438. c2 = *(*uint8)(unsafe.Pointer(v3))
  27439. if int32(m_ASCII_a2) <= libc.Int32FromUint8(c1) && libc.Int32FromUint8(c1) <= int32(m_ASCII_z1) {
  27440. c1 = uint8(int32(c1) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a2)))
  27441. }
  27442. if int32(m_ASCII_a2) <= libc.Int32FromUint8(c2) && libc.Int32FromUint8(c2) <= int32(m_ASCII_z1) {
  27443. /* The following line will never get executed. streqci() is
  27444. * only called from two places, both of which guarantee to put
  27445. * upper-case strings into s2.
  27446. */
  27447. c2 = uint8(int32(c2) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a2)))
  27448. } /* LCOV_EXCL_LINE */
  27449. if libc.Int32FromUint8(c1) != libc.Int32FromUint8(c2) {
  27450. return 0
  27451. }
  27452. if !(c1 != 0) {
  27453. break
  27454. }
  27455. goto _1
  27456. _1:
  27457. }
  27458. return int32(1)
  27459. }
  27460. func _initUpdatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  27461. _ = enc
  27462. _normal_updatePosition(tls, uintptr(unsafe.Pointer(&_utf8_encoding)), ptr, end, pos)
  27463. }
  27464. func _toAscii(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r int32) {
  27465. bp := tls.Alloc(32)
  27466. defer tls.Free(32)
  27467. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  27468. var _ /* buf at bp+8 */ [1]uint8
  27469. var _ /* p at bp+16 */ uintptr
  27470. *(*uintptr)(unsafe.Pointer(bp + 16)) = bp + 8
  27471. (*(*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))
  27472. if *(*uintptr)(unsafe.Pointer(bp + 16)) == bp+8 {
  27473. return -int32(1)
  27474. } else {
  27475. return libc.Int32FromUint8((*(*[1]uint8)(unsafe.Pointer(bp + 8)))[0])
  27476. }
  27477. return r
  27478. }
  27479. func _isSpace(tls *libc.TLS, c int32) (r int32) {
  27480. switch c {
  27481. case int32(0x20):
  27482. fallthrough
  27483. case int32(0xD):
  27484. fallthrough
  27485. case int32(0xA):
  27486. fallthrough
  27487. case int32(0x9):
  27488. return int32(1)
  27489. }
  27490. return 0
  27491. }
  27492. // C documentation
  27493. //
  27494. // /* Return 1 if there's just optional white space or there's an S
  27495. // followed by name=val.
  27496. // */
  27497. func _parsePseudoAttribute(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, namePtr uintptr, nameEndPtr uintptr, valPtr uintptr, nextTokPtr uintptr) (r int32) {
  27498. var c, v2 int32
  27499. var open uint8
  27500. _, _, _ = c, open, v2
  27501. if ptr == end {
  27502. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  27503. return int32(1)
  27504. }
  27505. if !(_isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0) {
  27506. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27507. return 0
  27508. }
  27509. for cond := true; cond; cond = _isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0 {
  27510. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27511. }
  27512. if ptr == end {
  27513. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  27514. return int32(1)
  27515. }
  27516. *(*uintptr)(unsafe.Pointer(namePtr)) = ptr
  27517. for {
  27518. c = _toAscii(tls, enc, ptr, end)
  27519. if c == -int32(1) {
  27520. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27521. return 0
  27522. }
  27523. if c == int32(m_ASCII_EQUALS2) {
  27524. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  27525. break
  27526. }
  27527. if _isSpace(tls, c) != 0 {
  27528. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  27529. for {
  27530. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27531. goto _3
  27532. _3:
  27533. ;
  27534. v2 = _toAscii(tls, enc, ptr, end)
  27535. c = v2
  27536. if !(_isSpace(tls, v2) != 0) {
  27537. break
  27538. }
  27539. }
  27540. if c != int32(m_ASCII_EQUALS2) {
  27541. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27542. return 0
  27543. }
  27544. break
  27545. }
  27546. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27547. goto _1
  27548. _1:
  27549. }
  27550. if ptr == *(*uintptr)(unsafe.Pointer(namePtr)) {
  27551. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27552. return 0
  27553. }
  27554. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27555. c = _toAscii(tls, enc, ptr, end)
  27556. for _isSpace(tls, c) != 0 {
  27557. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27558. c = _toAscii(tls, enc, ptr, end)
  27559. }
  27560. if c != int32(m_ASCII_QUOT1) && c != int32(m_ASCII_APOS1) {
  27561. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27562. return 0
  27563. }
  27564. open = libc.Uint8FromInt32(c)
  27565. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27566. *(*uintptr)(unsafe.Pointer(valPtr)) = ptr
  27567. for {
  27568. c = _toAscii(tls, enc, ptr, end)
  27569. if c == libc.Int32FromUint8(open) {
  27570. break
  27571. }
  27572. if !(int32(m_ASCII_a2) <= c && c <= int32(m_ASCII_z1)) && !(int32(m_ASCII_A) <= c && c <= int32(m_ASCII_Z1)) && !(int32(m_ASCII_02) <= c && c <= int32(m_ASCII_92)) && c != int32(m_ASCII_PERIOD2) && c != int32(m_ASCII_MINUS1) && c != int32(m_ASCII_UNDERSCORE1) {
  27573. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27574. return 0
  27575. }
  27576. goto _4
  27577. _4:
  27578. ;
  27579. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27580. }
  27581. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27582. return int32(1)
  27583. }
  27584. var _KW_version = [8]uint8{
  27585. 0: uint8(m_ASCII_v1),
  27586. 1: uint8(m_ASCII_e2),
  27587. 2: uint8(m_ASCII_r2),
  27588. 3: uint8(m_ASCII_s2),
  27589. 4: uint8(m_ASCII_i1),
  27590. 5: uint8(m_ASCII_o2),
  27591. 6: uint8(m_ASCII_n2),
  27592. }
  27593. var _KW_encoding = [9]uint8{
  27594. 0: uint8(m_ASCII_e2),
  27595. 1: uint8(m_ASCII_n2),
  27596. 2: uint8(m_ASCII_c2),
  27597. 3: uint8(m_ASCII_o2),
  27598. 4: uint8(m_ASCII_d1),
  27599. 5: uint8(m_ASCII_i1),
  27600. 6: uint8(m_ASCII_n2),
  27601. 7: uint8(m_ASCII_g2),
  27602. }
  27603. var _KW_standalone = [11]uint8{
  27604. 0: uint8(m_ASCII_s2),
  27605. 1: uint8(m_ASCII_t2),
  27606. 2: uint8(m_ASCII_a2),
  27607. 3: uint8(m_ASCII_n2),
  27608. 4: uint8(m_ASCII_d1),
  27609. 5: uint8(m_ASCII_a2),
  27610. 6: uint8(m_ASCII_l2),
  27611. 7: uint8(m_ASCII_o2),
  27612. 8: uint8(m_ASCII_n2),
  27613. 9: uint8(m_ASCII_e2),
  27614. }
  27615. var _KW_yes = [4]uint8{
  27616. 0: uint8(m_ASCII_y1),
  27617. 1: uint8(m_ASCII_e2),
  27618. 2: uint8(m_ASCII_s2),
  27619. }
  27620. var _KW_no = [3]uint8{
  27621. 0: uint8(m_ASCII_n2),
  27622. 1: uint8(m_ASCII_o2),
  27623. }
  27624. 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) {
  27625. bp := tls.Alloc(32)
  27626. defer tls.Free(32)
  27627. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  27628. var c int32
  27629. var _ /* name at bp+16 */ uintptr
  27630. var _ /* nameEnd at bp+24 */ uintptr
  27631. var _ /* val at bp+8 */ uintptr
  27632. _ = c
  27633. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  27634. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  27635. *(*uintptr)(unsafe.Pointer(bp + 24)) = libc.UintptrFromInt32(0)
  27636. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(int32(5) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27637. end -= uintptr(int32(2) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27638. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) || !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  27639. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27640. return 0
  27641. }
  27642. 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) {
  27643. if !(isGeneralTextEntity != 0) {
  27644. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 16))
  27645. return 0
  27646. }
  27647. } else {
  27648. if versionPtr != 0 {
  27649. *(*uintptr)(unsafe.Pointer(versionPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27650. }
  27651. if versionEndPtr != 0 {
  27652. *(*uintptr)(unsafe.Pointer(versionEndPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27653. }
  27654. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) {
  27655. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27656. return 0
  27657. }
  27658. if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  27659. if isGeneralTextEntity != 0 {
  27660. /* a TextDecl must have an EncodingDecl */
  27661. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27662. return 0
  27663. }
  27664. return int32(1)
  27665. }
  27666. }
  27667. 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 {
  27668. c = _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), end)
  27669. if !(int32(m_ASCII_a2) <= c && c <= int32(m_ASCII_z1)) && !(int32(m_ASCII_A) <= c && c <= int32(m_ASCII_Z1)) {
  27670. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27671. return 0
  27672. }
  27673. if encodingName != 0 {
  27674. *(*uintptr)(unsafe.Pointer(encodingName)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27675. }
  27676. if encoding != 0 {
  27677. *(*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))
  27678. }
  27679. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) {
  27680. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27681. return 0
  27682. }
  27683. if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  27684. return int32(1)
  27685. }
  27686. }
  27687. 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 {
  27688. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 16))
  27689. return 0
  27690. }
  27691. 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 {
  27692. if standalone != 0 {
  27693. *(*int32)(unsafe.Pointer(standalone)) = int32(1)
  27694. }
  27695. } else {
  27696. 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 {
  27697. if standalone != 0 {
  27698. *(*int32)(unsafe.Pointer(standalone)) = 0
  27699. }
  27700. } else {
  27701. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27702. return 0
  27703. }
  27704. }
  27705. for _isSpace(tls, _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end)) != 0 {
  27706. *(*uintptr)(unsafe.Pointer(bp)) += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27707. }
  27708. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  27709. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27710. return 0
  27711. }
  27712. return int32(1)
  27713. }
  27714. func _checkCharRefNumber(tls *libc.TLS, result int32) (r int32) {
  27715. switch result >> libc.Int32FromInt32(8) {
  27716. case int32(0xD8):
  27717. fallthrough
  27718. case int32(0xD9):
  27719. fallthrough
  27720. case int32(0xDA):
  27721. fallthrough
  27722. case int32(0xDB):
  27723. fallthrough
  27724. case int32(0xDC):
  27725. fallthrough
  27726. case int32(0xDD):
  27727. fallthrough
  27728. case int32(0xDE):
  27729. fallthrough
  27730. case int32(0xDF):
  27731. return -int32(1)
  27732. case 0:
  27733. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(result)))) == int32(_BT_NONXML) {
  27734. return -int32(1)
  27735. }
  27736. case int32(0xFF):
  27737. if result == int32(0xFFFE) || result == int32(0xFFFF) {
  27738. return -int32(1)
  27739. }
  27740. break
  27741. }
  27742. return result
  27743. }
  27744. func XXmlUtf8Encode(tls *libc.TLS, c int32, buf uintptr) (r int32) {
  27745. if c < 0 {
  27746. return 0
  27747. } /* LCOV_EXCL_LINE: this case is always eliminated beforehand */
  27748. if c < 128 {
  27749. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c | int32(_UTF8_cval1))
  27750. return int32(1)
  27751. }
  27752. if c < 2048 {
  27753. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  27754. *(*uint8)(unsafe.Pointer(buf + 1)) = libc.Uint8FromInt32(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27755. return int32(2)
  27756. }
  27757. if c < 65536 {
  27758. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(12) | int32(_UTF8_cval3))
  27759. *(*uint8)(unsafe.Pointer(buf + 1)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27760. *(*uint8)(unsafe.Pointer(buf + 2)) = libc.Uint8FromInt32(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27761. return int32(3)
  27762. }
  27763. if c < int32(0x110000) {
  27764. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(18) | int32(_UTF8_cval4))
  27765. *(*uint8)(unsafe.Pointer(buf + 1)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(12)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27766. *(*uint8)(unsafe.Pointer(buf + 2)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27767. *(*uint8)(unsafe.Pointer(buf + 3)) = libc.Uint8FromInt32(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27768. return int32(4)
  27769. }
  27770. return 0 /* LCOV_EXCL_LINE: this case too is eliminated before calling */
  27771. }
  27772. func XXmlUtf16Encode(tls *libc.TLS, charNum int32, buf uintptr) (r int32) {
  27773. if charNum < 0 {
  27774. return 0
  27775. }
  27776. if charNum < int32(0x10000) {
  27777. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum)
  27778. return int32(1)
  27779. }
  27780. if charNum < int32(0x110000) {
  27781. charNum -= int32(0x10000)
  27782. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum>>libc.Int32FromInt32(10) + libc.Int32FromInt32(0xD800))
  27783. *(*uint16)(unsafe.Pointer(buf + 1*2)) = libc.Uint16FromInt32(charNum&libc.Int32FromInt32(0x3FF) + libc.Int32FromInt32(0xDC00))
  27784. return int32(2)
  27785. }
  27786. return 0
  27787. }
  27788. type Tunknown_encoding = struct {
  27789. Fnormal Tnormal_encoding
  27790. Fconvert TCONVERTER
  27791. FuserData uintptr
  27792. Futf16 [256]uint16
  27793. Futf8 [256][4]uint8
  27794. }
  27795. func XXmlSizeOfUnknownEncoding(tls *libc.TLS) (r int32) {
  27796. return int32(2016)
  27797. }
  27798. func _unknown_isName(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27799. var c int32
  27800. var uenc uintptr
  27801. _, _ = c, uenc
  27802. uenc = enc
  27803. 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)
  27804. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  27805. return 0
  27806. }
  27807. 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))))
  27808. }
  27809. func _unknown_isNmstrt(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27810. var c int32
  27811. var uenc uintptr
  27812. _, _ = c, uenc
  27813. uenc = enc
  27814. 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)
  27815. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  27816. return 0
  27817. }
  27818. 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))))
  27819. }
  27820. func _unknown_isInvalid(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27821. var c int32
  27822. var uenc uintptr
  27823. _, _ = c, uenc
  27824. uenc = enc
  27825. 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)
  27826. return libc.BoolInt32(c & ^libc.Int32FromInt32(0xFFFF) != 0 || _checkCharRefNumber(tls, c) < 0)
  27827. }
  27828. func _unknown_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  27829. bp := tls.Alloc(16)
  27830. defer tls.Free(16)
  27831. var c, n int32
  27832. var uenc, utf8, v2 uintptr
  27833. var _ /* buf at bp+0 */ [4]uint8
  27834. _, _, _, _, _ = c, n, uenc, utf8, v2
  27835. uenc = enc
  27836. for {
  27837. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  27838. return int32(_XML_CONVERT_COMPLETED)
  27839. }
  27840. utf8 = uenc + 992 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))*4
  27841. v2 = utf8
  27842. utf8++
  27843. n = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v2)))
  27844. if n == 0 {
  27845. 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)))
  27846. n = XXmlUtf8Encode(tls, c, bp)
  27847. if int64(n) > int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) {
  27848. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27849. }
  27850. utf8 = bp
  27851. *(*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)))
  27852. } else {
  27853. if int64(n) > int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) {
  27854. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27855. }
  27856. *(*uintptr)(unsafe.Pointer(fromP))++
  27857. }
  27858. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), utf8, libc.Uint64FromInt32(n))
  27859. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(n)
  27860. goto _1
  27861. _1:
  27862. }
  27863. return r
  27864. }
  27865. func _unknown_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  27866. var c uint16
  27867. var uenc, v1, v2 uintptr
  27868. _, _, _, _ = c, uenc, v1, v2
  27869. uenc = enc
  27870. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  27871. c = *(*uint16)(unsafe.Pointer(uenc + 480 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))*2))
  27872. if libc.Int32FromUint16(c) == 0 {
  27873. 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))))
  27874. *(*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)))
  27875. } else {
  27876. *(*uintptr)(unsafe.Pointer(fromP))++
  27877. }
  27878. v2 = toP
  27879. v1 = *(*uintptr)(unsafe.Pointer(v2))
  27880. *(*uintptr)(unsafe.Pointer(v2)) += 2
  27881. *(*uint16)(unsafe.Pointer(v1)) = c
  27882. }
  27883. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  27884. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27885. } else {
  27886. return int32(_XML_CONVERT_COMPLETED)
  27887. }
  27888. return r
  27889. }
  27890. func XXmlInitUnknownEncoding(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  27891. var c, i, v3 int32
  27892. var e uintptr
  27893. _, _, _, _ = c, e, i, v3
  27894. e = mem
  27895. libc.Xmemcpy(tls, mem, uintptr(unsafe.Pointer(&_latin1_encoding)), uint64(464))
  27896. i = 0
  27897. for {
  27898. if !(i < int32(128)) {
  27899. break
  27900. }
  27901. 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 {
  27902. return uintptr(0)
  27903. }
  27904. goto _1
  27905. _1:
  27906. ;
  27907. i++
  27908. }
  27909. i = 0
  27910. for {
  27911. if !(i < int32(256)) {
  27912. break
  27913. }
  27914. c = *(*int32)(unsafe.Pointer(table + uintptr(i)*4))
  27915. if c == -int32(1) {
  27916. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_MALFORM)
  27917. /* This shouldn't really get used. */
  27918. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0xFFFF)
  27919. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = uint8(1)
  27920. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = uint8(0)
  27921. } else {
  27922. if c < 0 {
  27923. if c < -int32(4) {
  27924. return uintptr(0)
  27925. }
  27926. /* Multi-byte sequences need a converter function */
  27927. if !(convert != 0) {
  27928. return uintptr(0)
  27929. }
  27930. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = libc.Uint8FromInt32(int32(_BT_LEAD2) - (c + libc.Int32FromInt32(2)))
  27931. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = uint8(0)
  27932. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0)
  27933. } else {
  27934. if c < int32(0x80) {
  27935. 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 {
  27936. return uintptr(0)
  27937. }
  27938. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = *(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(c)))
  27939. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = uint8(1)
  27940. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = libc.Uint8FromInt32(c)
  27941. if c == 0 {
  27942. v3 = int32(0xFFFF)
  27943. } else {
  27944. v3 = c
  27945. }
  27946. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = libc.Uint16FromInt32(v3)
  27947. } else {
  27948. if _checkCharRefNumber(tls, c) < 0 {
  27949. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NONXML)
  27950. /* This shouldn't really get used. */
  27951. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0xFFFF)
  27952. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = uint8(1)
  27953. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = uint8(0)
  27954. } else {
  27955. if c > int32(0xFFFF) {
  27956. return uintptr(0)
  27957. }
  27958. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  27959. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NMSTRT)
  27960. } else {
  27961. if _namingBitmap[libc.Int32FromUint8(_namePages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  27962. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NAME)
  27963. } else {
  27964. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_OTHER)
  27965. }
  27966. }
  27967. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = libc.Uint8FromInt32(XXmlUtf8Encode(tls, c, e+992+uintptr(i)*4+uintptr(1)))
  27968. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = libc.Uint16FromInt32(c)
  27969. }
  27970. }
  27971. }
  27972. }
  27973. goto _2
  27974. _2:
  27975. ;
  27976. i++
  27977. }
  27978. (*Tunknown_encoding)(unsafe.Pointer(e)).FuserData = userData
  27979. (*Tunknown_encoding)(unsafe.Pointer(e)).Fconvert = convert
  27980. if convert != 0 {
  27981. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName2 = __ccgo_fp(_unknown_isName)
  27982. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName3 = __ccgo_fp(_unknown_isName)
  27983. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName4 = __ccgo_fp(_unknown_isName)
  27984. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt2 = __ccgo_fp(_unknown_isNmstrt)
  27985. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt3 = __ccgo_fp(_unknown_isNmstrt)
  27986. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt4 = __ccgo_fp(_unknown_isNmstrt)
  27987. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid2 = __ccgo_fp(_unknown_isInvalid)
  27988. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid3 = __ccgo_fp(_unknown_isInvalid)
  27989. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid4 = __ccgo_fp(_unknown_isInvalid)
  27990. }
  27991. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf8Convert = __ccgo_fp(_unknown_toUtf8)
  27992. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf16Convert = __ccgo_fp(_unknown_toUtf16)
  27993. return e
  27994. }
  27995. const _UNKNOWN_ENC = -1
  27996. const _ISO_8859_1_ENC = 0
  27997. const _US_ASCII_ENC = 1
  27998. const _UTF_8_ENC = 2
  27999. const _UTF_16_ENC = 3
  28000. const _UTF_16BE_ENC = 4
  28001. const _UTF_16LE_ENC = 5
  28002. const
  28003. /* must match encodingNames up to here */
  28004. _NO_ENC = 6
  28005. var _KW_ISO_8859_1 = [11]uint8{
  28006. 0: uint8(m_ASCII_I),
  28007. 1: uint8(m_ASCII_S),
  28008. 2: uint8(m_ASCII_O),
  28009. 3: uint8(m_ASCII_MINUS1),
  28010. 4: uint8(m_ASCII_82),
  28011. 5: uint8(m_ASCII_82),
  28012. 6: uint8(m_ASCII_51),
  28013. 7: uint8(m_ASCII_92),
  28014. 8: uint8(m_ASCII_MINUS1),
  28015. 9: uint8(m_ASCII_12),
  28016. }
  28017. var _KW_US_ASCII = [9]uint8{
  28018. 0: uint8(m_ASCII_U1),
  28019. 1: uint8(m_ASCII_S),
  28020. 2: uint8(m_ASCII_MINUS1),
  28021. 3: uint8(m_ASCII_A),
  28022. 4: uint8(m_ASCII_S),
  28023. 5: uint8(m_ASCII_C),
  28024. 6: uint8(m_ASCII_I),
  28025. 7: uint8(m_ASCII_I),
  28026. }
  28027. var _KW_UTF_8 = [6]uint8{
  28028. 0: uint8(m_ASCII_U1),
  28029. 1: uint8(m_ASCII_T),
  28030. 2: uint8(m_ASCII_F),
  28031. 3: uint8(m_ASCII_MINUS1),
  28032. 4: uint8(m_ASCII_82),
  28033. }
  28034. var _KW_UTF_16 = [7]uint8{
  28035. 0: uint8(m_ASCII_U1),
  28036. 1: uint8(m_ASCII_T),
  28037. 2: uint8(m_ASCII_F),
  28038. 3: uint8(m_ASCII_MINUS1),
  28039. 4: uint8(m_ASCII_12),
  28040. 5: uint8(m_ASCII_61),
  28041. }
  28042. var _KW_UTF_16BE = [9]uint8{
  28043. 0: uint8(m_ASCII_U1),
  28044. 1: uint8(m_ASCII_T),
  28045. 2: uint8(m_ASCII_F),
  28046. 3: uint8(m_ASCII_MINUS1),
  28047. 4: uint8(m_ASCII_12),
  28048. 5: uint8(m_ASCII_61),
  28049. 6: uint8(m_ASCII_B1),
  28050. 7: uint8(m_ASCII_E),
  28051. }
  28052. var _KW_UTF_16LE = [9]uint8{
  28053. 0: uint8(m_ASCII_U1),
  28054. 1: uint8(m_ASCII_T),
  28055. 2: uint8(m_ASCII_F),
  28056. 3: uint8(m_ASCII_MINUS1),
  28057. 4: uint8(m_ASCII_12),
  28058. 5: uint8(m_ASCII_61),
  28059. 6: uint8(m_ASCII_L),
  28060. 7: uint8(m_ASCII_E),
  28061. }
  28062. func _getEncodingIndex(tls *libc.TLS, name uintptr) (r int32) {
  28063. var i int32
  28064. _ = i
  28065. if name == libc.UintptrFromInt32(0) {
  28066. return int32(_NO_ENC)
  28067. }
  28068. i = 0
  28069. for {
  28070. if !(i < libc.Int32FromUint64(libc.Uint64FromInt64(48)/libc.Uint64FromInt64(8))) {
  28071. break
  28072. }
  28073. if _streqci(tls, name, _encodingNames[i]) != 0 {
  28074. return i
  28075. }
  28076. goto _1
  28077. _1:
  28078. ;
  28079. i++
  28080. }
  28081. return int32(_UNKNOWN_ENC)
  28082. }
  28083. var _encodingNames = [6]uintptr{
  28084. 0: uintptr(unsafe.Pointer(&_KW_ISO_8859_1)),
  28085. 1: uintptr(unsafe.Pointer(&_KW_US_ASCII)),
  28086. 2: uintptr(unsafe.Pointer(&_KW_UTF_8)),
  28087. 3: uintptr(unsafe.Pointer(&_KW_UTF_16)),
  28088. 4: uintptr(unsafe.Pointer(&_KW_UTF_16BE)),
  28089. 5: uintptr(unsafe.Pointer(&_KW_UTF_16LE)),
  28090. }
  28091. /* For binary compatibility, we store the index of the encoding
  28092. specified at initialization in the isUtf16 member.
  28093. */
  28094. /* This is what detects the encoding. encodingTable maps from
  28095. encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of
  28096. the external (protocol) specified encoding; state is
  28097. XML_CONTENT_STATE if we're parsing an external text entity, and
  28098. XML_PROLOG_STATE otherwise.
  28099. */
  28100. func _initScan(tls *libc.TLS, encodingTable uintptr, enc uintptr, state int32, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28101. var e int32
  28102. var encPtr uintptr
  28103. _, _ = e, encPtr
  28104. if ptr >= end {
  28105. return -int32(4)
  28106. }
  28107. encPtr = (*TINIT_ENCODING)(unsafe.Pointer(enc)).FencPtr
  28108. if ptr+uintptr(1) == end {
  28109. /* only a single byte available for auto-detection */
  28110. /* so we're parsing an external text entity... */
  28111. /* if UTF-16 was externally specified, then we need at least 2 bytes */
  28112. switch libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) {
  28113. case int32(_UTF_16_ENC):
  28114. fallthrough
  28115. case int32(_UTF_16LE_ENC):
  28116. fallthrough
  28117. case int32(_UTF_16BE_ENC):
  28118. return -int32(1)
  28119. }
  28120. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  28121. case int32(0xFE):
  28122. fallthrough
  28123. case int32(0xFF):
  28124. fallthrough
  28125. case int32(0xEF): /* possibly first byte of UTF-8 BOM */
  28126. if libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28127. break
  28128. }
  28129. /* fall through */
  28130. fallthrough
  28131. case 0x00:
  28132. fallthrough
  28133. case int32(0x3C):
  28134. return -int32(1)
  28135. }
  28136. } else {
  28137. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))<<libc.Int32FromInt32(8) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) {
  28138. case int32(0xFEFF):
  28139. if libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28140. break
  28141. }
  28142. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28143. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*8))
  28144. return int32(m_XML_TOK_BOM)
  28145. /* 00 3C is handled in the default case */
  28146. fallthrough
  28147. case int32(0x3C00):
  28148. 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) {
  28149. break
  28150. }
  28151. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  28152. 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)
  28153. case int32(0xFFFE):
  28154. if libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28155. break
  28156. }
  28157. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28158. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  28159. return int32(m_XML_TOK_BOM)
  28160. case int32(0xEFBB):
  28161. /* Maybe a UTF-8 BOM (EF BB BF) */
  28162. /* If there's an explicitly specified (external) encoding
  28163. of ISO-8859-1 or some flavour of UTF-16
  28164. and this is an external text entity,
  28165. don't look for the BOM,
  28166. because it might be a legal data.
  28167. */
  28168. if state == int32(m_XML_CONTENT_STATE) {
  28169. e = libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16)
  28170. if e == int32(_ISO_8859_1_ENC) || e == int32(_UTF_16BE_ENC) || e == int32(_UTF_16LE_ENC) || e == int32(_UTF_16_ENC) {
  28171. break
  28172. }
  28173. }
  28174. if ptr+uintptr(2) == end {
  28175. return -int32(1)
  28176. }
  28177. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 2))) == int32(0xBF) {
  28178. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(3)
  28179. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_8_ENC)*8))
  28180. return int32(m_XML_TOK_BOM)
  28181. }
  28182. default:
  28183. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32('\000') {
  28184. /* 0 isn't a legal data character. Furthermore a document
  28185. entity can only start with ASCII characters. So the only
  28186. way this can fail to be big-endian UTF-16 if it it's an
  28187. external parsed general entity that's labelled as
  28188. UTF-16LE.
  28189. */
  28190. if state == int32(m_XML_CONTENT_STATE) && libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16LE_ENC) {
  28191. break
  28192. }
  28193. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*8))
  28194. 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)
  28195. } else {
  28196. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32('\000') {
  28197. /* We could recover here in the case:
  28198. - parsing an external entity
  28199. - second byte is 0
  28200. - no externally specified encoding
  28201. - no encoding declaration
  28202. by assuming UTF-16LE. But we don't, because this would mean when
  28203. presented just with a single byte, we couldn't reliably determine
  28204. whether we needed further bytes.
  28205. */
  28206. if state == int32(m_XML_CONTENT_STATE) {
  28207. break
  28208. }
  28209. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  28210. 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)
  28211. }
  28212. }
  28213. break
  28214. }
  28215. }
  28216. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16))*8))
  28217. 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)
  28218. }
  28219. /* This file is included!
  28220. __ __ _
  28221. ___\ \/ /_ __ __ _| |_
  28222. / _ \\ /| '_ \ / _` | __|
  28223. | __// \| |_) | (_| | |_
  28224. \___/_/\_\ .__/ \__,_|\__|
  28225. |_| XML parser
  28226. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  28227. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  28228. Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
  28229. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  28230. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  28231. Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
  28232. Licensed under the MIT license:
  28233. Permission is hereby granted, free of charge, to any person obtaining
  28234. a copy of this software and associated documentation files (the
  28235. "Software"), to deal in the Software without restriction, including
  28236. without limitation the rights to use, copy, modify, merge, publish,
  28237. distribute, sublicense, and/or sell copies of the Software, and to permit
  28238. persons to whom the Software is furnished to do so, subject to the
  28239. following conditions:
  28240. The above copyright notice and this permission notice shall be included
  28241. in all copies or substantial portions of the Software.
  28242. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  28243. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28244. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  28245. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  28246. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  28247. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  28248. USE OR OTHER DEALINGS IN THE SOFTWARE.
  28249. */
  28250. func XXmlGetUtf8InternalEncoding(tls *libc.TLS) (r uintptr) {
  28251. return uintptr(unsafe.Pointer(&_internal_utf8_encoding))
  28252. }
  28253. func XXmlGetUtf16InternalEncoding(tls *libc.TLS) (r uintptr) {
  28254. return uintptr(unsafe.Pointer(&_internal_little2_encoding))
  28255. }
  28256. var _encodings = [7]uintptr{
  28257. 0: uintptr(unsafe.Pointer(&_latin1_encoding)),
  28258. 1: uintptr(unsafe.Pointer(&_ascii_encoding)),
  28259. 2: uintptr(unsafe.Pointer(&_utf8_encoding)),
  28260. 3: uintptr(unsafe.Pointer(&_big2_encoding)),
  28261. 4: uintptr(unsafe.Pointer(&_big2_encoding)),
  28262. 5: uintptr(unsafe.Pointer(&_little2_encoding)),
  28263. 6: uintptr(unsafe.Pointer(&_utf8_encoding)),
  28264. }
  28265. func _initScanProlog(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28266. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  28267. }
  28268. func _initScanContent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28269. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  28270. }
  28271. func XXmlInitEncoding(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  28272. var i int32
  28273. _ = i
  28274. i = _getEncodingIndex(tls, name)
  28275. if i == int32(_UNKNOWN_ENC) {
  28276. return 0
  28277. }
  28278. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = libc.Uint8FromInt32(i)
  28279. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanProlog)
  28280. *(*TSCANNER)(unsafe.Pointer(p + 1*8)) = __ccgo_fp(_initScanContent)
  28281. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  28282. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  28283. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  28284. return int32(1)
  28285. }
  28286. func _findEncoding(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  28287. bp := tls.Alloc(144)
  28288. defer tls.Free(144)
  28289. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  28290. var i int32
  28291. var _ /* buf at bp+8 */ [128]uint8
  28292. var _ /* p at bp+136 */ uintptr
  28293. _ = i
  28294. *(*[128]uint8)(unsafe.Pointer(bp + 8)) = [128]uint8{}
  28295. *(*uintptr)(unsafe.Pointer(bp + 136)) = bp + 8
  28296. (*(*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))
  28297. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  28298. return uintptr(0)
  28299. }
  28300. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136)))) = uint8(0)
  28301. if _streqci(tls, bp+8, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  28302. return enc
  28303. }
  28304. i = _getEncodingIndex(tls, bp+8)
  28305. if i == int32(_UNKNOWN_ENC) {
  28306. return uintptr(0)
  28307. }
  28308. return _encodings[i]
  28309. }
  28310. 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) {
  28311. return _doParseXmlDecl(tls, __ccgo_fp(_findEncoding), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  28312. }
  28313. /* This file is included!
  28314. __ __ _
  28315. ___\ \/ /_ __ __ _| |_
  28316. / _ \\ /| '_ \ / _` | __|
  28317. | __// \| |_) | (_| | |_
  28318. \___/_/\_\ .__/ \__,_|\__|
  28319. |_| XML parser
  28320. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  28321. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  28322. Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
  28323. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  28324. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  28325. Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
  28326. Licensed under the MIT license:
  28327. Permission is hereby granted, free of charge, to any person obtaining
  28328. a copy of this software and associated documentation files (the
  28329. "Software"), to deal in the Software without restriction, including
  28330. without limitation the rights to use, copy, modify, merge, publish,
  28331. distribute, sublicense, and/or sell copies of the Software, and to permit
  28332. persons to whom the Software is furnished to do so, subject to the
  28333. following conditions:
  28334. The above copyright notice and this permission notice shall be included
  28335. in all copies or substantial portions of the Software.
  28336. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  28337. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28338. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  28339. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  28340. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  28341. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  28342. USE OR OTHER DEALINGS IN THE SOFTWARE.
  28343. */
  28344. func XXmlGetUtf8InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  28345. return uintptr(unsafe.Pointer(&_internal_utf8_encoding_ns))
  28346. }
  28347. func XXmlGetUtf16InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  28348. return uintptr(unsafe.Pointer(&_internal_little2_encoding_ns))
  28349. }
  28350. var _encodingsNS = [7]uintptr{
  28351. 0: uintptr(unsafe.Pointer(&_latin1_encoding_ns)),
  28352. 1: uintptr(unsafe.Pointer(&_ascii_encoding_ns)),
  28353. 2: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  28354. 3: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  28355. 4: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  28356. 5: uintptr(unsafe.Pointer(&_little2_encoding_ns)),
  28357. 6: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  28358. }
  28359. func _initScanPrologNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28360. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  28361. }
  28362. func _initScanContentNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28363. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  28364. }
  28365. func XXmlInitEncodingNS(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  28366. var i int32
  28367. _ = i
  28368. i = _getEncodingIndex(tls, name)
  28369. if i == int32(_UNKNOWN_ENC) {
  28370. return 0
  28371. }
  28372. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = libc.Uint8FromInt32(i)
  28373. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanPrologNS)
  28374. *(*TSCANNER)(unsafe.Pointer(p + 1*8)) = __ccgo_fp(_initScanContentNS)
  28375. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  28376. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  28377. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  28378. return int32(1)
  28379. }
  28380. func _findEncodingNS(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  28381. bp := tls.Alloc(144)
  28382. defer tls.Free(144)
  28383. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  28384. var i int32
  28385. var _ /* buf at bp+8 */ [128]uint8
  28386. var _ /* p at bp+136 */ uintptr
  28387. _ = i
  28388. *(*[128]uint8)(unsafe.Pointer(bp + 8)) = [128]uint8{}
  28389. *(*uintptr)(unsafe.Pointer(bp + 136)) = bp + 8
  28390. (*(*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))
  28391. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  28392. return uintptr(0)
  28393. }
  28394. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136)))) = uint8(0)
  28395. if _streqci(tls, bp+8, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  28396. return enc
  28397. }
  28398. i = _getEncodingIndex(tls, bp+8)
  28399. if i == int32(_UNKNOWN_ENC) {
  28400. return uintptr(0)
  28401. }
  28402. return _encodingsNS[i]
  28403. }
  28404. 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) {
  28405. return _doParseXmlDecl(tls, __ccgo_fp(_findEncodingNS), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  28406. }
  28407. func XXmlInitUnknownEncodingNS(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  28408. var enc uintptr
  28409. _ = enc
  28410. enc = XXmlInitUnknownEncoding(tls, mem, table, convert, userData)
  28411. if enc != 0 {
  28412. *(*uint8)(unsafe.Pointer(enc + 136 + 58)) = uint8(_BT_COLON)
  28413. }
  28414. return enc
  28415. }
  28416. func __ccgo_fp(f interface{}) uintptr {
  28417. type iface [2]uintptr
  28418. return (*iface)(unsafe.Pointer(&f))[1]
  28419. }
  28420. var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data
  28421. var __ccgo_ts1 = "\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0e\x0f\x00EXPAT_ENTROPY_DEBUG\x00expat: Entropy: %s --> 0x%0*lx (%lu bytes)\n\x00arc4random_buf\x00EXPAT_ACCOUNTING_DEBUG\x00EXPAT_ENTITY_DEBUG\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\x00a successful prior call to function XML_GetBuffer is required\x00limit on input amplification factor (from DTD and entities) breached\x00expat_2.5.0\x00sizeof(XML_Char)\x00sizeof(XML_LChar)\x00XML_DTD\x00XML_CONTEXT_BYTES\x00XML_NS\x00XML_BLAP_MAX_AMP\x00XML_BLAP_ACT_THRES\x00expat: Accounting(%p): Direct %10llu, indirect %10llu, amplification %8.2f%s\x00 ABORTING\n\x00DIR\x00EXP\x00 (+%6ld bytes %s|%d, xmlparse.c:%d) %*s\"\x00\x00%s\x00\"\n\x00%\x00&\x00expat: Entities(%p): Count %9d, depth %2d/%2d %*s%s%s; %s length %d (xmlparse.c:%d)\n\x00OPEN \x00CLOSE\x00\\0\x00\\x1\x00\\x2\x00\\x3\x00\\x4\x00\\x5\x00\\x6\x00\\x7\x00\\x8\x00\\t\x00\\n\x00\\xB\x00\\xC\x00\\r\x00\\xE\x00\\xF\x00\\x10\x00\\x11\x00\\x12\x00\\x13\x00\\x14\x00\\x15\x00\\x16\x00\\x17\x00\\x18\x00\\x19\x00\\x1A\x00\\x1B\x00\\x1C\x00\\x1D\x00\\x1E\x00\\x1F\x00 \x00!\x00\\\"\x00#\x00$\x00'\x00(\x00)\x00*\x00+\x00,\x00-\x00.\x00/\x000\x001\x002\x003\x004\x005\x006\x007\x008\x009\x00:\x00;\x00<\x00=\x00>\x00?\x00@\x00A\x00B\x00C\x00D\x00E\x00F\x00G\x00H\x00I\x00J\x00K\x00L\x00M\x00N\x00O\x00P\x00Q\x00R\x00S\x00T\x00U\x00V\x00W\x00X\x00Y\x00Z\x00[\x00\\\\\x00]\x00^\x00_\x00`\x00a\x00b\x00c\x00d\x00e\x00f\x00g\x00h\x00i\x00j\x00k\x00l\x00m\x00n\x00o\x00p\x00q\x00r\x00s\x00t\x00u\x00v\x00w\x00x\x00y\x00z\x00{\x00|\x00}\x00~\x00\\x7F\x00\\x80\x00\\x81\x00\\x82\x00\\x83\x00\\x84\x00\\x85\x00\\x86\x00\\x87\x00\\x88\x00\\x89\x00\\x8A\x00\\x8B\x00\\x8C\x00\\x8D\x00\\x8E\x00\\x8F\x00\\x90\x00\\x91\x00\\x92\x00\\x93\x00\\x94\x00\\x95\x00\\x96\x00\\x97\x00\\x98\x00\\x99\x00\\x9A\x00\\x9B\x00\\x9C\x00\\x9D\x00\\x9E\x00\\x9F\x00\\xA0\x00\\xA1\x00\\xA2\x00\\xA3\x00\\xA4\x00\\xA5\x00\\xA6\x00\\xA7\x00\\xA8\x00\\xA9\x00\\xAA\x00\\xAB\x00\\xAC\x00\\xAD\x00\\xAE\x00\\xAF\x00\\xB0\x00\\xB1\x00\\xB2\x00\\xB3\x00\\xB4\x00\\xB5\x00\\xB6\x00\\xB7\x00\\xB8\x00\\xB9\x00\\xBA\x00\\xBB\x00\\xBC\x00\\xBD\x00\\xBE\x00\\xBF\x00\\xC0\x00\\xC1\x00\\xC2\x00\\xC3\x00\\xC4\x00\\xC5\x00\\xC6\x00\\xC7\x00\\xC8\x00\\xC9\x00\\xCA\x00\\xCB\x00\\xCC\x00\\xCD\x00\\xCE\x00\\xCF\x00\\xD0\x00\\xD1\x00\\xD2\x00\\xD3\x00\\xD4\x00\\xD5\x00\\xD6\x00\\xD7\x00\\xD8\x00\\xD9\x00\\xDA\x00\\xDB\x00\\xDC\x00\\xDD\x00\\xDE\x00\\xDF\x00\\xE0\x00\\xE1\x00\\xE2\x00\\xE3\x00\\xE4\x00\\xE5\x00\\xE6\x00\\xE7\x00\\xE8\x00\\xE9\x00\\xEA\x00\\xEB\x00\\xEC\x00\\xED\x00\\xEE\x00\\xEF\x00\\xF0\x00\\xF1\x00\\xF2\x00\\xF3\x00\\xF4\x00\\xF5\x00\\xF6\x00\\xF7\x00\\xF8\x00\\xF9\x00\\xFA\x00\\xFB\x00\\xFC\x00\\xFD\x00\\xFE\x00\\xFF\x00dead code\x00"